diff --git a/.bzrignore b/.bzrignore index 6d412aa964a..1cb0cf2b315 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1199,6 +1199,17 @@ storage/tokudb/ft-index/tools/tdb-recover storage/tokudb/ft-index/tools/tdb_logprint storage/tokudb/ft-index/tools/tokudb_dump storage/tokudb/ft-index/tools/tokuftdump +storage/mroonga/config.sh +storage/mroonga/mrn_version.h +storage/mroonga/data/install.sql +storage/mroonga/vendor/groonga/config.sh +storage/mroonga/vendor/groonga/groonga.pc +storage/mroonga/vendor/groonga/version.sh +storage/mroonga/vendor/groonga/src/grnslap +storage/mroonga/vendor/groonga/src/groonga +storage/mroonga/vendor/groonga/src/groonga-benchmark +storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset +storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql/groonga-normalizer-mysql.pc libmysql/libmysql_versions.ld scripts/mysql_config.pl pcre/pcre_chartables.c diff --git a/VERSION b/VERSION index 8b9f91dd819..846e8094fff 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=14 +MYSQL_VERSION_PATCH=15 diff --git a/client/mysql.cc b/client/mysql.cc index e81761106ca..60bed6b0d6a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1292,6 +1292,16 @@ int main(int argc,char *argv[]) sig_handler mysql_end(int sig) { +#ifndef _WIN32 + /* + Ingnoring SIGQUIT and SIGINT signals when cleanup process starts. + This will help in resolving the double free issues, which occures in case + the signal handler function is started in between the clean up function. + */ + signal(SIGQUIT, SIG_IGN); + signal(SIGINT, SIG_IGN); +#endif + mysql_close(&mysql); #ifdef HAVE_READLINE if (!status.batch && !quick && !opt_html && !opt_xml && diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 99da157f8c6..034f021109a 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -15,14 +15,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include #include #include -#include -#include -#include - #define SHOW_VERSION "1.0.0" #define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \ diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 5c254fde243..03f84dab7f3 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -767,7 +767,7 @@ static int run_mysqlcheck_upgrade(const char *arg1, const char *arg2) static int run_mysqlcheck_fixnames(void) { - verbose("Phase 3/4: Fixing table and database names"); + verbose("Phase 3/5: Fixing table and database names"); print_conn_args("mysqlcheck"); return run_tool(mysqlcheck_path, NULL, /* Send output from mysqlcheck directly to screen */ @@ -865,7 +865,8 @@ static int run_sql_fix_privilege_tables(void) query_ptr++ ) { - dynstr_append(&ds_script, *query_ptr); + if (strcasecmp(*query_ptr, "flush privileges;\n")) + dynstr_append(&ds_script, *query_ptr); } run_query(ds_script.str, @@ -1026,19 +1027,23 @@ int main(int argc, char **argv) /* Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" */ - verbose("Phase 1/4: Checking mysql database"); + verbose("Phase 1/5: Checking mysql database"); if (run_mysqlcheck_upgrade("--databases", "mysql")) die("Upgrade failed" ); - verbose("Phase 2/4: Running 'mysql_fix_privilege_tables'..."); + verbose("Phase 2/5: Running 'mysql_fix_privilege_tables'..."); if (run_sql_fix_privilege_tables()) die("Upgrade failed" ); if (!opt_systables_only && (run_mysqlcheck_fixnames() || - verbose("Phase 4/4: Checking and upgrading tables") || + verbose("Phase 4/5: Checking and upgrading tables") || run_mysqlcheck_upgrade("--all-databases","--skip-database=mysql"))) die("Upgrade failed" ); + verbose("Phase 5/5: Running 'FLUSH PRIVILEGES'..."); + if (run_query("FLUSH PRIVILEGES", NULL, TRUE)) + die("Upgrade failed" ); + verbose("OK"); /* Create a file indicating upgrade has been performed */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index af0d86b1ed5..0d4ee549c4f 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -30,19 +30,15 @@ #include "client_priv.h" #include "mysql_version.h" -#ifdef HAVE_LIBPTHREAD #include -#endif #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ /* Global Thread counter */ uint counter; -#ifdef HAVE_LIBPTHREAD pthread_mutex_t counter_mutex; pthread_cond_t count_threshhold; -#endif static void db_error_with_table(MYSQL *mysql, char *table); static void db_error(MYSQL *mysql); @@ -502,7 +498,10 @@ static void safe_exit(int error, MYSQL *mysql) free_defaults(argv_to_free); mysql_library_end(); my_free(opt_password); - my_end(my_end_arg); + if (error) + sf_leaking_memory= 1; /* dirty exit, some threads are still running */ + else + my_end(my_end_arg); /* clean exit */ exit(error); } @@ -575,7 +574,6 @@ static char *field_escape(char *to,const char *from,uint length) int exitcode= 0; -#ifdef HAVE_LIBPTHREAD pthread_handler_t worker_thread(void *arg) { int error; @@ -615,7 +613,6 @@ error: return 0; } -#endif int main(int argc, char **argv) @@ -635,7 +632,6 @@ int main(int argc, char **argv) } sf_leaking_memory=0; /* from now on we cleanup properly */ -#ifdef HAVE_LIBPTHREAD if (opt_use_threads && !lock_tables) { pthread_t mainthread; /* Thread descriptor */ @@ -689,7 +685,6 @@ int main(int argc, char **argv) pthread_attr_destroy(&attr); } else -#endif { MYSQL *mysql= 0; if (!(mysql= db_connect(current_host,current_db,current_user,opt_password))) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 01064f74261..b67e409ef0b 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -84,9 +84,7 @@ TODO: #include #include #include -#include #include -#include #ifndef __WIN__ #include #endif diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 80bb24765a7..02a075cf9b4 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -5908,6 +5908,7 @@ void do_connect(struct st_command *command) { int con_port= opt_port; char *con_options; + char *ssl_cipher= 0; my_bool con_ssl= 0, con_compress= 0; my_bool con_pipe= 0; my_bool con_shm __attribute__ ((unused))= 0; @@ -5996,6 +5997,11 @@ void do_connect(struct st_command *command) length= (size_t) (end - con_options); if (length == 3 && !strncmp(con_options, "SSL", 3)) con_ssl= 1; + else if (!strncmp(con_options, "SSL-CIPHER=", 11)) + { + con_ssl= 1; + ssl_cipher=con_options + 11; + } else if (length == 8 && !strncmp(con_options, "COMPRESS", 8)) con_compress= 1; else if (length == 4 && !strncmp(con_options, "PIPE", 4)) @@ -6052,7 +6058,7 @@ void do_connect(struct st_command *command) { #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) mysql_ssl_set(con_slot->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, - opt_ssl_capath, opt_ssl_cipher); + opt_ssl_capath, ssl_cipher ? ssl_cipher : opt_ssl_cipher); mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(con_slot->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); #if MYSQL_VERSION_ID >= 50000 diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 8ee87840798..8c442375116 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -181,7 +181,7 @@ IF(RPM MATCHES "(rhel|centos)5") ELSEIF(RPM MATCHES "(rhel|centos)6") ALTERNATIVE_NAME("client" "mysql") ALTERNATIVE_NAME("shared" "mysql-libs") -ELSEIF(RPM MATCHES "fedora") +ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") SET(epoch 1) # this is fedora ALTERNATIVE_NAME("client" "mariadb") ALTERNATIVE_NAME("client" "mysql") diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index d5f60832884..ebf3852182c 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -102,16 +102,6 @@ IF(UNIX) ENDIF() ENDIF() -# -# plugin_tests's value should not be used by imported plugins, -# just use if(INSTALL_PLUGINTESTDIR). -# The plugin must set its own install path for tests -# -FILE(GLOB plugin_tests - ${CMAKE_SOURCE_DIR}/plugin/*/tests - ${CMAKE_SOURCE_DIR}/internal/plugin/*/tests -) - # # STANDALONE layout # @@ -136,7 +126,6 @@ SET(INSTALL_SQLBENCHDIR_STANDALONE ".") SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") # SET(INSTALL_MYSQLDATADIR_STANDALONE "data") -SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock") # @@ -170,7 +159,6 @@ SET(INSTALL_SQLBENCHDIR_RPM "") SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql") # SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") -SET(INSTALL_PLUGINTESTDIR_RPM ${plugin_tests}) SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock") @@ -199,7 +187,6 @@ SET(INSTALL_SQLBENCHDIR_DEB ".") SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") -SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") # @@ -226,7 +213,6 @@ SET(INSTALL_SQLBENCHDIR_SVR4 ".") SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") # SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql") -SET(INSTALL_PLUGINTESTDIR_SVR4 ${plugin_tests}) SET(INSTALL_UNIX_ADDRDIR_SVR "/tmp/mysql.sock") @@ -242,7 +228,7 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE # layout is chosen) FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2 - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST UNIX_ADDR) + INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 70dbb7c7ff1..62704f175e8 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -65,7 +65,7 @@ MACRO(MYSQL_ADD_PLUGIN) ENDIF() IF(WITH_${plugin}_STORAGE_ENGINE - OR WITH_{$plugin} + OR WITH_${plugin} OR WITH_ALL OR WITH_MAX AND NOT WITHOUT_${plugin}_STORAGE_ENGINE diff --git a/config.h.cmake b/config.h.cmake index 8faf887730a..6a0527719f9 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -656,4 +656,21 @@ #define __STDC_FORMAT_MACROS #endif +/* + stat structure (from ) is conditionally defined + to have different layout and size depending on the defined macros. + The correct macro is defined in my_config.h, which means it MUST be + included first (or at least before - so, practically, + before including any system headers). + + Check the include order by looking at __GLIBC__ (defined in ) + + But we cannot force all third-party clients/connectors to include + my_config.h first. So, their crashes are their responsibility, + we enable this check only for MariaDB sources (SAFE_MUTEX check). +*/ +#if defined(__GLIBC__) && defined(SAFE_MUTEX) +#error MUST be included first! +#endif + #endif diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control index 4cdd558448d..22eaa09c52e 100644 --- a/debian/dist/Debian/control +++ b/debian/dist/Debian/control @@ -41,11 +41,14 @@ Architecture: any Suggests: tinyca, mailx, mariadb-galera-test, netcat-openbsd Recommends: libhtml-template-perl Pre-Depends: mariadb-common, adduser (>= 3.40), debconf -Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), - ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), - libmariadbclient18 (>= ${binary:Version}), galera (>=25.2), - rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils -Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5, mysql-server-core-10.0, mariadb-server, mysql-server, virtual-mysql-server, mariadb-galera-server +Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, + perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, + passwd, lsb-base (>= 3.0-10), bsdutils, + libmariadbclient18 (>= ${binary:Version}), galera (>=25.2), + rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils +Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5, + mysql-server-core-10.0, mariadb-server, mysql-server, + virtual-mysql-server, mariadb-galera-server Conflicts: mariadb-server, mysql-server, mariadb-galera-server (<< ${source:Version}), mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, diff --git a/debian/dist/Debian/mariadb-galera-server-10.0.files.in b/debian/dist/Debian/mariadb-galera-server-10.0.files.in index a8df04fedc2..bf1b04b5787 100644 --- a/debian/dist/Debian/mariadb-galera-server-10.0.files.in +++ b/debian/dist/Debian/mariadb-galera-server-10.0.files.in @@ -1,6 +1,7 @@ usr/sbin/mysqld usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_socket.so +usr/lib/mysql/plugin/ha_mroonga.so usr/lib/mysql/plugin/ha_sequence.so usr/lib/mysql/plugin/ha_sphinx.so usr/lib/mysql/plugin/ha_innodb.so diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control index 5799d107d7a..7a6aae756a2 100644 --- a/debian/dist/Ubuntu/control +++ b/debian/dist/Ubuntu/control @@ -41,11 +41,14 @@ Architecture: any Suggests: tinyca, mailx, mariadb-galera-test, netcat-openbsd Recommends: libhtml-template-perl Pre-Depends: mariadb-common, adduser (>= 3.40), debconf -Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), - ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10), - libmariadbclient18 (>= ${binary:Version}), galera (>=25.2), - rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils -Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5, mysql-server-core-10.0, mariadb-server, mysql-server, virtual-mysql-server, mariadb-galera-server +Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, + perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, + passwd, lsb-base (>= 3.0-10), bsdutils, + libmariadbclient18 (>= ${binary:Version}), galera (>=25.2), + rsync, lsof, socat, grep, gawk, iproute, coreutils, findutils +Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5, + mysql-server-core-10.0, mariadb-server, mysql-server, + virtual-mysql-server, mariadb-galera-server Conflicts: mariadb-server, mysql-server, mariadb-galera-server (<< ${source:Version}), mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5, mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3, diff --git a/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in b/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in index ec2a2ac75b3..368400c68b8 100644 --- a/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in +++ b/debian/dist/Ubuntu/mariadb-galera-server-10.0.files.in @@ -1,6 +1,7 @@ usr/sbin/mysqld usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_socket.so +usr/lib/mysql/plugin/ha_mroonga.so usr/lib/mysql/plugin/ha_sequence.so usr/lib/mysql/plugin/ha_sphinx.so usr/lib/mysql/plugin/ha_innodb.so diff --git a/debian/mariadb-galera-test-10.0.files b/debian/mariadb-galera-test-10.0.files index ab455a828ea..0d5fb2ba8dd 100644 --- a/debian/mariadb-galera-test-10.0.files +++ b/debian/mariadb-galera-test-10.0.files @@ -6,6 +6,7 @@ usr/lib/mysql/plugin/qa_auth_client.so usr/lib/mysql/plugin/auth_0x0100.so usr/lib/mysql/plugin/mypluglib.so usr/lib/mysql/plugin/ha_test_sql_discovery.so +usr/lib/mysql/plugin/ha_example.so usr/lib/mysql/plugin/daemon_example.ini usr/lib/mysql/plugin/libdaemon_example.so usr/lib/mysql/plugin/adt_null.so diff --git a/extra/comp_err.c b/extra/comp_err.c index 59fa508a7fe..3fc4b05fa61 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #define MAX_ROWS 2000 diff --git a/extra/yassl/README b/extra/yassl/README index 2c144815f19..b18e2baeea8 100644 --- a/extra/yassl/README +++ b/extra/yassl/README @@ -12,15 +12,31 @@ before calling SSL_new(); *** end Note *** -yaSSL Release notes, version 2.3.0 (12/5/2013) +yaSSL Release notes, version 2.3.4 (8/15/2014) - This release of yaSSL updates asm for newer GCC versions. + This release of yaSSL adds checking to the input_buffer class itself. See normal build instructions below under 1.0.6. See libcurl build instructions below under 1.3.0 and note in 1.5.8. -*****************yaSSL Release notes, version 2.2.3b (4/23/2013) +yaSSL Release notes, version 2.3.2 (7/25/2014) + + This release of yaSSL updates test certs. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.3.0 (12/5/2013) + + This release of yaSSL updates asm for newer GCC versions. + +See normal build instructions below under 1.0.6. +See libcurl build instructions below under 1.3.0 and note in 1.5.8. + + +*****************yaSSL Release notes, version 2.2.3 (4/23/2013) This release of yaSSL updates the test certificates as they were expired diff --git a/extra/yassl/certs/ca-cert.pem b/extra/yassl/certs/ca-cert.pem index b2dc6ae6ee3..7e64eb47961 100644 --- a/extra/yassl/certs/ca-cert.pem +++ b/extra/yassl/certs/ca-cert.pem @@ -1,45 +1,45 @@ -----BEGIN CERTIFICATE----- -MIIEnjCCA4agAwIBAgIJAOnQp195JfQ8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYD -VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G -A1UEChMIU2F3dG9vdGgxEzARBgNVBAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3 -dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTEx -MTAyNDE4MTgxNVoXDTE0MDcyMDE4MTgxNVowgZAxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290 -aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd -MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQC/DMotFLIehEJbzTgfSvJNdRDxtjWf38p9A5jTrN4DZu4q -8diwfW4HVAsQmCFNgMsSIOfMT95FfclydzLqypC7aVIQAy+o85XF8YtiVhvvZ2+k -EEGVrQqb46XAsNJwdlAwW6joCCx87aeieo04KRysx+3yfJWwlYJ9SVw4zXcl772A -dVOUPD3KY1ufFbXTHRMvGdE823Y6zLh9yeXC19pAb9gh3HMbQi1TnP4a/H2rejY/ -mN6EfAVnzmoUOIep8Yy1aMtof3EgK/WgY/VWL6Mm0rdvsVoX1ziZCP6TWG/+wxNJ -CBYLp01nAFIxZyNOmO1RRR25BNkL7Ngos0u97TZ5AgMBAAGjgfgwgfUwHQYDVR0O -BBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHFBgNVHSMEgb0wgbqAFCeOZxF0wyYd -P+0zY7Ok2B0w5ejVoYGWpIGTMIGQMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHTW9u -dGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8GA1UEChMIU2F3dG9vdGgxEzARBgNV -BAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG -9w0BCQEWDmluZm9AeWFzc2wuY29tggkA6dCnX3kl9DwwDAYDVR0TBAUwAwEB/zAN -BgkqhkiG9w0BAQUFAAOCAQEAX4YU9FGLvKVOMNperJr4bNkmS5P54xyJb57us513 -PokgdqPm6IYVIdviM7I01dCf88Gkh5Jc+dH/MC+OA7yzPAwyo5BfGpAer53zntcH -Aql9J2ZjL68Y16wYmIyDjzjzC6w2EHX7ynYTUFsCj3O/46Dug1IlVM4mzpy9L3mr -G2C4kvEDwPw7CNnArdVyCCWAYS3cn6eDYgdH4AdMSwcwBKmHHFV/BxLQy0Jdy89m -ARoX7vkPYLfbb2jlTkFibtNvYE9LJ97PGAfxE13LP6klRNpSXMgE4VYS9SqQTtHi -rwG1I6HsMdp7Y2nEuPPnzqE9wNtt87LZRsifw7hwWh9/yg== +MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G +A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 +dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D +mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx +i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J +XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc +/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI +/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU +J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 +aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf ++n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH +7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 +DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB +VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq +Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== -----END CERTIFICATE----- Certificate: Data: Version: 3 (0x2) Serial Number: - e9:d0:a7:5f:79:25:f4:3c - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com + 9a:41:47:cd:a1:14:62:8c + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Oct 24 18:18:15 2011 GMT - Not After : Jul 20 18:18:15 2014 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 03:20:08 2014 GMT + Not After : Apr 6 03:20:08 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): + Public-Key: (2048 bit) + Modulus: 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: @@ -64,24 +64,24 @@ Certificate: 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 X509v3 Authority Key Identifier: keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.yassl.com/emailAddress=info@yassl.com - serial:E9:D0:A7:5F:79:25:F4:3C + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption - 5f:86:14:f4:51:8b:bc:a5:4e:30:da:5e:ac:9a:f8:6c:d9:26: - 4b:93:f9:e3:1c:89:6f:9e:ee:b3:9d:77:3e:89:20:76:a3:e6: - e8:86:15:21:db:e2:33:b2:34:d5:d0:9f:f3:c1:a4:87:92:5c: - f9:d1:ff:30:2f:8e:03:bc:b3:3c:0c:32:a3:90:5f:1a:90:1e: - af:9d:f3:9e:d7:07:02:a9:7d:27:66:63:2f:af:18:d7:ac:18: - 98:8c:83:8f:38:f3:0b:ac:36:10:75:fb:ca:76:13:50:5b:02: - 8f:73:bf:e3:a0:ee:83:52:25:54:ce:26:ce:9c:bd:2f:79:ab: - 1b:60:b8:92:f1:03:c0:fc:3b:08:d9:c0:ad:d5:72:08:25:80: - 61:2d:dc:9f:a7:83:62:07:47:e0:07:4c:4b:07:30:04:a9:87: - 1c:55:7f:07:12:d0:cb:42:5d:cb:cf:66:01:1a:17:ee:f9:0f: - 60:b7:db:6f:68:e5:4e:41:62:6e:d3:6f:60:4f:4b:27:de:cf: - 18:07:f1:13:5d:cb:3f:a9:25:44:da:52:5c:c8:04:e1:56:12: - f5:2a:90:4e:d1:e2:af:01:b5:23:a1:ec:31:da:7b:63:69:c4: - b8:f3:e7:ce:a1:3d:c0:db:6d:f3:b2:d9:46:c8:9f:c3:b8:70: - 5a:1f:7f:ca + 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: + fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: + f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: + 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: + 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: + ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: + c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: + b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: + 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: + 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: + 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: + e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: + 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: + bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: + b2:b3:03:d8 diff --git a/extra/yassl/certs/client-cert.der b/extra/yassl/certs/client-cert.der index 9c2ef138bf6..293985adb97 100644 Binary files a/extra/yassl/certs/client-cert.der and b/extra/yassl/certs/client-cert.der differ diff --git a/extra/yassl/certs/client-cert.pem b/extra/yassl/certs/client-cert.pem index 278b43fe65c..38330d5380e 100644 --- a/extra/yassl/certs/client-cert.pem +++ b/extra/yassl/certs/client-cert.pem @@ -2,17 +2,17 @@ Certificate: Data: Version: 3 (0x2) Serial Number: - 87:4a:75:be:91:66:d8:3d - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=Programming, CN=www.yassl.com/emailAddress=info@yassl.com + b6:63:af:8f:5d:62:57:a0 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Oct 24 18:21:55 2011 GMT - Not After : Jul 20 18:21:55 2014 GMT - Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=Programming, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 17:39:44 2014 GMT + Not After : Apr 6 17:39:44 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Programming, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): + Public-Key: (2048 bit) + Modulus: 00:c3:03:d1:2b:fe:39:a4:32:45:3b:53:c8:84:2b: 2a:7c:74:9a:bd:aa:2a:52:07:47:d6:a6:36:b2:07: 32:8e:d0:ba:69:7b:c6:c3:44:9e:d4:81:48:fd:2d: @@ -37,51 +37,51 @@ Certificate: 33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 X509v3 Authority Key Identifier: keyid:33:D8:45:66:D7:68:87:18:7E:54:0D:70:27:91:C7:26:D7:85:65:C0 - DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/OU=Programming/CN=www.yassl.com/emailAddress=info@yassl.com - serial:87:4A:75:BE:91:66:D8:3D + DirName:/C=US/ST=Montana/L=Bozeman/O=wolfSSL/OU=Programming/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:B6:63:AF:8F:5D:62:57:A0 X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption - 1c:7c:42:81:29:9e:21:cf:d0:d8:c1:54:6f:cc:ae:14:09:38: - ff:68:98:9a:95:53:76:18:7b:e6:30:76:ec:28:0d:75:a7:de: - e0:cd:8e:d5:55:23:6a:47:2b:4e:8d:fc:7d:06:a3:d8:0f:ad: - 5e:d6:04:c9:00:33:fb:77:27:d3:b5:03:b3:7b:21:74:31:0b: - 4a:af:2d:1a:b3:93:8e:cc:f3:5f:3d:90:3f:cc:e3:55:19:91: - 7b:78:24:2e:4a:09:bb:18:4e:61:2d:9c:c6:0a:a0:34:91:88: - 70:6b:3b:48:47:bc:79:94:a2:a0:4d:32:47:54:c2:a3:dc:2e: - d2:51:4c:29:39:11:ff:e2:15:5e:58:97:36:f6:e9:06:06:86: - 0e:8d:9d:95:03:72:b2:8b:19:7c:e9:14:6e:a1:88:73:68:58: - 6d:71:5e:c2:d5:d3:13:d2:5f:de:ea:03:be:e2:00:40:e5:ce: - fd:e6:92:31:57:c3:eb:bb:66:ac:cb:2f:1a:fa:e0:62:a2:47: - f4:93:43:2a:4b:6c:5e:0a:2f:f9:e7:e6:4a:63:86:b0:ac:2a: - a1:eb:b4:5b:67:cd:32:e4:b6:11:4b:9a:72:66:0d:a2:4a:76: - 8f:fe:22:bc:83:fd:db:b7:d5:a9:ee:05:c9:b1:71:7e:1b:2b: - e1:e3:af:c0 + 85:10:90:c5:5d:de:25:8c:f2:57:7b:2d:14:1c:05:f9:71:63: + 40:b0:e3:c1:c1:2e:13:2a:7a:b7:d6:24:58:87:eb:03:fb:0d: + af:e0:f4:d0:c8:bc:51:36:10:4f:79:cc:4f:66:7d:af:99:cb: + 7b:ce:68:94:c6:36:aa:42:6e:8c:78:5b:b2:85:ca:d1:e1:a8: + 31:d1:81:d9:f9:c1:a3:9e:34:43:ef:0a:79:7d:3e:83:61:fc: + 14:5c:d1:dd:bc:0e:d7:51:b7:71:6e:41:7e:8b:2c:5a:9a:cb: + 77:4b:6a:f5:06:ff:02:af:1e:e6:63:4f:bc:44:d9:3f:56:9e: + 09:9c:43:f9:55:21:32:46:82:09:86:a9:7b:74:1c:9e:5a:2a: + bf:03:79:91:cb:f2:29:7f:c9:15:82:89:b9:53:cd:7e:07:90: + a9:5d:76:e1:19:5e:0d:58:b8:59:d5:0d:df:23:ab:6b:63:76: + 19:9e:9c:df:b0:57:49:6c:d0:86:97:c3:6c:3c:fa:e0:56:c2: + 1b:e3:a1:42:1a:58:62:85:9d:74:19:83:08:af:59:90:f8:99: + bd:67:d3:4a:ea:0e:c9:ca:61:8a:0d:8a:42:cc:90:e9:2e:c2: + 54:73:7f:5e:af:8d:e2:32:cb:45:20:d6:19:4d:5b:77:31:cc: + 0f:2d:c0:7e -----BEGIN CERTIFICATE----- -MIIEmDCCA4CgAwIBAgIJAIdKdb6RZtg9MA0GCSqGSIb3DQEBBQUAMIGOMQswCQYD -VQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwG -A1UEChMFeWFTU0wxFDASBgNVBAsTC1Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cu -eWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0xMTEw -MjQxODIxNTVaFw0xNDA3MjAxODIxNTVaMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UE -CBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFTU0wxFDAS -BgNVBAsTC1Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJ -KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAMMD0Sv+OaQyRTtTyIQrKnx0mr2qKlIHR9amNrIHMo7Quml7xsNE -ntSBSP0taKKLZ7uhdcg2LErSG/eLus8N+e/s8YEee5sDR5q/Zcx/ZSRppugUiVvk -NPfFsBST9Wd7Onp44QFWVpGmE0KN0jxAnEzv0YbfN1EbDKE79fGjSjXk4c6W3xt+ -v06X0BDoqAgwga8gC0MUxXRntDKCb42GwohAmTaDuh5AciIX11JlJHOwzu8Zza7/ -eGx7wBID1E5yDVBtO6M7o5lencjZDIWz2YrZVCbbbfqsu/8lTMTRefRx04ZAGBOw -Y7VyTjDEl4SGLVYv1xX3f8Cu9fxb5fuhutMCAwEAAaOB9jCB8zAdBgNVHQ4EFgQU -M9hFZtdohxh+VA1wJ5HHJteFZcAwgcMGA1UdIwSBuzCBuIAUM9hFZtdohxh+VA1w -J5HHJteFZcChgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24x -ETAPBgNVBAcTCFBvcnRsYW5kMQ4wDAYDVQQKEwV5YVNTTDEUMBIGA1UECxMLUHJv -Z3JhbW1pbmcxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEW -DmluZm9AeWFzc2wuY29tggkAh0p1vpFm2D0wDAYDVR0TBAUwAwEB/zANBgkqhkiG -9w0BAQUFAAOCAQEAHHxCgSmeIc/Q2MFUb8yuFAk4/2iYmpVTdhh75jB27CgNdafe -4M2O1VUjakcrTo38fQaj2A+tXtYEyQAz+3cn07UDs3shdDELSq8tGrOTjszzXz2Q -P8zjVRmRe3gkLkoJuxhOYS2cxgqgNJGIcGs7SEe8eZSioE0yR1TCo9wu0lFMKTkR -/+IVXliXNvbpBgaGDo2dlQNysosZfOkUbqGIc2hYbXFewtXTE9Jf3uoDvuIAQOXO -/eaSMVfD67tmrMsvGvrgYqJH9JNDKktsXgov+efmSmOGsKwqoeu0W2fNMuS2EUua -cmYNokp2j/4ivIP927fVqe4FybFxfhsr4eOvwA== +MIIEqjCCA5KgAwIBAgIJALZjr49dYlegMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4G +A1UECgwHd29sZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTExNzM5NDRaFw0xNzA0MDYxNzM5NDRaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQMA4GA1UECgwHd29s +ZlNTTDEUMBIGA1UECwwLUHJvZ3JhbW1pbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAMMD0Sv+OaQyRTtTyIQrKnx0mr2qKlIHR9am +NrIHMo7Quml7xsNEntSBSP0taKKLZ7uhdcg2LErSG/eLus8N+e/s8YEee5sDR5q/ +Zcx/ZSRppugUiVvkNPfFsBST9Wd7Onp44QFWVpGmE0KN0jxAnEzv0YbfN1EbDKE7 +9fGjSjXk4c6W3xt+v06X0BDoqAgwga8gC0MUxXRntDKCb42GwohAmTaDuh5AciIX +11JlJHOwzu8Zza7/eGx7wBID1E5yDVBtO6M7o5lencjZDIWz2YrZVCbbbfqsu/8l +TMTRefRx04ZAGBOwY7VyTjDEl4SGLVYv1xX3f8Cu9fxb5fuhutMCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUM9hFZtdohxh+VA1wJ5HHJteFZcAwgckGA1UdIwSBwTCBvoAU +M9hFZtdohxh+VA1wJ5HHJteFZcChgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMRAwDgYDVQQKDAd3b2xmU1NM +MRQwEgYDVQQLDAtQcm9ncmFtbWluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAtmOvj11iV6AwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAhRCQxV3eJYzyV3stFBwF+XFj +QLDjwcEuEyp6t9YkWIfrA/sNr+D00Mi8UTYQT3nMT2Z9r5nLe85olMY2qkJujHhb +soXK0eGoMdGB2fnBo540Q+8KeX0+g2H8FFzR3bwO11G3cW5BfossWprLd0tq9Qb/ +Aq8e5mNPvETZP1aeCZxD+VUhMkaCCYape3QcnloqvwN5kcvyKX/JFYKJuVPNfgeQ +qV124RleDVi4WdUN3yOra2N2GZ6c37BXSWzQhpfDbDz64FbCG+OhQhpYYoWddBmD +CK9ZkPiZvWfTSuoOycphig2KQsyQ6S7CVHN/Xq+N4jLLRSDWGU1bdzHMDy3Afg== -----END CERTIFICATE----- diff --git a/extra/yassl/certs/client-key.der b/extra/yassl/certs/client-key.der index 649406c4417..94dc253a2bd 100644 Binary files a/extra/yassl/certs/client-key.der and b/extra/yassl/certs/client-key.der differ diff --git a/extra/yassl/certs/client-keyEnc.pem b/extra/yassl/certs/client-keyEnc.pem index 6f29eac50c1..0097c0760a5 100644 --- a/extra/yassl/certs/client-keyEnc.pem +++ b/extra/yassl/certs/client-keyEnc.pem @@ -1,30 +1,12 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,B9D8FB94E38635AB +DEK-Info: DES-EDE3-CBC,BDE979D13CCC0ABD -3OTcffWLy2Ddlu2oUwnMWkvIb3e9wLL1jrKOpC0aeb//uiawgw50+KuU4pewB5fN -lfEJwpX4NjfPL+Nk+B1VAVrv5gwk5/SY9SwIJluutzmGS4TfVOhqi2SVd0mc9kOD -cSWQ9ltAohFu67jdx36j2u+eghDTOjls1lM8EpzL5cu3Bp4G+ST0nXAdnGtSZdV6 -eToLWjIHiC/JqeRSsKAlG0M5verw14sbb5MO4ZQF4Tdu0fCFgFvDSUM2V4ZLtS1N -VysLEkHoF56YKZ5H2FYLxOVDpn5lSiLnOgRbteEzsysyJ1zLxXWFFwJPCpLVNL0e -P7OoEoCR+oAdzGkkPF+EdMoULtQP+n6U7jGx3oFVS17NORIFvyxyP0hD4pGTGLnl -qAEk30lhKGAE5GgvA2itxZIno/sxPKr5T5Sc2yWh9RdQuLWYNrOb8Kz8J1iXV5l6 -/5TLGu5XVWIlBnUtjMFUe5M54tqGQ6SuDUlL2ud5YeLVN0T+RU/bqV2fXGoBUqKb -Oe8PECm62Ls0wjv27BIOXXV32WSXwsywSzBqq2YXZ5zc9Q0+Mf1Zl6jKwcr8rXhv -rA2kcpicONryggsPZnn/us1bVuWKndsCbm7A5om6HowpamNMPuxhISigzzE59L6X -X6Sl2F0N0zhrfUVlAAlfYTrwcQVtyBDj1xp2nzJFocurJt9EylLaT0Sw3nxWtuOg -yQuF05UPCzxqow/7dMVqtQKng0ptpsn/E+Kr/Egk1YaTpUUxref6mD3R1S+qWML8 -uqTa3y1CWd4u+aJZH2oZU3gmEd8GvuWnmhsw8iTyq1bzYIga1rQZqh4W5Ok9V+jR -GioT/x3mTIhtuEZ1Cmhne5qM3gWYgM3rC3D4+RnUFeThOC5lHtOYHtIEpg66cs7g -QYAn75ghEkyfG7ZvdxAU9Ngn6hckux9tFu3GmeEtdqhVOHaOMaYi60uGSk6uBnTv -P1sUqi70kMrIBWU7TgldKlTqVdReM87Nkb2O5v1xqtoswLWIi65hFWTqt/H65c1H -aEBG1cBqnqBMYuFk8b4TzZbuU9o1UKj0/6N5mpm//BmW65B0htEDP7IYpGF0mt0H -LkU+4ISmuLfPfQeviYio6/yASaFkHpxfK7N8CQvmyAG9U8FHRio2QCGSb2EO+BnT -Bti6L9oMiQbAsCLWTbvBhCVxdncFw1ncq8gkPMXjEEVUsqAo5Kg+903pRHUyHLzS -R6R3C6tTJnNtucJ0zqQMF3K1FHS1m8GrOm+hskJLTHgZLdz6tFTYkXfZBSCwIl7s -plg0wq9CrNC2B8MczWn/j3/h7qSI3wBNqADHMdoiOHECffCeyGEYjW3+0iMoj1m1 -wY0DIym4DDRzk6wsEesxVi8iiCVpYwWnjJAvWYECEO+hWuwCez+eGVkhCT/5g3xW -hPSRhivNuJT05tdR5o+yqONHn1eAQH7Ar3cj+neY5WC0iS5FK9axTqbHXotofD1e -pJX17ZVWsmIIpRvAWGD+LOcfTMZsaB9DJbkrPSWlMW3lC2S5JOq8OgfMNWIDDUN1 -guwpK5Z/lWV1qMMnaWeDVgPH/G0FssECXlCU5+/Ol654h8tm2bRXYAYHPM+OoW67 +N7yz2JV13EmQ7MZPL5wamid5+G1V1gp8FKqMemAC5JDxonS/W9oViMLUcxbfPTDx +FznKdYSVTIQ7vv3ofmDG4MEyV/2C568N2kdtAw+jTfrZFN+IU9CI+W+In/nacirF +02sAcvDMofustnooKNOO7/iyb5+3vRvEt5vSSRQn5WuSQ9sUKjuzoLs/lbf7fyAt +4NeqfI3rYBZXxiUOLITOGXzGNRuFoY+o2uDCfelLAJ8uhiVG6ME3LeJEo1dT5lZ8 +CSJOLPasKg0iG4V7olM4j9FvAfZr48RRsSfUen756Jo2HpI4bad8LKhFYIdNs2Au +WwKLmjpo6QB9hBmRshR04rEXPdrgTqLBExCE08PyaGYnWU8ggWritCeBzDQFj/n4 +sI+NO0Mymuvg98e5RpO52lg3Xnqv9RIK3guLFOmI6aEHC0PS4WwOEQ== -----END RSA PRIVATE KEY----- diff --git a/extra/yassl/certs/dsa1024.der b/extra/yassl/certs/dsa1024.der new file mode 100644 index 00000000000..db880d51480 Binary files /dev/null and b/extra/yassl/certs/dsa1024.der differ diff --git a/extra/yassl/certs/dsa1024.pem b/extra/yassl/certs/dsa1024.pem new file mode 100644 index 00000000000..5478ebfc2b2 --- /dev/null +++ b/extra/yassl/certs/dsa1024.pem @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBvAIBAAKBgQC9Ue5KMuCKx+rG4epwxFFDzyoH4ccSwlglXsRdvqswDRK/oQvT +NNNoWiVxTn3kvQ8qDlhWy9KjGTrqr/ttgmh56FFpe6tz4yTgCNyR9D+eGclD7lNf +dPUc4E3SA6efopG6+ymI55bS+9xUFTG402UCrYSKT59zI2HBfuI6dltsxQIVAJHJ +7WDQ+jBn/nmMyCQzdi+0qJx1AoGBAJJacRK36s5yGY1b6qhxWqvpoAC+SfEKylZn +YWGYf2PM+Iwo6AgPKEw6BSsX+7Nmc4Gjyr4JWhComKi6onPamO/A2CbMM0DCxb47 +BeLBWfqWAgXVj0CODT4MQos5yugnviR/YpEgbzLxvrXr469lKWsAyB19/gFmGmQW +cCgAwGm6AoGBAJ3LY89yHyvQ/TsQ6zlYbovjbk/ogndsMqPdNUvL4RuPTgJP/caa +DDa0XJ7ak6A7TJ+QheLNwOXoZPYJC4EGFSDAXpYniGhbWIrVTCGe6lmZDfnx40WX +S0kk3m/DHaC03ElLAiybxVGxyqoUfbT3Zv1JwftWMuiqHH5uADhdXuXVAhQ01VXa +Rr8IPem35lKghVKnq/kGQw== +-----END DSA PRIVATE KEY----- diff --git a/extra/yassl/certs/dsa512.der b/extra/yassl/certs/dsa512.der deleted file mode 100644 index 027bedeffb1..00000000000 Binary files a/extra/yassl/certs/dsa512.der and /dev/null differ diff --git a/extra/yassl/certs/dsa512.pem b/extra/yassl/certs/dsa512.pem deleted file mode 100644 index 04a3dd94a77..00000000000 --- a/extra/yassl/certs/dsa512.pem +++ /dev/null @@ -1,8 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIH3AgEAAkEAmSlpgMk8mGhFqYL+Z+uViMW0DNYmRZUZLKAgW37faencww/zYQol -m/IhAWrNqow358pm21b0D3160Ri5Qv0bEQIVAK0lKasKnwkcwa0DIHZ/prfdTQMJ -AkASiJna59ALk5vm7jwhf5yztI2ljOI3gD8X0YFPvfBxtjIIVN2/AeKzdwZkdYoE -1nk5sQIDA8YGdOWQBQoQRhkxAkAEhKAmMXIM6E9dUxdisYDKwBZfwx7qxdmYOPm+ -VlNHaM4IIlccuw13kc9bNu3zJIKQis2QfNt3+Rctc3Pvu7mCAhQjg+e+aqykxwwc -E2V27tjDFY02uA== ------END DSA PRIVATE KEY----- diff --git a/extra/yassl/certs/server-cert.pem b/extra/yassl/certs/server-cert.pem index cfe4b7b8228..f56cba9de70 100644 --- a/extra/yassl/certs/server-cert.pem +++ b/extra/yassl/certs/server-cert.pem @@ -1,17 +1,17 @@ Certificate: Data: - Version: 1 (0x0) - Serial Number: 2 (0x2) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Oct 24 18:27:13 2011 GMT - Not After : Jul 20 18:27:13 2014 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=yaSSL, OU=Support, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 17:20:14 2014 GMT + Not After : Apr 6 17:20:14 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=wolfSSL, OU=Support, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): + Public-Key: (2048 bit) + Modulus: 00:c0:95:08:e1:57:41:f2:71:6d:b7:d2:45:41:27: 01:65:c6:45:ae:f2:bc:24:30:b8:95:ce:2f:4e:d6: f6:1c:88:bc:7c:9f:fb:a8:67:7f:fe:5c:9c:51:75: @@ -31,59 +31,74 @@ Certificate: a7:aa:eb:c4:e1:e6:61:83:c5:d2:96:df:d9:d0:4f: ad:d7 Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + B3:11:32:C9:92:98:84:E2:C9:F8:D0:3B:6E:03:42:CA:1F:0E:8E:3C + X509v3 Authority Key Identifier: + keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C + + X509v3 Basic Constraints: + CA:TRUE Signature Algorithm: sha1WithRSAEncryption - 71:4e:d3:62:df:cc:4c:f7:cd:b7:6e:52:0b:6c:6e:e0:bd:c2: - 2d:07:d7:c0:b0:6e:43:1e:35:bc:30:01:50:f0:ff:99:23:6c: - 18:1a:41:b6:11:d6:d4:19:61:fd:e4:77:97:1c:39:e1:57:ab: - c5:15:63:77:11:36:5e:74:e2:24:0b:1f:41:78:ad:b7:81:e7: - b4:40:66:80:f0:4b:91:a0:6d:a8:6e:3d:53:d9:8b:ce:2a:e1: - 0b:45:65:87:a1:96:ae:ee:3e:88:d5:12:1f:78:17:ae:2c:c5: - 73:44:d8:dc:f4:af:d8:cc:ae:4c:e1:0c:be:55:a4:99:f7:6e: - 96:c0:c8:45:87:bf:dc:51:57:ff:9e:73:37:6a:18:9c:c3:f9: - 22:7a:f4:b0:52:bd:fc:21:30:f8:c5:ff:1e:87:7d:ad:a2:5a: - 35:f5:22:a8:b4:0a:76:38:e6:76:b0:98:af:1b:ec:8a:0a:43: - 74:d2:85:34:37:84:07:e1:f6:23:b2:29:de:a6:b6:b7:4c:57: - 7e:96:06:cb:a9:16:25:29:3a:03:2d:55:7d:a6:8c:a4:f7:9e: - 81:c9:95:b6:7c:c1:4a:ce:94:66:0c:ca:88:eb:d2:09:f5:5b: - 19:58:82:df:27:fd:67:95:78:b7:02:06:d5:a7:61:bd:ef:3a: - fc:b2:61:cd + 3d:8c:70:05:5b:62:4b:bf:6c:b6:48:61:01:10:1d:5e:05:ba: + 55:94:2c:ae:59:6f:97:80:5d:6c:86:ec:9a:eb:15:45:44:e4: + 56:f8:75:ca:8a:45:32:f4:c7:e1:fa:f2:98:1c:91:d3:3f:e8: + 0e:c9:1b:fa:e1:79:99:67:0e:0d:6b:8a:ec:1a:2c:59:c4:34: + 04:8d:39:77:cd:b5:e9:60:5b:82:bf:34:ce:ed:c6:4f:3f:b4: + 5c:4d:8a:b4:f4:0a:04:12:a0:56:c1:e1:33:37:a1:54:87:48: + e9:81:c2:0f:8f:6f:d3:52:4c:4c:32:4c:6b:9f:3a:04:8f:77: + 5d:ad:dc:3d:2b:f2:c9:df:3c:60:5d:d8:fc:86:72:7c:3d:d0: + 84:4b:8c:df:26:43:fe:c0:cc:5b:e1:36:b3:3d:32:28:a3:ef: + 0c:20:d6:b1:50:39:d6:67:a9:8b:84:bc:92:34:eb:19:23:e8: + 10:8f:ea:bd:18:8c:93:27:3c:74:75:8e:58:04:fa:2a:74:44: + 7d:fc:4d:39:df:54:17:ba:78:e1:5d:6a:70:d3:7c:a2:80:81: + e6:19:51:91:c3:44:51:ec:bb:88:a9:53:e1:d7:a9:8c:28:f4: + 21:1c:42:51:09:b4:12:6d:a0:d6:25:09:85:c6:2a:0c:af:a7: + 58:e6:52:8b -----BEGIN CERTIFICATE----- -MIIDkDCCAngCAQIwDQYJKoZIhvcNAQEFBQAwgZAxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290 -aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd -MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wHhcNMTExMDI0MTgyNzEzWhcN -MTQwNzIwMTgyNzEzWjCBijELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmEx -EDAOBgNVBAcTB0JvemVtYW4xDjAMBgNVBAoTBXlhU1NMMRAwDgYDVQQLEwdTdXBw -b3J0MRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZv -QHlhc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMCVCOFX -QfJxbbfSRUEnAWXGRa7yvCQwuJXOL07W9hyIvHyf+6hnf/5cnFF194rKB+c1L4/h -vXvAL3yrZKgX/Mpde7rgIeVyLm8uhtiVc9qsG1O5Xz/XGQ0lT+FjY1GLC2Q/rUO4 -pRxcNLOuAKBjxfZ/C1loeHOmjBipAm2vwxkBLrgQ48bMQLRpo0YzaYduxLsXpvPo -3a1zvHsvIbX9ZlEMvVSz4W1fHLwjc9EJA4kU0hC5ZMMq0KGWSrzh1Bpbx6DAwWN4 -D0Q3MDKWgDIjlaF3uhPSl3PiXSXJag3DOWCktLBpQkIJ6dgIvDMgs1gip6rrxOHm -YYPF0pbf2dBPrdcCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAcU7TYt/MTPfNt25S -C2xu4L3CLQfXwLBuQx41vDABUPD/mSNsGBpBthHW1Blh/eR3lxw54VerxRVjdxE2 -XnTiJAsfQXitt4HntEBmgPBLkaBtqG49U9mLzirhC0Vlh6GWru4+iNUSH3gXrizF -c0TY3PSv2MyuTOEMvlWkmfdulsDIRYe/3FFX/55zN2oYnMP5Inr0sFK9/CEw+MX/ -Hod9raJaNfUiqLQKdjjmdrCYrxvsigpDdNKFNDeEB+H2I7Ip3qa2t0xXfpYGy6kW -JSk6Ay1VfaaMpPeegcmVtnzBSs6UZgzKiOvSCfVbGViC3yf9Z5V4twIG1adhve86 -/LJhzQ== +MIIEnjCCA4agAwIBAgIBATANBgkqhkiG9w0BAQUFADCBlDELMAkGA1UEBhMCVVMx +EDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xETAPBgNVBAoMCFNh +d3Rvb3RoMRMwEQYDVQQLDApDb25zdWx0aW5nMRgwFgYDVQQDDA93d3cud29sZnNz +bC5jb20xHzAdBgkqhkiG9w0BCQEWEGluZm9Ad29sZnNzbC5jb20wHhcNMTQwNzEx +MTcyMDE0WhcNMTcwNDA2MTcyMDE0WjCBkDELMAkGA1UEBhMCVVMxEDAOBgNVBAgM +B01vbnRhbmExEDAOBgNVBAcMB0JvemVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxEDAO +BgNVBAsMB1N1cHBvcnQxGDAWBgNVBAMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG +SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAMCVCOFXQfJxbbfSRUEnAWXGRa7yvCQwuJXOL07W9hyIvHyf+6hn +f/5cnFF194rKB+c1L4/hvXvAL3yrZKgX/Mpde7rgIeVyLm8uhtiVc9qsG1O5Xz/X +GQ0lT+FjY1GLC2Q/rUO4pRxcNLOuAKBjxfZ/C1loeHOmjBipAm2vwxkBLrgQ48bM +QLRpo0YzaYduxLsXpvPo3a1zvHsvIbX9ZlEMvVSz4W1fHLwjc9EJA4kU0hC5ZMMq +0KGWSrzh1Bpbx6DAwWN4D0Q3MDKWgDIjlaF3uhPSl3PiXSXJag3DOWCktLBpQkIJ +6dgIvDMgs1gip6rrxOHmYYPF0pbf2dBPrdcCAwEAAaOB/DCB+TAdBgNVHQ4EFgQU +sxEyyZKYhOLJ+NA7bgNCyh8OjjwwgckGA1UdIwSBwTCBvoAUJ45nEXTDJh0/7TNj +s6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYDVQQIDAdNb250YW5h +MRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290aDETMBEGA1UECwwK +Q29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29tMR8wHQYJKoZIhvcN +AQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYDVR0TBAUwAwEB/zAN +BgkqhkiG9w0BAQUFAAOCAQEAPYxwBVtiS79stkhhARAdXgW6VZQsrllvl4BdbIbs +musVRUTkVvh1yopFMvTH4frymByR0z/oDskb+uF5mWcODWuK7BosWcQ0BI05d821 +6WBbgr80zu3GTz+0XE2KtPQKBBKgVsHhMzehVIdI6YHCD49v01JMTDJMa586BI93 +Xa3cPSvyyd88YF3Y/IZyfD3QhEuM3yZD/sDMW+E2sz0yKKPvDCDWsVA51mepi4S8 +kjTrGSPoEI/qvRiMkyc8dHWOWAT6KnREffxNOd9UF7p44V1qcNN8ooCB5hlRkcNE +Uey7iKlT4depjCj0IRxCUQm0Em2g1iUJhcYqDK+nWOZSiw== -----END CERTIFICATE----- Certificate: Data: Version: 3 (0x2) Serial Number: - e9:d0:a7:5f:79:25:f4:3c - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com + 9a:41:47:cd:a1:14:62:8c + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Validity - Not Before: Oct 24 18:18:15 2011 GMT - Not After : Jul 20 18:18:15 2014 GMT - Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.yassl.com/emailAddress=info@yassl.com + Not Before: Jul 11 03:20:08 2014 GMT + Not After : Apr 6 03:20:08 2017 GMT + Subject: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com Subject Public Key Info: Public Key Algorithm: rsaEncryption - RSA Public Key: (2048 bit) - Modulus (2048 bit): + Public-Key: (2048 bit) + Modulus: 00:bf:0c:ca:2d:14:b2:1e:84:42:5b:cd:38:1f:4a: f2:4d:75:10:f1:b6:35:9f:df:ca:7d:03:98:d3:ac: de:03:66:ee:2a:f1:d8:b0:7d:6e:07:54:0b:10:98: @@ -104,54 +119,55 @@ Certificate: 36:79 Exponent: 65537 (0x10001) X509v3 extensions: - X509v3 Subject Key Identifier: + X509v3 Subject Key Identifier: 27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - X509v3 Authority Key Identifier: + X509v3 Authority Key Identifier: keyid:27:8E:67:11:74:C3:26:1D:3F:ED:33:63:B3:A4:D8:1D:30:E5:E8:D5 - DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.yassl.com/emailAddress=info@yassl.com - serial:E9:D0:A7:5F:79:25:F4:3C + DirName:/C=US/ST=Montana/L=Bozeman/O=Sawtooth/OU=Consulting/CN=www.wolfssl.com/emailAddress=info@wolfssl.com + serial:9A:41:47:CD:A1:14:62:8C - X509v3 Basic Constraints: + X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption - 5f:86:14:f4:51:8b:bc:a5:4e:30:da:5e:ac:9a:f8:6c:d9:26: - 4b:93:f9:e3:1c:89:6f:9e:ee:b3:9d:77:3e:89:20:76:a3:e6: - e8:86:15:21:db:e2:33:b2:34:d5:d0:9f:f3:c1:a4:87:92:5c: - f9:d1:ff:30:2f:8e:03:bc:b3:3c:0c:32:a3:90:5f:1a:90:1e: - af:9d:f3:9e:d7:07:02:a9:7d:27:66:63:2f:af:18:d7:ac:18: - 98:8c:83:8f:38:f3:0b:ac:36:10:75:fb:ca:76:13:50:5b:02: - 8f:73:bf:e3:a0:ee:83:52:25:54:ce:26:ce:9c:bd:2f:79:ab: - 1b:60:b8:92:f1:03:c0:fc:3b:08:d9:c0:ad:d5:72:08:25:80: - 61:2d:dc:9f:a7:83:62:07:47:e0:07:4c:4b:07:30:04:a9:87: - 1c:55:7f:07:12:d0:cb:42:5d:cb:cf:66:01:1a:17:ee:f9:0f: - 60:b7:db:6f:68:e5:4e:41:62:6e:d3:6f:60:4f:4b:27:de:cf: - 18:07:f1:13:5d:cb:3f:a9:25:44:da:52:5c:c8:04:e1:56:12: - f5:2a:90:4e:d1:e2:af:01:b5:23:a1:ec:31:da:7b:63:69:c4: - b8:f3:e7:ce:a1:3d:c0:db:6d:f3:b2:d9:46:c8:9f:c3:b8:70: - 5a:1f:7f:ca + 79:78:0c:6d:79:88:91:fc:3a:15:9c:f9:27:62:16:f0:21:1f: + fa:7d:3f:a2:a8:32:1e:f7:f2:11:a9:74:16:74:5e:dc:18:ca: + f0:00:2a:d5:03:06:26:30:f1:47:83:fd:32:6e:fc:ed:aa:4f: + 7d:0c:63:60:31:2f:7c:0c:bf:99:66:87:ed:27:08:86:2d:c4: + 33:e8:98:23:1c:fe:a3:db:9a:49:4e:fc:5a:42:ef:71:c3:3f: + ad:dc:4a:a8:d2:a3:1d:09:ac:33:04:7b:86:f3:6d:00:59:a3: + c8:db:d1:3c:73:f6:0e:90:d6:5e:49:e0:bf:36:63:08:7b:a5: + b0:8f:35:3b:56:8c:11:35:49:04:1c:d0:e7:ba:56:c5:0d:0a: + 91:8d:d6:b7:62:19:34:12:52:4c:d2:6d:7c:c5:3d:0f:18:81: + 54:cb:f6:3c:e5:84:d2:d6:71:15:ec:1a:34:0b:f0:a0:21:74: + 43:c8:a3:b0:df:d9:67:da:e2:ad:93:48:f8:a0:87:bd:79:14: + e0:62:0a:df:f7:31:2e:31:7b:d1:32:2a:0a:fe:5d:14:ef:d9: + 64:50:e4:83:91:bc:70:0d:d7:88:8d:d9:bc:84:0e:c5:1a:b3: + bf:64:02:4e:51:91:a4:a2:85:15:83:af:f0:5b:9b:28:49:5f: + b2:b3:03:d8 -----BEGIN CERTIFICATE----- -MIIEnjCCA4agAwIBAgIJAOnQp195JfQ8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYD -VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G -A1UEChMIU2F3dG9vdGgxEzARBgNVBAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3 -dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTEx -MTAyNDE4MTgxNVoXDTE0MDcyMDE4MTgxNVowgZAxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhTYXd0b290 -aDETMBEGA1UECxMKQ29uc3VsdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNvbTEd -MBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQC/DMotFLIehEJbzTgfSvJNdRDxtjWf38p9A5jTrN4DZu4q -8diwfW4HVAsQmCFNgMsSIOfMT95FfclydzLqypC7aVIQAy+o85XF8YtiVhvvZ2+k -EEGVrQqb46XAsNJwdlAwW6joCCx87aeieo04KRysx+3yfJWwlYJ9SVw4zXcl772A -dVOUPD3KY1ufFbXTHRMvGdE823Y6zLh9yeXC19pAb9gh3HMbQi1TnP4a/H2rejY/ -mN6EfAVnzmoUOIep8Yy1aMtof3EgK/WgY/VWL6Mm0rdvsVoX1ziZCP6TWG/+wxNJ -CBYLp01nAFIxZyNOmO1RRR25BNkL7Ngos0u97TZ5AgMBAAGjgfgwgfUwHQYDVR0O -BBYEFCeOZxF0wyYdP+0zY7Ok2B0w5ejVMIHFBgNVHSMEgb0wgbqAFCeOZxF0wyYd -P+0zY7Ok2B0w5ejVoYGWpIGTMIGQMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHTW9u -dGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8GA1UEChMIU2F3dG9vdGgxEzARBgNV -BAsTCkNvbnN1bHRpbmcxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG -9w0BCQEWDmluZm9AeWFzc2wuY29tggkA6dCnX3kl9DwwDAYDVR0TBAUwAwEB/zAN -BgkqhkiG9w0BAQUFAAOCAQEAX4YU9FGLvKVOMNperJr4bNkmS5P54xyJb57us513 -PokgdqPm6IYVIdviM7I01dCf88Gkh5Jc+dH/MC+OA7yzPAwyo5BfGpAer53zntcH -Aql9J2ZjL68Y16wYmIyDjzjzC6w2EHX7ynYTUFsCj3O/46Dug1IlVM4mzpy9L3mr -G2C4kvEDwPw7CNnArdVyCCWAYS3cn6eDYgdH4AdMSwcwBKmHHFV/BxLQy0Jdy89m -ARoX7vkPYLfbb2jlTkFibtNvYE9LJ97PGAfxE13LP6klRNpSXMgE4VYS9SqQTtHi -rwG1I6HsMdp7Y2nEuPPnzqE9wNtt87LZRsifw7hwWh9/yg== +MIIEqjCCA5KgAwIBAgIJAJpBR82hFGKMMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD +VQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8G +A1UECgwIU2F3dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3 +dy53b2xmc3NsLmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTAe +Fw0xNDA3MTEwMzIwMDhaFw0xNzA0MDYwMzIwMDhaMIGUMQswCQYDVQQGEwJVUzEQ +MA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjERMA8GA1UECgwIU2F3 +dG9vdGgxEzARBgNVBAsMCkNvbnN1bHRpbmcxGDAWBgNVBAMMD3d3dy53b2xmc3Ns +LmNvbTEfMB0GCSqGSIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAL8Myi0Ush6EQlvNOB9K8k11EPG2NZ/fyn0D +mNOs3gNm7irx2LB9bgdUCxCYIU2AyxIg58xP3kV9yXJ3MurKkLtpUhADL6jzlcXx +i2JWG+9nb6QQQZWtCpvjpcCw0nB2UDBbqOgILHztp6J6jTgpHKzH7fJ8lbCVgn1J +XDjNdyXvvYB1U5Q8PcpjW58VtdMdEy8Z0TzbdjrMuH3J5cLX2kBv2CHccxtCLVOc +/hr8fat6Nj+Y3oR8BWfOahQ4h6nxjLVoy2h/cSAr9aBj9VYvoybSt2+xWhfXOJkI +/pNYb/7DE0kIFgunTWcAUjFnI06Y7VFFHbkE2Qvs2CizS73tNnkCAwEAAaOB/DCB ++TAdBgNVHQ4EFgQUJ45nEXTDJh0/7TNjs6TYHTDl6NUwgckGA1UdIwSBwTCBvoAU +J45nEXTDJh0/7TNjs6TYHTDl6NWhgZqkgZcwgZQxCzAJBgNVBAYTAlVTMRAwDgYD +VQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQKDAhTYXd0b290 +aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3LndvbGZzc2wuY29t +MR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tggkAmkFHzaEUYowwDAYD +VR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAeXgMbXmIkfw6FZz5J2IW8CEf ++n0/oqgyHvfyEal0FnRe3BjK8AAq1QMGJjDxR4P9Mm787apPfQxjYDEvfAy/mWaH +7ScIhi3EM+iYIxz+o9uaSU78WkLvccM/rdxKqNKjHQmsMwR7hvNtAFmjyNvRPHP2 +DpDWXkngvzZjCHulsI81O1aMETVJBBzQ57pWxQ0KkY3Wt2IZNBJSTNJtfMU9DxiB +VMv2POWE0tZxFewaNAvwoCF0Q8ijsN/ZZ9rirZNI+KCHvXkU4GIK3/cxLjF70TIq +Cv5dFO/ZZFDkg5G8cA3XiI3ZvIQOxRqzv2QCTlGRpKKFFYOv8FubKElfsrMD2A== +-----END CERTIFICATE----- diff --git a/extra/yassl/certs/server-keyEnc.pem b/extra/yassl/certs/server-keyEnc.pem index 278a0946c68..e5ab57d4c9e 100644 --- a/extra/yassl/certs/server-keyEnc.pem +++ b/extra/yassl/certs/server-keyEnc.pem @@ -1,30 +1,30 @@ -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,08132C1FFF5BC8CC +DEK-Info: DES-CBC,136C7D8A69656668 -W+krChiFlNU+koE0Bep+U45OG4V4IFZv67ex6yJHgcsPd+HQ692A/h+5dYc8rdlW -2LDgSODHHIMTt6RVJDxXxXs3qFmJQbnVXeXxV209X8EfaRarh+yiMKeUP6K8hIvj -+IYRma6iKOs+d4KlcZZudGs2f/x8nhxXbmQtrLhGd4h91mnJk2sKmiz7UkUy6Qng -gOHnT2dfF4Qk2ZYsjisRHjpWZiqh40GO1LuTgUjZoH+LGhMwMwOAE6+ss5xa+yE+ -Xd9Yljm0/QW68JILkCJQjLDRvPGxDJyvYq6TT/kSElsRlI/AuRrZH1YVD3hn/xjx -tDoEB+JEbH6iu9ne2srxnGSKLzoUbb4XPaCjLIW9BJf7oANmmFQpZZQiRTyIUVWi -IE5hJciqF7ra7IwfZAW/PeWGXpzNOVN9QAvyAMsmvUCzJdxd1ySUatjhZ+mSFYGk -rDVtyrgt4ZQgV0EdJV0Yn1ZWMOk1qEKXT0JAnI+9S6Y+QEdwXmdz3xlVuq61Jvub -iJUVepnD/1QeFfWy8JwlscWpWFrkr569f3SNG+FGb6fufnUP7K6sX3urj+pj1QET -f9NmmvLBsVsbj1Egg3wnxbVHIUPky64LY04wtNJaAwhuG6mKCvaClKYMTmTCyrzP -aRwghhMQ3yHUbo2A1ZppYsXXg8lX30eW+5O77N9Q3xfP0phODHXsnXhBH09ml1JQ -MmiCaL5n6sIVcjtFmN/kyaEuz/1VrBSaDCPeW88n61UXUidXrGOZN/2c/2xFir8B -2rdE82lQLl07SJxzQQ6aJVvrc5tnbV/ENDySS5dG6Yl/w89/nuu0RFHmAweKqfGC -8m0XOkmonIk6h3YT7XrkE0b/2jkf1mMaMKrGGfRmxqNt1nGxMCJHAO/Sn9v+I9rU -W7HCZ04RTnRp1BXcqDxdwlveDKJRVfiKOSSEOpEXXlexS5R1vikmxrCwK5YVUTkT -3tgahVtHJkFHnBHBzXyHUDwWahxZaU9TO43z0JFxs0zINWUWppldf0oyWjP1FSrI -a9tXBs7aoykUY9Av9K0p4UJJU005qzD/tuegZFX34wRETJO0BJnlZHTTZSqLSVX+ -KZg4nPq8Xii1VHta3tgw7up2z1tpepsBerTsRQ1+IDpxLaIxgt9am0hXVTiMLex/ -DD9UvQC/eBUmpmWraK/Mqeq/UrPl+lmeoXsG6LWIvEp9d19rJ/3OhIJf2pDh9dC8 -NzJoNP9qOrDajAwzeeF5dbQxCaG+X8am9s4wryC0p+NrQ0tzv8efey0zBodDIOgo -F1G7+ADgHy+V565q8sdL52xx0xB9Ty5p9IOfOUbxa3K65TJf/I/QAQjl4LyTbkfr -kzpYAG2uF55EB3Eq3aMrj47pzZy0ELXXN2qYJ9Oelgl+h6MzYbmd+Wm+A2Cofv3u -7ANAyjAYN7/Lo3lTFAt7sXAXGKnqw62JNSSMkIqZVrG5dn7Jxj5AJCVyYxTrm6Y+ -DDcblX47XrWxVoVJN/dLJZ8FzWs4o/8w9Yn8U54Ci7F0g+j2f+OpDy9PGFYT9pKw -xWG8chkYE6QPilEYvdi26ZnZ3u236q9PMtyRP87NmBN2sLkj/rbBTzBxWIaGS+Mt +jvNTyPaztxPIoAzbdmZnD0Zw2+60tMxNc0GMHNmeOyG25aHP/dT+TWiKFpFVkkkY +uoCIhYUyw7gmpw+CnRJwWd+ans4nrvAjwy5oWJvarvsyUpjqvnPoIlAqd+d4TDKN +eESzcI76+gHdisAtCrQD+fGqgTZhli5TgDbnpasL/QnY2qDlutvakkVw7gPXe156 +2Phy8WN+efr65J6wt3K/dj7Datl9u4JeHQK81gYyWBVX+EagEjPGDzkFQCj9Z0q7 +8K3iB5GW1JAqJS0IfZPB40AnSTF/n1TL1SN3qfU3l7hTGNrx9o7580bgDEoAR7pI +F8eZlS15KHtZmh11AnU1KTKZ6kmgnNqeMTGMN6N0ct2wMKW1dV87eTDlF0oiR2ol +XwtFgKmrIjfpmzkdWjbJmWnGMjD56KdiFZga/ZyKMsPrVoYLgfJEpn36iQspfygx +HCGNTf0PjIsjEWU0WyQiF86t+c45W3wNFsv/AxVyfMl+su02yrd6u2ecuQDir3Cs +b2k8IKtQgVe/NIpEWLKuiHG5oedIPPQyDYK5uq+gHxCGeOoKnWlsWFEHZRiza4X5 +tbgTrJB8Sw0ENWrvVGGmQZN4pSImlsMwzQ2qik5CQ00N1b3+56/obn0z75I3bUSb +tC5g8DRjl6oclAenNgh/MYMT287y5W2dD4npxHcekX4O3J2CDXNfg4vV2j5GRxtg +LVJdYE2p7bpYePCDHrYng8b9ubBprx0CrEnkIvvtUjzNPf6VDL0+MBKl+XgR2/nz +iRqTuZnlGGOyM+KYDwXpgwfs/HfvFGksxTAlO/40GkGh+WGPaIoNyCK0SgQKhyb4 +JIkR0vd2/yLg3lWMJrGwh7A0Gm07Z/781oURP3uWd+PaCOgGcd5ipcAjcEyuxNly +AthipWqmQWUcbf6Z2N9j3OA22Hv2Uzk8HSfi9VOZtL9svdEEZ0NnOekJgnc6stQp +bXiknlK/T5WdrWxSyCfgUq68Vf6DFfIRAVuFdJ3WHT2wVXHrDfft6D+Ne/XCxPoE +8zGmkyusaph33UHQ1oNyUbLbwcDCDSmOo8gYoedD3IwxtMA3wJRugomqosItwV8X +vkgmcy8eSE/+gZUxJEN2gnLcfKFhCkC80J6oFhmoDD6vuUnPHcFdKZgVPw2rzPk5 +Vb1kX+gpORplYmKpq1vz/ujscL4T0TmYLz02hkIS4edpW55ncTTv7JWefpRiTB1J +RB3td3me4htqR+YIDWJ+emrOmqsCG2WvpAS+MTw2mj1jYk9LL/ZYobTjSCEWmuwT +yVK6m303irR7HQDauxhslRFgoK21w63viOyj5NKIU1gQtaAANGDxcgORC1XLjjgt +oNutSQA+7P42vfHSHK4cnTBXl6V32H/GyVpdHQOZqSrqIjgLmUZodSmRPROxosZF +a46B1O7m/rJFxkiKW4vod+/WqjoE0Hhfrb8rRrkRjzGeCqqSSnQ3vrunVkvF8hlA +b6FOv4ZBJL4piC1GKH+rscqke9NEiDqXN8C3iYz86jbck/Ha21yUS8T3X7N52sg+ +B3AmOGnLK6BebYeto9vZxQjacChJZSixSxLV+l9/nVQ0+mW42azHdzk0ru59TGAj -----END RSA PRIVATE KEY----- diff --git a/extra/yassl/include/buffer.hpp b/extra/yassl/include/buffer.hpp index 27f71199093..77d2ed8193c 100644 --- a/extra/yassl/include/buffer.hpp +++ b/extra/yassl/include/buffer.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -48,7 +48,11 @@ const uint AUTO = 0xFEEDBEEF; struct NoCheck { - void check(uint, uint); + int check(uint, uint); +}; + +struct Check { + int check(uint, uint); }; /* input_buffer operates like a smart c style array with a checking option, @@ -60,11 +64,13 @@ struct NoCheck { * write to the buffer bulk wise and have the correct size */ -class input_buffer : public NoCheck { +class input_buffer : public Check { uint size_; // number of elements in buffer uint current_; // current offset position in buffer byte* buffer_; // storage for buffer byte* end_; // end of storage marker + int error_; // error number + byte zero_; // for returning const reference to zero byte public: input_buffer(); @@ -93,6 +99,10 @@ public: uint get_remaining() const; + int get_error() const; + + void set_error(); + void set_current(uint i); // read only access through [], advance current @@ -103,7 +113,7 @@ public: bool eof(); // peek ahead - byte peek() const; + byte peek(); // write function, should use at/near construction void assign(const byte* t, uint s); diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 3c840027879..835a46eaea8 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -34,7 +34,7 @@ #include "rsa.h" -#define YASSL_VERSION "2.3.0" +#define YASSL_VERSION "2.3.4" #if defined(__cplusplus) diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index ec35f1760e7..ee5e0cc0793 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -35,8 +35,19 @@ namespace yaSSL { -void NoCheck::check(uint, uint) +/* return 0 on check success, always true for NoCheck policy */ +int NoCheck::check(uint, uint) { + return 0; +} + +/* return 0 on check success */ +int Check::check(uint i, uint max) +{ + if (i < max) + return 0; + + return -1; } @@ -51,18 +62,20 @@ void NoCheck::check(uint, uint) input_buffer::input_buffer() - : size_(0), current_(0), buffer_(0), end_(0) + : size_(0), current_(0), buffer_(0), end_(0), error_(0), zero_(0) {} input_buffer::input_buffer(uint s) - : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s), + error_(0), zero_(0) {} // with assign input_buffer::input_buffer(uint s, const byte* t, uint len) - : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s) + : size_(0), current_(0), buffer_(NEW_YS byte[s]), end_(buffer_ + s), + error_(0), zero_(0) { assign(t, len); } @@ -77,8 +90,10 @@ input_buffer::~input_buffer() // users can pass defualt zero length buffer and then allocate void input_buffer::allocate(uint s) { - buffer_ = NEW_YS byte[s]; - end_ = buffer_ + s; + if (error_ == 0) { + buffer_ = NEW_YS byte[s]; + end_ = buffer_ + s; + } } @@ -93,40 +108,67 @@ byte* input_buffer::get_buffer() const // if you know the size before the write use assign() void input_buffer::add_size(uint i) { - check(size_ + i-1, get_capacity()); - size_ += i; + if (error_ == 0 && check(size_ + i-1, get_capacity()) == 0) + size_ += i; + else + error_ = -1; } uint input_buffer::get_capacity() const { - return (uint) (end_ - buffer_); + if (error_ == 0) + return end_ - buffer_; + + return 0; } uint input_buffer::get_current() const { - return current_; + if (error_ == 0) + return current_; + + return 0; } uint input_buffer::get_size() const { - return size_; + if (error_ == 0) + return size_; + + return 0; } uint input_buffer::get_remaining() const { - return size_ - current_; + if (error_ == 0) + return size_ - current_; + + return 0; +} + + +int input_buffer::get_error() const +{ + return error_; +} + + +void input_buffer::set_error() +{ + error_ = -1; } void input_buffer::set_current(uint i) { - if (i) - check(i - 1, size_); - current_ = i; + if (error_ == 0 && (i == 0 || check(i - 1, size_) == 0)) + current_ = i; + else + error_ = -1; } @@ -134,40 +176,59 @@ void input_buffer::set_current(uint i) // user passes in AUTO index for ease of use const byte& input_buffer::operator[](uint i) { - check(current_, size_); - return buffer_[current_++]; + if (error_ == 0 && check(current_, size_) == 0) + return buffer_[current_++]; + + error_ = -1; + return zero_; } // end of input test bool input_buffer::eof() { + if (error_ != 0) + return true; + return current_ >= size_; } // peek ahead -byte input_buffer::peek() const +byte input_buffer::peek() { - return buffer_[current_]; + if (error_ == 0 && check(current_, size_) == 0) + return buffer_[current_]; + + error_ = -1; + return 0; } // write function, should use at/near construction void input_buffer::assign(const byte* t, uint s) { - check(current_, get_capacity()); - add_size(s); - memcpy(&buffer_[current_], t, s); + if (t && error_ == 0 && check(current_, get_capacity()) == 0) { + add_size(s); + if (error_ == 0) { + memcpy(&buffer_[current_], t, s); + return; // success + } + } + + error_ = -1; } // use read to query input, adjusts current void input_buffer::read(byte* dst, uint length) { - check(current_ + length - 1, size_); - memcpy(dst, &buffer_[current_], length); - current_ += length; + if (dst && error_ == 0 && check(current_ + length - 1, size_) == 0) { + memcpy(dst, &buffer_[current_], length); + current_ += length; + } else { + error_ = -1; + } } diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 90c3762a1fc..39bcd9745b4 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -522,7 +522,7 @@ void buildSHA_CertVerify(SSL& ssl, byte* digest) // some clients still send sslv2 client hello void ProcessOldClientHello(input_buffer& input, SSL& ssl) { - if (input.get_remaining() < 2) { + if (input.get_error() || input.get_remaining() < 2) { ssl.SetError(bad_input); return; } @@ -549,20 +549,24 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl) byte len[2]; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; ato16(len, ch.suite_len_); - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; uint16 sessionLen; ato16(len, sessionLen); ch.id_len_ = sessionLen; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; uint16 randomLen; ato16(len, randomLen); - if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN || - randomLen > RAN_LEN) { + if (input.get_error() || ch.suite_len_ > MAX_SUITE_SZ || + ch.suite_len_ > input.get_remaining() || + sessionLen > ID_LEN || randomLen > RAN_LEN) { ssl.SetError(bad_input); return; } @@ -580,13 +584,12 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl) ch.suite_len_ = j; if (ch.id_len_) - input.read(ch.session_id_, ch.id_len_); + input.read(ch.session_id_, ch.id_len_); // id_len_ from sessionLen if (randomLen < RAN_LEN) memset(ch.random_, 0, RAN_LEN - randomLen); input.read(&ch.random_[RAN_LEN - randomLen], randomLen); - ch.Process(input, ssl); } @@ -788,6 +791,9 @@ int DoProcessReply(SSL& ssl) ssl.verifyState(hdr); } + if (ssl.GetError()) + return 0; + // make sure we have enough input in buffer to process this record if (needHdr || hdr.length_ > buffer.get_remaining()) { // put header in front for next time processing @@ -800,6 +806,9 @@ int DoProcessReply(SSL& ssl) while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) { // each message in record, can be more than 1 if not encrypted + if (ssl.GetError()) + return 0; + if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on // sanity check for malicious/corrupted/illegal input if (buffer.get_remaining() < hdr.length_) { diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index 4dcf275e7f2..e2da042457f 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -220,16 +220,26 @@ void DH_Server::build(SSL& ssl) // read PreMaster secret and decrypt, server side void EncryptedPreMasterSecret::read(SSL& ssl, input_buffer& input) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + const CertManager& cert = ssl.getCrypto().get_certManager(); RSA rsa(cert.get_privateKey(), cert.get_privateKeyLength(), false); uint16 cipherLen = rsa.get_cipherLength(); if (ssl.isTLS()) { byte len[2]; - input.read(len, sizeof(len)); + len[0] = input[AUTO]; + len[1] = input[AUTO]; ato16(len, cipherLen); } alloc(cipherLen); input.read(secret_, length_); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } opaque preMasterSecret[SECRET_LEN]; rsa.decrypt(preMasterSecret, secret_, length_, @@ -277,6 +287,11 @@ void EncryptedPreMasterSecret::alloc(int sz) // read client's public key, server side void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input) { + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } + DiffieHellman& dh = ssl.useCrypto().use_dh(); uint16 keyLength; @@ -287,6 +302,10 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input) alloc(keyLength); input.read(Yc_, keyLength); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } dh.makeAgreement(Yc_, keyLength); // because of encoding, first byte might be 0, don't use for preMaster @@ -331,6 +350,10 @@ void ClientDiffieHellmanPublic::alloc(int sz, bool offset) // read server's p, g, public key and sig, client side void DH_Server::read(SSL& ssl, input_buffer& input) { + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } uint16 length, messageTotal = 6; // pSz + gSz + pubSz byte tmp[2]; @@ -341,6 +364,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_p(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // g tmp[0] = input[AUTO]; @@ -349,6 +376,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_g(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // pub tmp[0] = input[AUTO]; @@ -357,12 +388,20 @@ void DH_Server::read(SSL& ssl, input_buffer& input) messageTotal += length; input.read(parms_.alloc_pub(length), length); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // save message for hash verify input_buffer message(messageTotal); input.set_current(input.get_current() - messageTotal); input.read(message.get_buffer(), messageTotal); message.add_size(messageTotal); + if (input.get_error() || input.get_remaining() < (uint)LENGTH_SZ) { + ssl.SetError(bad_input); + return; + } // signature tmp[0] = input[AUTO]; @@ -371,6 +410,10 @@ void DH_Server::read(SSL& ssl, input_buffer& input) signature_ = NEW_YS byte[length]; input.read(signature_, length); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } // verify signature byte hash[FINISHED_SZ]; @@ -645,6 +688,10 @@ void HandShakeHeader::Process(input_buffer& input, SSL& ssl) { ssl.verifyState(*this); if (ssl.GetError()) return; + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } const HandShakeFactory& hsf = ssl.getFactory().getHandShake(); mySTL::auto_ptr hs(hsf.CreateObject(type_)); if (!hs.get()) { @@ -810,8 +857,13 @@ uint16 ChangeCipherSpec::get_length() const // CipherSpec processing handler -void ChangeCipherSpec::Process(input_buffer&, SSL& ssl) +void ChangeCipherSpec::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + ssl.useSecurity().use_parms().pending_ = false; if (ssl.getSecurity().get_resuming()) { if (ssl.getSecurity().get_parms().entity_ == client_end) @@ -873,6 +925,11 @@ output_buffer& operator<<(output_buffer& output, const Alert& a) // Alert processing handler void Alert::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + if (ssl.getSecurity().get_parms().pending_ == false) { // encrypted alert int aSz = get_length(); // alert size already read on input opaque verify[SHA_LEN]; @@ -890,12 +947,19 @@ void Alert::Process(input_buffer& input, SSL& ssl) if (ssl.getSecurity().get_parms().cipher_type_ == block) { int ivExtra = 0; + opaque fill; if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - aSz - digestSz; - input.set_current(input.get_current() + padSz); + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + } + + if (input.get_error()) { + ssl.SetError(bad_input); + return; } // verify @@ -1112,6 +1176,11 @@ static int timing_verify(SSL& ssl, const byte* input, int padLen, int t, // Process handler for Data void Data::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + int msgSz = ssl.getSecurity().get_parms().encrypt_size_; int pad = 0, padSz = 0; int ivExtra = 0; @@ -1154,7 +1223,7 @@ void Data::Process(input_buffer& input, SSL& ssl) int dataSz = msgSz - ivExtra - digestSz - pad - padSz; - if (dataSz < 0) { + if (dataSz < 0 || dataSz > (MAX_RECORD_SIZE + COMPRESS_EXTRA)) { ssl.SetError(bad_input); return; } @@ -1180,6 +1249,10 @@ void Data::Process(input_buffer& input, SSL& ssl) // advance past mac and fill input.set_current(input.get_current() + digestSz + pad + padSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } } @@ -1244,6 +1317,11 @@ output_buffer& operator<<(output_buffer& output, const Certificate& cert) // certificate processing handler void Certificate::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + CertManager& cm = ssl.useCrypto().use_certManager(); uint32 list_sz; @@ -1412,6 +1490,10 @@ input_buffer& operator>>(input_buffer& input, ServerHello& hello) // Session hello.id_len_ = input[AUTO]; + if (hello.id_len_ > ID_LEN) { + input.set_error(); + return input; + } if (hello.id_len_) input.read(hello.session_id_, hello.id_len_); @@ -1452,8 +1534,13 @@ output_buffer& operator<<(output_buffer& output, const ServerHello& hello) // Server Hello processing handler -void ServerHello::Process(input_buffer&, SSL& ssl) +void ServerHello::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + if (ssl.GetMultiProtocol()) { // SSLv23 support if (ssl.isTLS() && server_version_.minor_ < 1) // downgrade to SSLv3 @@ -1547,8 +1634,12 @@ const opaque* ServerHello::get_random() const // Server Hello Done processing handler -void ServerHelloDone::Process(input_buffer&, SSL& ssl) +void ServerHelloDone::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } ssl.useStates().useClient() = serverHelloDoneComplete; } @@ -1667,8 +1758,13 @@ output_buffer& operator<<(output_buffer& output, const ClientHello& hello) // Client Hello processing handler -void ClientHello::Process(input_buffer&, SSL& ssl) +void ClientHello::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + // store version for pre master secret ssl.useSecurity().use_connection().chVersion_ = client_version_; @@ -1800,9 +1896,17 @@ output_buffer& operator<<(output_buffer& output, const ServerKeyExchange& sk) // Server Key Exchange processing handler void ServerKeyExchange::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } createKey(ssl); if (ssl.GetError()) return; server_key_->read(ssl, input); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } ssl.useStates().useClient() = serverKeyExchangeComplete; } @@ -1924,18 +2028,24 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request) { // types request.typeTotal_ = input[AUTO]; + if (request.typeTotal_ > CERT_TYPES) { + input.set_error(); + return input; + } for (int i = 0; i < request.typeTotal_; i++) request.certificate_types_[i] = ClientCertificateType(input[AUTO]); - byte tmp[REQUEST_HEADER]; - input.read(tmp, sizeof(tmp)); + byte tmp[2]; + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; uint16 sz; ato16(tmp, sz); // authorities while (sz) { uint16 dnSz; - input.read(tmp, sizeof(tmp)); + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; ato16(tmp, dnSz); DistinguishedName dn; @@ -1945,6 +2055,9 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request) input.read(&dn[REQUEST_HEADER], dnSz); sz -= dnSz + REQUEST_HEADER; + + if (input.get_error()) + break; } return input; @@ -1983,8 +2096,12 @@ output_buffer& operator<<(output_buffer& output, // CertificateRequest processing handler -void CertificateRequest::Process(input_buffer&, SSL& ssl) +void CertificateRequest::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } CertManager& cm = ssl.useCrypto().use_certManager(); cm.setSendVerify(); @@ -2067,7 +2184,8 @@ output_buffer& CertificateVerify::get(output_buffer& out) const input_buffer& operator>>(input_buffer& input, CertificateVerify& request) { byte tmp[VERIFY_HEADER]; - input.read(tmp, sizeof(tmp)); + tmp[0] = input[AUTO]; + tmp[1] = input[AUTO]; uint16 sz = 0; ato16(tmp, sz); @@ -2091,8 +2209,13 @@ output_buffer& operator<<(output_buffer& output, // CertificateVerify processing handler -void CertificateVerify::Process(input_buffer&, SSL& ssl) +void CertificateVerify::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } + const Hashes& hashVerify = ssl.getHashes().get_certVerify(); const CertManager& cert = ssl.getCrypto().get_certManager(); @@ -2131,9 +2254,17 @@ output_buffer& operator<<(output_buffer& output, const ClientKeyExchange& ck) // Client Key Exchange processing handler void ClientKeyExchange::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } createKey(ssl); if (ssl.GetError()) return; client_key_->read(ssl, input); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } if (ssl.getCrypto().get_certManager().verifyPeer()) build_certHashes(ssl, ssl.useHashes().use_certVerify()); @@ -2220,11 +2351,19 @@ output_buffer& operator<<(output_buffer& output, const Finished& fin) // Finished processing handler void Finished::Process(input_buffer& input, SSL& ssl) { + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } // verify hashes const Finished& verify = ssl.getHashes().get_verify(); uint finishedSz = ssl.isTLS() ? TLS_FINISHED_SZ : FINISHED_SZ; input.read(hashes_.md5_, finishedSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } if (memcmp(&hashes_, &verify.hashes_, finishedSz)) { ssl.SetError(verify_error); @@ -2246,19 +2385,23 @@ void Finished::Process(input_buffer& input, SSL& ssl) opaque mac[SHA_LEN]; // max size int digestSz = ssl.getCrypto().get_digest().get_digestSize(); input.read(mac, digestSz); + if (input.get_error()) { + ssl.SetError(bad_input); + return; + } uint ivExtra = 0; if (ssl.getSecurity().get_parms().cipher_type_ == block) if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); + opaque fill; int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - HANDSHAKE_HEADER - finishedSz - digestSz; - input.set_current(input.get_current() + padSz); - - // verify mac - if (memcmp(mac, verifyMAC, digestSz)) { - ssl.SetError(verify_error); + for (int i = 0; i < padSz; i++) + fill = input[AUTO]; + if (input.get_error()) { + ssl.SetError(bad_input); return; } diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 162d457b380..cbda9f97d83 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates + Copyright (c) 2005, 2014, Oracle and/or its affiliates 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 @@ -2535,8 +2535,9 @@ ASN1_STRING* StringHolder::GetString() int DeCompress(input_buffer& in, int sz, input_buffer& out) { byte tmp[LENGTH_SZ]; - - in.read(tmp, sizeof(tmp)); + + tmp[0] = in[AUTO]; + tmp[1] = in[AUTO]; uint16 len; ato16(tmp, len); diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp index b826bf54f8d..2854b8fe06d 100644 --- a/extra/yassl/taocrypt/include/asn.hpp +++ b/extra/yassl/taocrypt/include/asn.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -111,7 +111,7 @@ enum Constants MAX_LENGTH_SZ = 5, MAX_SEQ_SZ = 5, // enum(seq|con) + length(4) MAX_ALGO_SIZE = 9, - MAX_DIGEST_SZ = 25, // SHA + enum(Bit or Octet) + length(4) + MAX_DIGEST_SZ = 69, // SHA512 + enum(Bit or Octet) + length(4) DSA_SIG_SZ = 40, ASN_NAME_MAX = 512 // max total of all included names }; @@ -257,8 +257,11 @@ typedef STL::list SignerList; enum ContentType { HUH = 651 }; -enum SigType { SHAwDSA = 517, MD2wRSA = 646, MD5wRSA = 648, SHAwRSA =649}; -enum HashType { MD2h = 646, MD5h = 649, SHAh = 88 }; +enum SigType { SHAwDSA = 517, MD2wRSA = 646, MD5wRSA = 648, SHAwRSA = 649, + SHA256wRSA = 655, SHA384wRSA = 656, SHA512wRSA = 657, + SHA256wDSA = 416 }; +enum HashType { MD2h = 646, MD5h = 649, SHAh = 88, SHA256h = 414, SHA384h = 415, + SHA512h = 416 }; enum KeyType { DSAk = 515, RSAk = 645 }; // sums of algo OID diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 601d9dbce57..1e4bd454b06 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -74,7 +74,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, if (preserve) { A b = A(); typename A::pointer newPointer = b.allocate(newSize, 0); - memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize)); + memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); a.deallocate(p, oldSize); STL::swap(a, b); return newPointer; @@ -187,9 +187,9 @@ public: ~Block() { allocator_.deallocate(buffer_, sz_); } private: + A allocator_; word32 sz_; // size in Ts T* buffer_; - A allocator_; }; diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp index 68f3c4bbf39..75a3ee3d3df 100644 --- a/extra/yassl/taocrypt/include/integer.hpp +++ b/extra/yassl/taocrypt/include/integer.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -47,7 +47,7 @@ #ifdef TAOCRYPT_X86ASM_AVAILABLE #if defined(__GNUC__) && (__GNUC__ >= 4) - // GCC 4 or greater optimizes too much inline on recursive for bigint, + // GCC 4 or greater optimizes too much inline on recursive for bigint, // -O3 just as fast without asm here anyway #undef TAOCRYPT_X86ASM_AVAILABLE #endif diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp index 9b1b62fea45..32da429f747 100644 --- a/extra/yassl/taocrypt/include/pwdbased.hpp +++ b/extra/yassl/taocrypt/include/pwdbased.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -16,6 +16,7 @@ MA 02110-1301 USA. */ + /* pwdbased.hpp defines PBKDF2 from PKCS #5 */ diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp index 29c4d2db236..ef2facf32b0 100644 --- a/extra/yassl/taocrypt/include/runtime.hpp +++ b/extra/yassl/taocrypt/include/runtime.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates + Copyright (c) 2005, 2014, Oracle and/or its affiliates 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 @@ -34,7 +34,10 @@ // Handler for pure virtual functions namespace __Crun { - void pure_error(void); + static void pure_error(void) + { + // "Pure virtual method called, Aborted", GCC 4.2 str cmp fix + } } // namespace __Crun #endif // __sun @@ -48,7 +51,15 @@ extern "C" { #if defined(DO_TAOCRYPT_KERNEL_MODE) #include "kernelc.hpp" #endif - int __cxa_pure_virtual () __attribute__ ((weak)); + +/* Disallow inline __cxa_pure_virtual() */ +static int __cxa_pure_virtual() __attribute__((noinline, used)); +static int __cxa_pure_virtual() +{ + // oops, pure virtual called! + return 0; +} + } // extern "C" #endif // __GNUC__ > 2 diff --git a/extra/yassl/taocrypt/include/sha.hpp b/extra/yassl/taocrypt/include/sha.hpp index d1f9607f8de..cf6d0d09a1d 100644 --- a/extra/yassl/taocrypt/include/sha.hpp +++ b/extra/yassl/taocrypt/include/sha.hpp @@ -1,6 +1,5 @@ /* - Copyright (C) 2000-2007 MySQL AB - Use is subject to license terms + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -159,6 +158,12 @@ private: void Transform(); }; +enum { MAX_SHA2_DIGEST_SIZE = 64 }; // SHA512 + +#else + +enum { MAX_SHA2_DIGEST_SIZE = 32 }; // SHA256 + #endif // WORD64_AVAILABLE diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp index b49001f0a95..e47765b87d0 100644 --- a/extra/yassl/taocrypt/src/aes.cpp +++ b/extra/yassl/taocrypt/src/aes.cpp @@ -66,7 +66,7 @@ void AES::Process(byte* out, const byte* in, word32 sz) in += BLOCK_SIZE; } } - else { + else { while (blocks--) { AsmDecrypt(in, out, (void*)Td0); @@ -79,8 +79,8 @@ void AES::Process(byte* out, const byte* in, word32 sz) out += BLOCK_SIZE; in += BLOCK_SIZE; } - } - } + } + } } #endif // DO_AES_ASM @@ -466,14 +466,13 @@ void AES::decrypt(const byte* inBlock, const byte* xorBlock, "movd mm7, ebp;" \ "movd mm4, eax;" \ "mov ebp, edx;" \ - "sub esp, 4;" - + "sub esp, 4;" #define EPILOG() \ "add esp, 4;" \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "S" (inBlock), "d" (boxes), "a" (outBlock) \ : "%edi", "memory", "cc" \ @@ -834,9 +833,9 @@ void AES::AsmEncrypt(const byte* inBlock, byte* outBlock, void* boxes) const #ifdef _MSC_VER - __declspec(naked) + __declspec(naked) #else - __attribute__ ((noinline)) + __attribute__ ((noinline)) #endif void AES::AsmDecrypt(const byte* inBlock, byte* outBlock, void* boxes) const { diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index a28d8915330..7dae7d6a917 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -185,10 +185,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x, struct WindowSlider { - WindowSlider(const Integer &expIn, bool fastNegateIn, + WindowSlider(const Integer &exp, bool fastNegate, unsigned int windowSizeIn=0) - : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), - windowBegin(0), fastNegate(fastNegateIn), firstTime(true), + : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), + windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) { if (windowSize == 0) diff --git a/extra/yassl/taocrypt/src/arc4.cpp b/extra/yassl/taocrypt/src/arc4.cpp index f5794ec2566..10a3a7d6ffc 100644 --- a/extra/yassl/taocrypt/src/arc4.cpp +++ b/extra/yassl/taocrypt/src/arc4.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -121,12 +121,11 @@ void ARC4::AsmProcess(byte* out, const byte* in, word32 length) "push ebx;" \ "push ebp;" \ "mov ebp, eax;" - #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "D" (out), "S" (in), "a" (length) \ : "%edx", "memory", "cc" \ @@ -180,7 +179,7 @@ void ARC4::AsmProcess(byte* out, const byte* in, word32 length) #ifdef _MSC_VER AS1( loopStart: ) // loopStart #else - AS1( 0: ) // loopStart for some gas (need numeric for jump back + AS1( 0: ) // loopStart for some gas (need numeric for jump back #endif // y = (y+a) & 0xff; @@ -232,7 +231,7 @@ void ARC4::AsmProcess(byte* out, const byte* in, word32 length) AS1( nothing: ) - // inline adjust + // inline adjust AS2( add esp, 4 ) // fix room on stack EPILOG() diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index d2377ea6fb3..15f8d81f5cc 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -1,6 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. - Use is subject to license terms. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -769,7 +768,7 @@ void CertDecoder::GetName(NameType nt) while (source_.get_index() < length) { GetSet(); if (source_.GetError().What() == SET_E) { - source_.SetError(NO_ERROR_E); // extensions may only have sequence + source_.SetError(NO_ERROR_E); // extensions may only have sequence source_.prev(); } GetSequence(); @@ -840,10 +839,8 @@ void CertDecoder::GetName(NameType nt) if (source_.IsLeft(length) == false) return; if (email) { - if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) { - source_.SetError(CONTENT_E); - return; - } + if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) + return; } source_.advance(length); @@ -982,12 +979,26 @@ bool CertDecoder::ConfirmSignature(Source& pub) hasher.reset(NEW_TC SHA); ht = SHAh; } + else if (signatureOID_ == SHA256wRSA || signatureOID_ == SHA256wDSA) { + hasher.reset(NEW_TC SHA256); + ht = SHA256h; + } +#ifdef WORD64_AVAILABLE + else if (signatureOID_ == SHA384wRSA) { + hasher.reset(NEW_TC SHA384); + ht = SHA384h; + } + else if (signatureOID_ == SHA512wRSA) { + hasher.reset(NEW_TC SHA512); + ht = SHA512h; + } +#endif else { source_.SetError(UNKOWN_SIG_E); return false; } - byte digest[SHA::DIGEST_SIZE]; // largest size + byte digest[MAX_SHA2_DIGEST_SIZE]; // largest size hasher->Update(source_.get_buffer() + certBegin_, sigIndex_ - certBegin_); hasher->Final(digest); @@ -1060,6 +1071,12 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) 0x02, 0x05, 0x05, 0x00 }; static const byte md2AlgoID[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x02, 0x05, 0x00}; + static const byte sha256AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, + 0x04, 0x02, 0x01, 0x05, 0x00 }; + static const byte sha384AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, + 0x04, 0x02, 0x02, 0x05, 0x00 }; + static const byte sha512AlgoID[] = { 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, + 0x04, 0x02, 0x03, 0x05, 0x00 }; int algoSz = 0; const byte* algoName = 0; @@ -1070,6 +1087,21 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) algoName = shaAlgoID; break; + case SHA256h: + algoSz = sizeof(sha256AlgoID); + algoName = sha256AlgoID; + break; + + case SHA384h: + algoSz = sizeof(sha384AlgoID); + algoName = sha384AlgoID; + break; + + case SHA512h: + algoSz = sizeof(sha512AlgoID); + algoName = sha512AlgoID; + break; + case MD2h: algoSz = sizeof(md2AlgoID); algoName = md2AlgoID; diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp index 67bbd008527..87b0556755e 100644 --- a/extra/yassl/taocrypt/src/blowfish.cpp +++ b/extra/yassl/taocrypt/src/blowfish.cpp @@ -237,8 +237,8 @@ void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "S" (inBlock), "a" (outBlock) \ : "%edi", "%edx", "memory", "cc" \ @@ -291,7 +291,7 @@ void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) #ifdef _MSC_VER - __declspec(naked) + __declspec(naked) #else __attribute__ ((noinline)) #endif diff --git a/extra/yassl/taocrypt/src/des.cpp b/extra/yassl/taocrypt/src/des.cpp index b52a83a38c6..673c21ed207 100644 --- a/extra/yassl/taocrypt/src/des.cpp +++ b/extra/yassl/taocrypt/src/des.cpp @@ -1,6 +1,5 @@ /* - Copyright (C) 2000-2007 MySQL AB - Use is subject to license terms + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -642,9 +641,9 @@ void DES_EDE3::ProcessAndXorBlock(const byte* in, const byte* xOr, #ifdef _MSC_VER - __declspec(naked) + __declspec(naked) #else - __attribute__ ((noinline)) + __attribute__ ((noinline)) #endif void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const { @@ -664,8 +663,8 @@ void DES_EDE3::AsmProcess(const byte* in, byte* out, void* box) const #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "d" (this), "S" (in), "a" (box), "c" (out) \ : "%edi", "memory", "cc" \ diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 369df27ae1e..b7fbb7f96cf 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -56,9 +56,8 @@ #endif #elif defined(_MSC_VER) && defined(_M_IX86) /* #pragma message("You do not seem to have the Visual C++ Processor Pack ") - #pragma message("installed, so use of SSE2 intrinsics will be disabled.") -*/ #pragma message("installed, so use of SSE2 intrinsics will be disabled.") +*/ #elif defined(__GNUC__) && defined(__i386__) /* #warning You do not have GCC 3.3 or later, or did not specify the -msse2 \ compiler option. Use of SSE2 intrinsics will be disabled. @@ -194,7 +193,7 @@ DWord() {} "a" (a), "rm" (b) : "cc"); #elif defined(__mips64) - __asm__("dmultu %2,%3" : "=h" (r.halfs_.high), "=l" (r.halfs_.low) + __asm__("dmultu %2,%3" : "=d" (r.halfs_.high), "=l" (r.halfs_.low) : "r" (a), "r" (b)); #elif defined(_M_IX86) @@ -282,7 +281,12 @@ DWord() {} word GetHighHalfAsBorrow() const {return 0-halfs_.high;} private: - struct dword_struct + union + { + #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE + dword whole_; + #endif + struct { #ifdef LITTLE_ENDIAN_ORDER word low; @@ -291,14 +295,7 @@ private: word high; word low; #endif - }; - - union - { - #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE - dword whole_; - #endif - struct dword_struct halfs_; + } halfs_; }; }; @@ -1201,24 +1198,20 @@ public: #define AS1(x) #x ";" #define AS2(x, y) #x ", " #y ";" #define AddPrologue \ - word res; \ __asm__ __volatile__ \ ( \ "push %%ebx;" /* save this manually, in case of -fPIC */ \ - "mov %3, %%ebx;" \ + "mov %2, %%ebx;" \ ".intel_syntax noprefix;" \ "push ebp;" #define AddEpilogue \ "pop ebp;" \ ".att_syntax prefix;" \ "pop %%ebx;" \ - "mov %%eax, %0;" \ - : "=g" (res) \ + : \ : "c" (C), "d" (A), "m" (B), "S" (N) \ : "%edi", "memory", "cc" \ - ); \ - return res; - + ); #define MulPrologue \ __asm__ __volatile__ \ ( \ diff --git a/extra/yassl/taocrypt/src/md5.cpp b/extra/yassl/taocrypt/src/md5.cpp index e9a9e8fe517..45cfa8a3322 100644 --- a/extra/yassl/taocrypt/src/md5.cpp +++ b/extra/yassl/taocrypt/src/md5.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -223,7 +223,7 @@ void MD5::Update(const byte* data, word32 len) #ifdef _MSC_VER - __declspec(naked) + __declspec(naked) #else __attribute__ ((noinline)) #endif @@ -242,8 +242,8 @@ void MD5::AsmTransform(const byte* data, word32 times) #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "D" (data), "a" (times) \ : "%esi", "%edx", "memory", "cc" \ @@ -297,7 +297,7 @@ void MD5::AsmTransform(const byte* data, word32 times) #ifdef _MSC_VER AS1( loopStart: ) // loopStart #else - AS1( 0: ) // loopStart for some gas (need numeric for jump back + AS1( 0: ) // loopStart for some gas (need numeric for jump back #endif // set up diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp index e410cfe1946..198f1ba17be 100644 --- a/extra/yassl/taocrypt/src/misc.cpp +++ b/extra/yassl/taocrypt/src/misc.cpp @@ -84,17 +84,7 @@ namespace STL = STL_NAMESPACE; } -#ifdef __sun - -// Handler for pure virtual functions -namespace __Crun { - void pure_error() { - } -} - -#endif - -#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2) +#if defined(__ICC) || defined(__INTEL_COMPILER) extern "C" { diff --git a/extra/yassl/taocrypt/src/rabbit.cpp b/extra/yassl/taocrypt/src/rabbit.cpp index 89e6a207a1b..5e32f383493 100644 --- a/extra/yassl/taocrypt/src/rabbit.cpp +++ b/extra/yassl/taocrypt/src/rabbit.cpp @@ -1,15 +1,15 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. - + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + 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; version 2 of the License. - + 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, @@ -236,7 +236,7 @@ void Rabbit::Process(byte* output, const byte* input, word32 msglen) NextState(Work); /* Generate 16 bytes of pseudo-random data */ - tmp[0] = LITTLE32(workCtx_.x[0] ^ + tmp[0] = LITTLE32(workCtx_.x[0] ^ (workCtx_.x[5]>>16) ^ U32V(workCtx_.x[3]<<16)); tmp[1] = LITTLE32(workCtx_.x[2] ^ (workCtx_.x[7]>>16) ^ U32V(workCtx_.x[5]<<16)); diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp index 084871c5447..4b89b5b32c5 100644 --- a/extra/yassl/taocrypt/src/random.cpp +++ b/extra/yassl/taocrypt/src/random.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -27,6 +27,7 @@ #include #if defined(_WIN32) + #define _WIN32_WINNT 0x0400 #include #include #else diff --git a/extra/yassl/taocrypt/src/ripemd.cpp b/extra/yassl/taocrypt/src/ripemd.cpp index b670a9eca86..5d03dc61cd6 100644 --- a/extra/yassl/taocrypt/src/ripemd.cpp +++ b/extra/yassl/taocrypt/src/ripemd.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -507,6 +507,8 @@ void RIPEMD160::Transform() #ifdef _MSC_VER __declspec(naked) +#else + __attribute__ ((noinline)) #endif void RIPEMD160::AsmTransform(const byte* data, word32 times) { @@ -520,12 +522,11 @@ void RIPEMD160::AsmTransform(const byte* data, word32 times) ".intel_syntax noprefix;" \ "push ebx;" \ "push ebp;" - #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "D" (data), "d" (times) \ : "%esi", "%eax", "memory", "cc" \ @@ -571,7 +572,7 @@ void RIPEMD160::AsmTransform(const byte* data, word32 times) #ifdef _MSC_VER AS1( loopStart: ) // loopStart #else - AS1( 0: ) // loopStart for some gas (need numeric for jump back + AS1( 0: ) // loopStart for some gas (need numeric for jump back #endif AS2( movd mm2, edx ) // store times_ @@ -830,7 +831,7 @@ void RIPEMD160::AsmTransform(const byte* data, word32 times) AS1( jnz 0b ) // loopStart #endif - // inline adjust + // inline adjust AS2( add esp, 24 ) // fix room on stack EPILOG() diff --git a/extra/yassl/taocrypt/src/sha.cpp b/extra/yassl/taocrypt/src/sha.cpp index 0d3491eb83d..4206f7f64ea 100644 --- a/extra/yassl/taocrypt/src/sha.cpp +++ b/extra/yassl/taocrypt/src/sha.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. 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 @@ -776,12 +776,11 @@ void SHA::AsmTransform(const byte* data, word32 times) ".intel_syntax noprefix;" \ "push ebx;" \ "push ebp;" - #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "c" (this), "D" (data), "a" (times) \ : "%esi", "%edx", "memory", "cc" \ @@ -830,7 +829,7 @@ void SHA::AsmTransform(const byte* data, word32 times) #ifdef _MSC_VER AS1( loopStart: ) // loopStart #else - AS1( 0: ) // loopStart for some gas (need numeric for jump back + AS1( 0: ) // loopStart for some gas (need numeric for jump back #endif // byte reverse 16 words of input, 4 at a time, put on stack for W[] @@ -1022,7 +1021,7 @@ void SHA::AsmTransform(const byte* data, word32 times) AS1( jnz 0b ) // loopStart #endif - // inline adjust + // inline adjust AS2( add esp, 68 ) // fix room on stack EPILOG() diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp index 69699de0713..8eb82210b0f 100644 --- a/extra/yassl/taocrypt/src/twofish.cpp +++ b/extra/yassl/taocrypt/src/twofish.cpp @@ -285,12 +285,11 @@ void Twofish::decrypt(const byte* inBlock, const byte* xorBlock, "push ebp;" \ "movd mm3, eax;" \ "movd mm6, ebp;" - #define EPILOG() \ "pop ebp;" \ "pop ebx;" \ - "emms;" \ - ".att_syntax;" \ + "emms;" \ + ".att_syntax;" \ : \ : "D" (this), "S" (inBlock), "a" (outBlock) \ : "%ecx", "%edx", "memory", "cc" \ @@ -479,7 +478,7 @@ void Twofish::AsmEncrypt(const byte* inBlock, byte* outBlock) const AS2( movd ebp, mm6 ) AS2( movd esi, mm0 ) // k_ #ifdef __GNUC__ - AS2( movd edi, mm3 ) // outBlock + AS2( movd edi, mm3 ) // outBlock #else AS2( mov edi, [ebp + 12] ) // outBlock #endif @@ -500,7 +499,7 @@ void Twofish::AsmEncrypt(const byte* inBlock, byte* outBlock) const #ifdef _MSC_VER - __declspec(naked) + __declspec(naked) #else __attribute__ ((noinline)) #endif @@ -551,7 +550,7 @@ void Twofish::AsmDecrypt(const byte* inBlock, byte* outBlock) const AS2( movd ebp, mm6 ) AS2( movd esi, mm0 ) // k_ #ifdef __GNUC__ - AS2( movd edi, mm3 ) // outBlock + AS2( movd edi, mm3 ) // outBlock #else AS2( mov edi, [ebp + 12] ) // outBlock #endif diff --git a/include/m_string.h b/include/m_string.h index 395fd2ddda6..188802bc08b 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -34,14 +34,6 @@ #include #endif -/* need by my_vsnprintf */ -#include - -/* This is needed for the definitions of bzero... on solaris */ -#if defined(HAVE_STRINGS_H) -#include -#endif - /* This is needed for the definitions of memcpy... on solaris */ #if defined(HAVE_MEMORY_H) && !defined(__cplusplus) #include diff --git a/include/maria.h b/include/maria.h index 908825b9970..16a9beab62a 100644 --- a/include/maria.h +++ b/include/maria.h @@ -23,12 +23,10 @@ extern "C" { #endif #include -#include #include #include "my_compare.h" #include "ft_global.h" #include -#include #define MARIA_CANNOT_ROLLBACK diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc index ccdfaf286eb..a1a66421db8 100644 --- a/libmysqld/emb_qcache.cc +++ b/libmysqld/emb_qcache.cc @@ -13,8 +13,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sql_priv.h" #include "my_global.h" // HAVE_* +#include "sql_priv.h" #ifdef HAVE_QUERY_CACHE #include diff --git a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test index 549d184185d..765757c3427 100644 --- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test +++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test @@ -32,7 +32,7 @@ INSERT INTO tt_2(ddl_case) VALUES(0); --echo # CHECK IMPLICT COMMIT --echo ######################################################################### SET AUTOCOMMIT= 0; -let $ddl_cases= 41; +let $ddl_cases= 43; while ($ddl_cases >= 1) { --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- @@ -84,6 +84,15 @@ while ($ddl_cases >= 1) let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1); --enable_query_log eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases); + + if ($ddl_cases == 43) + { + let $cmd= CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; + } + if ($ddl_cases == 42) + { + let $cmd= DROP FUNCTION myfunc_int; + } if ($ddl_cases == 41) { let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; @@ -611,6 +620,7 @@ while ($ddl_cases >= 1) let $commit_event_row_number= 6; } } + --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --eval $cmd --disable_query_log # @@ -634,6 +644,7 @@ while ($ddl_cases >= 1) exit; } } + --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- let $binlog_start= $first_binlog_position; --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc index 8941779947a..c71c45a57c5 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc @@ -113,6 +113,19 @@ if ($commands == 'configure') RETURN "fc_i_nt_5_suc"; END| + CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) + BEGIN + DECLARE in_stmt_id INTEGER; + SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; + SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; + INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); + + SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; + SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; + INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); + RETURN "fc_i_nt_3_tt_3_suc"; + END| + CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -186,6 +199,7 @@ if ($commands == 'clean') DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; + DROP FUNCTION fc_i_nt_3_tt_3_suc; --disable_query_log if ($database_name != 'test') @@ -439,6 +453,21 @@ while ($commands != '') eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id)); inc $stmt_id; } + if ($command == 'set-T') + { + --eval SET @var= fc_i_tt_5_suc($trans_id, $stmt_id) + inc $stmt_id; + } + if ($command == 'set-N') + { + --eval SET @var= fc_i_nt_5_suc($trans_id, $stmt_id) + inc $stmt_id; + } + if ($command == 'set-NT') + { + --eval SET @var= fc_i_nt_3_tt_3_suc($trans_id, $stmt_id) + inc $stmt_id; + } if ($command == 'CS-T->T') { --eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM tt_1; diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test index 991e1c465e9..ce6dee7c62e 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -1762,6 +1762,43 @@ connection master; --source extra/rpl_tests/rpl_mixing_engines.inc +--echo ################################################################################### +--echo # 5 - SET WITH ROW CHANGES +--echo ################################################################################### +--let $commands= set-T +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= set-N +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= set-NT +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-N set-T C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-N C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-N set-T R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-N R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-NT set-T C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-NT C +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-NT set-T R +--source extra/rpl_tests/rpl_mixing_engines.inc + +--let $commands= B set-T set-NT R +--source extra/rpl_tests/rpl_mixing_engines.inc + + --echo ################################################################################### --echo # CHECK CONSISTENCY --echo ################################################################################### diff --git a/mysql-test/include/function_defaults.inc b/mysql-test/include/function_defaults.inc index e588c82df1b..cb8e8f86f93 100644 --- a/mysql-test/include/function_defaults.inc +++ b/mysql-test/include/function_defaults.inc @@ -407,16 +407,29 @@ SELECT * FROM t1; UPDATE t1 SET c = 2; SELECT * FROM t1; +--echo # +--echo # Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +--echo # + +--echo # 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; + +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; + +UPDATE t1 SET c = 3; +SELECT * FROM t1; + --echo # --echo # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP --echo # --echo # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; +UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; -UPDATE t1 t11, t1 t12 SET t11.c = 3; +UPDATE t1 t11, t1 t12 SET t11.c = 2; SELECT * FROM t1; DROP TABLE t1; @@ -1037,7 +1050,7 @@ SET TIME_ZONE = "+03:00"; --echo # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp) ENGINE = INNODB; +eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp); SHOW CREATE TABLE t1; @@ -1094,10 +1107,10 @@ eval CREATE TABLE t1 ( b INT, ts $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp, PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -eval CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +eval CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 @@ -1133,8 +1146,7 @@ eval ALTER TABLE t1 ADD COLUMN c4 $datetime ON UPDATE $now AFTER c3; eval ALTER TABLE t1 ADD COLUMN c5 $datetime DEFAULT $now AFTER c4; eval ALTER TABLE t1 ADD COLUMN c6 $datetime DEFAULT $now ON UPDATE $now AFTER c5; -SELECT * FROM t1; - +query_vertical SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/include/rpl_connect.inc b/mysql-test/include/rpl_connect.inc index 95912d57469..11927833f53 100644 --- a/mysql-test/include/rpl_connect.inc +++ b/mysql-test/include/rpl_connect.inc @@ -42,7 +42,7 @@ if (!$rpl_connection_name) --let $_rpl_port= \$SERVER_MYPORT_$rpl_server_number if (!$_rpl_port) { - --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cfg file. + --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cnf file. --die Not all SERVER_MYPORT_* environment variables are setup correctly. } diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 9a39ec67d0e..7917b6740cf 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -88,6 +88,7 @@ let $script= s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD---.}; s{rand_seed1=[0-9]*,rand_seed2=[0-9]*}{rand_seed1=,rand_seed2=}; s{((?:master|slave|slave-relay)-bin\.[0-9]{6};pos=)[0-9]+DOLLAR}{DOLLAR1POS}; + s{SONAME ".*"}{SONAME "LIB"}; s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; || --let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; diff --git a/mysql-test/include/wait_innodb_all_purged.inc b/mysql-test/include/wait_innodb_all_purged.inc new file mode 100644 index 00000000000..97b038acc44 --- /dev/null +++ b/mysql-test/include/wait_innodb_all_purged.inc @@ -0,0 +1,59 @@ +# include/wait_innodb_all_purged.inc +# +# SUMMARY +# +# Waits until purged all undo records of innodb, or operation times out. +# +# USAGE +# +# --source include/wait_innodb_all_purged.inc +# +--source include/have_innodb.inc +--source include/have_debug.inc + +--disable_query_log + +let $wait_counter_init= 300; +if ($wait_timeout) +{ + let $wait_counter_init= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +let $wait_counter= $wait_counter_init; + +# Keep track of how many times the wait condition is tested +let $wait_condition_reps= 0; +let $prev_trx_age= 0; +while ($wait_counter) +{ + let $trx_age = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';`; + + if ($trx_age != $prev_trx_age) + { + let $wait_counter= $wait_counter_init; + let $prev_trx_age= $trx_age; + } + + let $success= `SELECT $trx_age < 1`; + inc $wait_condition_reps; + if ($success) + { + let $wait_counter= 0; + } + if (!$success) + { + set global innodb_purge_run_now=ON; + real_sleep 0.1; + dec $wait_counter; + } +} +if (!$success) +{ + echo Timeout in wait_innodb_all_purged.inc for INNODB_PURGE_TRX_ID_AGE = $trx_age; +} + +--enable_query_log diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 483bf0bd4f3..1776f1008da 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -110,6 +110,8 @@ sub check_socket_path_length { # This may not be true, but we can't test for it on AIX due to Perl bug # See Bug #45771 return 0 if ($^O eq 'aix'); + # See Debian bug #670722 - failing on kFreeBSD even after setting short path + return 0 if $^O eq 'gnukfreebsd' and length $path < 40; require IO::Socket::UNIX; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e0c5c8663fb..befdf3a3ffd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -333,7 +333,7 @@ sub testcase_timeout ($) { return $opt_testcase_timeout * 60; } -sub check_timeout ($) { return testcase_timeout($_[0]) / 10; } +sub check_timeout ($) { return testcase_timeout($_[0]); } our $opt_warnings= 1; @@ -4881,6 +4881,8 @@ sub extract_warning_lines ($$) { qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, qr|'log-bin-use-v1-row-events' is MySQL 5.6 compatible option|, qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind + qr|Failed to setup SSL|, + qr|SSL error: Failed to set ciphers to use|, # Galera-related warnings. qr|WSREP:.*down context.*|, qr|WSREP: Failed to send state UUID:.*|, diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 41a2200c13f..ec70dba674f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -2609,5 +2609,52 @@ a b 1 1 unlock tables; drop table t1,t2; +# +# MDEV-6179: dynamic columns functions/cast()/convert() doesn't +# play nice with CREATE/ALTER TABLE +# +create table t1 ( +color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent, +cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent, +item_name varchar(32) primary key, -- A common attribute for all items +i int, +dynamic_cols blob -- Dynamic columns will be stored here +); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES +('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES +('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2); +select item_name, color, cl from t1; +item_name color cl +MariaDB T-shirt blue blue +Thinkpad Laptop black ttt +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT, + `cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT, + `item_name` varchar(32) NOT NULL, + `i` int(11) DEFAULT NULL, + `dynamic_cols` blob, + PRIMARY KEY (`item_name`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 ( +n int, +c char(32) as (convert(cast(n as char), char)) persistent +); +insert into t1(n) values (1),(2),(3); +select * from t1; +n c +1 1 +2 2 +3 3 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `n` int(11) DEFAULT NULL, + `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; create table t1; ERROR 42000: A table must have at least 1 column diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result new file mode 100644 index 00000000000..4b170ee4c9b --- /dev/null +++ b/mysql-test/r/ctype_cp932.result @@ -0,0 +1,35 @@ +# +# Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE +# USED. +# +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET character_set_client= 'utf8'; +SET character_set_connection= 'utf8'; +SET character_set_results= 'utf8'; +CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin); +INSERT INTO t1 VALUES('ï½¶ï½¶'); +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; +a +ï½¶ï½¶ +ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin; +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +a +ï½¶ï½¶ +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; +a +ï½¶ï½¶ +DROP TABLE t1; +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index af69a9e77d6..5ca7d1689d2 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); show variables like 'collation_server'; Variable_name Value collation_server ucs2_unicode_ci diff --git a/mysql-test/r/ctype_ucs2_query_cache.result b/mysql-test/r/ctype_ucs2_query_cache.result index 6f26bed02da..9a7580324c1 100644 --- a/mysql-test/r/ctype_ucs2_query_cache.result +++ b/mysql-test/r/ctype_ucs2_query_cache.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); # # Start of 5.5 tests # diff --git a/mysql-test/r/ctype_upgrade.result b/mysql-test/r/ctype_upgrade.result index 825ad8dac21..56e2ef96ead 100644 --- a/mysql-test/r/ctype_upgrade.result +++ b/mysql-test/r/ctype_upgrade.result @@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci; # Checking mysql_upgrade # # Running mysql_upgrade -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -258,9 +258,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -279,10 +279,11 @@ test.maria050313_ucs2_croatian_ci_def OK test.maria050313_utf8_croatian_ci OK test.maria050533_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # Running mysql_upgrade for the second time # This should report OK for all tables -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -313,9 +314,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -328,6 +329,7 @@ test.maria050313_utf8_croatian_ci OK test.maria050533_xxx_croatian_ci OK test.maria100004_xxx_croatian_ci OK test.mysql050614_xxx_croatian_ci OK +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def; Table Create Table diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index 074fc28a6b7..2d91ce3dd6f 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -1573,6 +1573,13 @@ a 512 Warnings: Warning 1260 Row 1 was cut by GROUP_CONCAT() # +# MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS.. +# +DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +ERROR HY000: Invalid utf16 character string: 'DE9899' +DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +ERROR HY000: Invalid utf16 character string: 'DE9899' +# # End of 5.5 tests # # diff --git a/mysql-test/r/ctype_utf16_def.result b/mysql-test/r/ctype_utf16_def.result index 6514734cb38..9d3d110fc99 100644 --- a/mysql-test/r/ctype_utf16_def.result +++ b/mysql-test/r/ctype_utf16_def.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Cannot use utf16 as character_set_client"); SHOW VARIABLES LIKE 'collation_server'; Variable_name Value collation_server utf16_general_ci diff --git a/mysql-test/r/derived_opt.result b/mysql-test/r/derived_opt.result index f5e7393591c..a2e08eacebc 100644 --- a/mysql-test/r/derived_opt.result +++ b/mysql-test/r/derived_opt.result @@ -1,4 +1,5 @@ -drop table if exists t1,t2,t3; +drop table if exists t0,t1,t2,t3; +drop database if exists test1; set @exit_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=on,derived_with_keys=on'; set @save_optimizer_switch=@@optimizer_switch; @@ -352,4 +353,155 @@ pk pk 72 72 80 80 drop table t1, t2, t3, t4; +# +# MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled +# +create database test1; +use test1; +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +CREATE TABLE t0 ( +f1 bigint(20) DEFAULT NULL, +f2 char(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two'); +CREATE TABLE t1 ( +f1 decimal(64,30) DEFAULT NULL, +f2 varchar(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES +(NULL,'numeric column is NULL'), +(0.000000000000000000000000000000,NULL), +(5.000000000000000000000000000000,'five'), +(1.000000000000000000000000000000,'one'), +(3.000000000000000000000000000000,'three'); +CREATE TABLE t2 ( +f1 double DEFAULT NULL, +f2 varbinary(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three'); +create VIEW v0 AS select f1,f2 from t1 ; +create VIEW v1 AS select tab1_v1.f1,tab1_v1.f2 from t1 tab1_v1 join v0 tab2 on tab1_v1.f1 = tab2.f1 and tab1_v1.f2 = tab2.f2; +create VIEW v2 AS select tab1_v2.f1,tab1_v2.f2 from t2 tab1_v2 join v1 tab2 on tab1_v2.f1 = tab2.f1 and tab1_v2.f2 = tab2.f2; +create VIEW v3 AS select tab1_v3.f1,tab1_v3.f2 from t0 tab1_v3 join v2 tab2 on tab1_v3.f1 = tab2.f1 and tab1_v3.f2 = tab2.f2; +create VIEW v4 AS select tab1_v4.f1,tab1_v4.f2 from t1 tab1_v4 join v3 tab2 on tab1_v4.f1 = tab2.f1 and tab1_v4.f2 = tab2.f2; +create VIEW v5 AS select tab1_v5.f1,tab1_v5.f2 from t2 tab1_v5 join v4 tab2 on tab1_v5.f1 = tab2.f1 and tab1_v5.f2 = tab2.f2; +create VIEW v6 AS select tab1_v6.f1,tab1_v6.f2 from t0 tab1_v6 join v5 tab2 on tab1_v6.f1 = tab2.f1 and tab1_v6.f2 = tab2.f2; +create VIEW v7 AS select tab1_v7.f1,tab1_v7.f2 from t1 tab1_v7 join v6 tab2 on tab1_v7.f1 = tab2.f1 and tab1_v7.f2 = tab2.f2; +create VIEW v8 AS select tab1_v8.f1,tab1_v8.f2 from t2 tab1_v8 join v7 tab2 on tab1_v8.f1 = tab2.f1 and tab1_v8.f2 = tab2.f2; +create VIEW v9 AS select tab1_v9.f1,tab1_v9.f2 from t0 tab1_v9 join v8 tab2 on tab1_v9.f1 = tab2.f1 and tab1_v9.f2 = tab2.f2; +create VIEW v10 AS select tab1_v10.f1,tab1_v10.f2 from t1 tab1_v10 join v9 tab2 on tab1_v10.f1 = tab2.f1 and tab1_v10.f2 = tab2.f2; +create VIEW v11 AS select tab1_v11.f1,tab1_v11.f2 from t2 tab1_v11 join v10 tab2 on tab1_v11.f1 = tab2.f1 and tab1_v11.f2 = tab2.f2; +create VIEW v12 AS select tab1_v12.f1,tab1_v12.f2 from t0 tab1_v12 join v11 tab2 on tab1_v12.f1 = tab2.f1 and tab1_v12.f2 = tab2.f2; +create VIEW v13 AS select tab1_v13.f1,tab1_v13.f2 from t1 tab1_v13 join v12 tab2 on tab1_v13.f1 = tab2.f1 and tab1_v13.f2 = tab2.f2; +create VIEW v14 AS select tab1_v14.f1,tab1_v14.f2 from t2 tab1_v14 join v13 tab2 on tab1_v14.f1 = tab2.f1 and tab1_v14.f2 = tab2.f2; +create VIEW v15 AS select tab1_v15.f1,tab1_v15.f2 from t0 tab1_v15 join v14 tab2 on tab1_v15.f1 = tab2.f1 and tab1_v15.f2 = tab2.f2; +create VIEW v16 AS select tab1_v16.f1,tab1_v16.f2 from t1 tab1_v16 join v15 tab2 on tab1_v16.f1 = tab2.f1 and tab1_v16.f2 = tab2.f2; +create VIEW v17 AS select tab1_v17.f1,tab1_v17.f2 from t2 tab1_v17 join v16 tab2 on tab1_v17.f1 = tab2.f1 and tab1_v17.f2 = tab2.f2; +create VIEW v18 AS select tab1_v18.f1,tab1_v18.f2 from t0 tab1_v18 join v17 tab2 on tab1_v18.f1 = tab2.f1 and tab1_v18.f2 = tab2.f2; +create VIEW v19 AS select tab1_v19.f1,tab1_v19.f2 from t1 tab1_v19 join v18 tab2 on tab1_v19.f1 = tab2.f1 and tab1_v19.f2 = tab2.f2; +create VIEW v20 AS select tab1_v20.f1,tab1_v20.f2 from t2 tab1_v20 join v19 tab2 on tab1_v20.f1 = tab2.f1 and tab1_v20.f2 = tab2.f2; +create VIEW v21 AS select tab1_v21.f1,tab1_v21.f2 from t0 tab1_v21 join v20 tab2 on tab1_v21.f1 = tab2.f1 and tab1_v21.f2 = tab2.f2; +create VIEW v22 AS select tab1_v22.f1,tab1_v22.f2 from t1 tab1_v22 join v21 tab2 on tab1_v22.f1 = tab2.f1 and tab1_v22.f2 = tab2.f2; +create VIEW v23 AS select tab1_v23.f1,tab1_v23.f2 from t2 tab1_v23 join v22 tab2 on tab1_v23.f1 = tab2.f1 and tab1_v23.f2 = tab2.f2; +create VIEW v24 AS select tab1_v24.f1,tab1_v24.f2 from t0 tab1_v24 join v23 tab2 on tab1_v24.f1 = tab2.f1 and tab1_v24.f2 = tab2.f2; +create VIEW v25 AS select tab1_v25.f1,tab1_v25.f2 from t1 tab1_v25 join v24 tab2 on tab1_v25.f1 = tab2.f1 and tab1_v25.f2 = tab2.f2; +create VIEW v26 AS select tab1_v26.f1,tab1_v26.f2 from t2 tab1_v26 join v25 tab2 on tab1_v26.f1 = tab2.f1 and tab1_v26.f2 = tab2.f2; +create VIEW v27 AS select tab1_v27.f1,tab1_v27.f2 from t0 tab1_v27 join v26 tab2 on tab1_v27.f1 = tab2.f1 and tab1_v27.f2 = tab2.f2; +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +# This used to hang forever: +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE tab1_v27 ALL NULL NULL NULL NULL 5 Using where +1 SIMPLE tab1_v26 hash_ALL NULL #hash#$hj 63 test1.tab1_v27.f1,test1.tab1_v27.f2 5 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v24 hash_ALL NULL #hash#$hj 60 test1.tab1_v25.f1,test1.tab1_v25.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v23 hash_ALL NULL #hash#$hj 63 test1.tab1_v24.f1,test1.tab1_v24.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v21 hash_ALL NULL #hash#$hj 60 test1.tab1_v22.f1,test1.tab1_v22.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v20 hash_ALL NULL #hash#$hj 63 test1.tab1_v21.f1,test1.tab1_v21.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v18 hash_ALL NULL #hash#$hj 60 test1.tab1_v19.f1,test1.tab1_v19.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v17 hash_ALL NULL #hash#$hj 63 test1.tab1_v18.f1,test1.tab1_v18.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v15 hash_ALL NULL #hash#$hj 60 test1.tab1_v16.f1,test1.tab1_v16.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v14 hash_ALL NULL #hash#$hj 63 test1.tab1_v15.f1,test1.tab1_v15.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v12 hash_ALL NULL #hash#$hj 60 test1.tab1_v13.f1,test1.tab1_v13.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v11 hash_ALL NULL #hash#$hj 63 test1.tab1_v12.f1,test1.tab1_v12.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v9 hash_ALL NULL #hash#$hj 60 test1.tab1_v10.f1,test1.tab1_v10.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v8 hash_ALL NULL #hash#$hj 63 test1.tab1_v9.f1,test1.tab1_v9.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v6 hash_ALL NULL #hash#$hj 60 test1.tab1_v7.f1,test1.tab1_v7.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v5 hash_ALL NULL #hash#$hj 63 test1.tab1_v6.f1,test1.tab1_v6.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v3 hash_ALL NULL #hash#$hj 60 test1.tab1_v4.f1,test1.tab1_v4.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v2 hash_ALL NULL #hash#$hj 63 test1.tab1_v3.f1,test1.tab1_v3.f2 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 hash_ALL NULL #hash#$hj 85 test1.tab1_v1.f1,test1.tab1_v1.f2 5 Using where; Using join buffer (incremental, BNLH join) +use test; +drop database test1; +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +# +# MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost() +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (a int, b int, c text); +insert into t2 +select +A.a + B.a* 10, +A.a + B.a* 10, +'blob-data' +from t1 A, t1 B; +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=6; +set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on'; +explain +select * from +t1 join +(select * from t2 order by a limit 1000) as D1 +where +D1.a= t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where +1 PRIMARY hash_ALL key0 #hash#key0 5 test.t1.a 100 Using join buffer (flat, BNLH join) +2 DERIVED t2 ALL NULL NULL NULL NULL 100 Using filesort +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +drop table t1, t2; set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 4753728793a..cc4e8074395 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1777,5 +1777,27 @@ group_concat(cast(column_json(dyn) as char)) {"name1":"value1","name2":"value2"} drop table t1; # +# MDEV-7116: Dynamic column hangs/segfaults +# +create table t1 ( +impressions mediumblob +); +insert into t1 values (""); +update t1 +set impressions = column_add(impressions, +'total', 12, +'2014-10-28 16:00:00', 3, +'2014-10-30 15:00:00', 3, +'2014-11-04 09:00:00', 6 +); +update t1 +set impressions = column_add(impressions, +'total', "a12", +'2014-10-28 16:00:00', "a3", +'2014-10-30 15:00:00', "a3", +'2014-11-04 09:00:00', "a6" + ); +drop table t1; +# # end of 10.0 tests # diff --git a/mysql-test/r/ext_key_noPK_6794.result b/mysql-test/r/ext_key_noPK_6794.result new file mode 100644 index 00000000000..59344522887 --- /dev/null +++ b/mysql-test/r/ext_key_noPK_6794.result @@ -0,0 +1,20 @@ +create table t1 (c1 int not null, c2 int, unique index(c1), index (c2)) engine=innodb; +insert into t1 (c1, c2) select 1, round(rand()*100); +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +select count(*) from t1; +count(*) +8 +explain select * from t1 where c2 = 1 order by c1; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys c2 +key c2 +key_len 5 +ref const +rows 1 +Extra Using where; Using index +drop table t1; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 22b75de8c60..9fde006b377 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -147,3 +147,11 @@ DROP TABLE t1; # # End of 5.3 tests # +SELECT UNCOMPRESS(CAST(0 AS BINARY(5))); +UNCOMPRESS(CAST(0 AS BINARY(5))) +NULL +Warnings: +Warning 1259 ZLIB: Input data corrupted +# +# End of 5.5 tests +# diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result index b777af767cb..641c4fddbf7 100644 --- a/mysql-test/r/func_regexp_pcre.result +++ b/mysql-test/r/func_regexp_pcre.result @@ -839,3 +839,9 @@ SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2'); REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2') /abc SET default_regex_flags=DEFAULT; +# +# MDEV-6965 non-captured group \2 in regexp_replace +# +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); +REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that') +1 this and that diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 2c1c416472f..97ef61047a5 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -320,3 +320,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not((`test`.`t1`.`a` + 0))) drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +# +SELECT NOT NOT strcmp('a','b'); +NOT NOT strcmp('a','b') +1 +EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select (strcmp('a','b') <> 0) AS `NOT NOT strcmp('a','b')` +# +# End of 10.0 tests +# diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result index 27b9ee0a323..50183a1f416 100644 --- a/mysql-test/r/function_defaults.result +++ b/mysql-test/r/function_defaults.result @@ -435,18 +435,31 @@ SELECT * FROM t1; a b c 2011-04-20 09:53:41 2011-04-20 09:53:41 2 # +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +# # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP # # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; -SELECT * FROM t1; -a b c -2011-04-20 09:53:41 2011-04-20 09:53:41 2 UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; a b c -2011-04-20 15:06:13 2011-04-20 15:06:13 3 +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13 2011-04-20 15:06:13 2 DROP TABLE t1; # # Test of a multiple-table update where only one table is updated and @@ -1421,13 +1434,13 @@ drop table t1; SET TIME_ZONE = "+03:00"; # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) ENGINE = INNODB; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -1477,9 +1490,9 @@ a INT, b INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 SET t1.b = t1.b + 1 @@ -1508,8 +1521,19 @@ ALTER TABLE t1 ADD COLUMN c4 DATETIME ON UPDATE NOW() AFTER c3; ALTER TABLE t1 ADD COLUMN c5 DATETIME DEFAULT NOW() AFTER c4; ALTER TABLE t1 ADD COLUMN c6 DATETIME DEFAULT NOW() ON UPDATE NOW() AFTER c5; SELECT * FROM t1; -a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 -0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 1 0000-00-00 00:00:00 1970-01-01 03:16:40 1970-01-01 03:16:40 NULL 1970-01-01 03:16:40 1970-01-01 03:16:40 +a1 0000-00-00 00:00:00 +a2 1970-01-01 03:16:40 +a3 1970-01-01 03:16:40 +a4 NULL +a5 1970-01-01 03:16:40 +a6 1970-01-01 03:16:40 +b 1 +c1 0000-00-00 00:00:00 +c2 1970-01-01 03:16:40 +c3 1970-01-01 03:16:40 +c4 NULL +c5 1970-01-01 03:16:40 +c6 1970-01-01 03:16:40 DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b DATETIME DEFAULT NOW() ); INSERT INTO t1 VALUES (); @@ -1967,18 +1991,31 @@ SELECT * FROM t1; a b c 2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 # +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +# # Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP # # 2011-04-20 15:06:13 UTC SET TIMESTAMP = 1303311973.534231; -UPDATE t1 t11, t1 t12 SET t11.c = 2; -SELECT * FROM t1; -a b c -2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 UPDATE t1 t11, t1 t12 SET t11.c = 3; SELECT * FROM t1; a b c -2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 3 +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 2 DROP TABLE t1; # # Test of a multiple-table update where only one table is updated and @@ -2953,13 +2990,13 @@ drop table t1; SET TIME_ZONE = "+03:00"; # 1970-01-01 03:16:40 SET TIMESTAMP = 1000.123456; -CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)) ENGINE = INNODB; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; a b @@ -3009,9 +3046,9 @@ a INT, b INT, ts TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY ( a, ts ) -) ENGINE = INNODB; +); INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); -CREATE TABLE t2 ( a INT ) ENGINE = INNODB; +CREATE TABLE t2 ( a INT ); INSERT INTO t2 VALUES ( 1 ); UPDATE t1 STRAIGHT_JOIN t2 SET t1.b = t1.b + 1 @@ -3040,8 +3077,19 @@ ALTER TABLE t1 ADD COLUMN c4 DATETIME(6) ON UPDATE NOW(6) AFTER c3; ALTER TABLE t1 ADD COLUMN c5 DATETIME(6) DEFAULT NOW(6) AFTER c4; ALTER TABLE t1 ADD COLUMN c6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c5; SELECT * FROM t1; -a1 a2 a3 a4 a5 a6 b c1 c2 c3 c4 c5 c6 -0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 1 0000-00-00 00:00:00.000000 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 NULL 1970-01-01 03:16:40.000000 1970-01-01 03:16:40.000000 +a1 0000-00-00 00:00:00.000000 +a2 1970-01-01 03:16:40.000000 +a3 1970-01-01 03:16:40.000000 +a4 NULL +a5 1970-01-01 03:16:40.000000 +a6 1970-01-01 03:16:40.000000 +b 1 +c1 0000-00-00 00:00:00.000000 +c2 1970-01-01 03:16:40.000000 +c3 1970-01-01 03:16:40.000000 +c4 NULL +c5 1970-01-01 03:16:40.000000 +c6 1970-01-01 03:16:40.000000 DROP TABLE t1; CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b DATETIME(6) DEFAULT NOW(6) ); INSERT INTO t1 VALUES (); diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result new file mode 100644 index 00000000000..302d4c85e05 --- /dev/null +++ b/mysql-test/r/function_defaults_innodb.result @@ -0,0 +1,3116 @@ +# +# Test of function defaults for any server, including embedded. +# +set default_storage_engine=innodb; +# +# Function defaults run 1. No microsecond precision. +# +SET TIME_ZONE = "+00:00"; +# +# Test of errors for column data types that dont support function +# defaults. +# +CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +# +# Test that the default clause behaves like NOW() regarding time zones. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NULL, +e DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +f DATETIME DEFAULT CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h DATETIME +); +# 2011-09-27 14:11:08 UTC +SET TIMESTAMP = 1317132668.654321; +SET @old_time_zone = @@TIME_ZONE; +SET TIME_ZONE = "+05:00"; +INSERT INTO t1( d, h ) VALUES ( NOW(), NOW() ); +SELECT * FROM t1; +a b c d e f g h +2011-09-27 19:11:08 2011-09-27 19:11:08 0000-00-00 00:00:00 2011-09-27 19:11:08 2011-09-27 19:11:08 2011-09-27 19:11:08 NULL 2011-09-27 19:11:08 +# 1989-05-13 01:02:03 +SET TIMESTAMP = 611017323.543212; +UPDATE t1 SET d = NOW(), h = NOW(); +SELECT * FROM t1; +a b c d e f g h +1989-05-13 04:02:03 2011-09-27 19:11:08 1989-05-13 04:02:03 1989-05-13 04:02:03 1989-05-13 04:02:03 2011-09-27 19:11:08 1989-05-13 04:02:03 1989-05-13 04:02:03 +SET TIME_ZONE = @old_time_zone; +DROP TABLE t1; +# +# Test of several TIMESTAMP columns with different function defaults. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +f INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( f ) VALUES (1); +SELECT * FROM t1; +a b c d e f +2011-04-19 07:22:02 2011-04-19 07:22:02 2011-04-19 07:22:02 0000-00-00 00:00:00 0000-00-00 00:00:00 1 +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.132435; +UPDATE t1 SET f = 2; +SELECT * FROM t1; +a b c d e f +2011-04-19 07:23:18 2011-04-19 07:23:18 2011-04-19 07:22:02 2011-04-19 07:23:18 2011-04-19 07:23:18 2 +DROP TABLE t1; +# +# Test of inserted values out of order. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +j INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( j, a ) VALUES ( 1, 1 ); +SELECT * FROM t1; +a b c d e f g h i j +1 2011-04-19 07:22:02 2011-04-19 07:22:02 0000-00-00 00:00:00 NULL NULL 2011-04-19 07:22:02 NULL 2011-04-19 07:22:02 1 +DROP TABLE t1; +# +# Test of ON DUPLICATE KEY UPDATE +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b INT, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +f TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +g TIMESTAMP NULL, +h DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP, +j DATETIME ON UPDATE CURRENT_TIMESTAMP, +k DATETIME NULL, +l DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +# 1977-12-21 23:00:00 UTC +SET TIMESTAMP = 251593200.192837; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 NULL 1977-12-21 23:00:00 1977-12-21 23:00:00 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 1977-12-21 23:00:00 1977-12-21 23:00:00 NULL NULL 1986-09-27 03:00:00 +# 1975-05-21 23:00:00 UTC +SET TIMESTAMP = 169945200.918273; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 1986-09-27 03:00:00 NULL 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 NULL 1986-09-27 03:00:00 +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1(a) VALUES (2) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 1986-09-27 03:00:00 NULL 1975-05-21 23:00:00 1977-12-21 23:00:00 1975-05-21 23:00:00 NULL 1986-09-27 03:00:00 +2 NULL 1973-08-14 09:11:22 1973-08-14 09:11:22 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 1973-08-14 09:11:22 1973-08-14 09:11:22 NULL NULL 1986-09-27 03:00:00 +DROP TABLE t1; +CREATE TABLE t1 ( a INT PRIMARY KEY, b INT, c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.945156; +INSERT INTO t1 VALUES +(1, 0, '2001-01-01 01:01:01.111111'), +(2, 0, '2002-02-02 02:02:02.222222'), +(3, 0, '2003-03-03 03:03:03.333333'); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 0 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +UPDATE t1 SET b = 2, c = c WHERE a = 2; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +INSERT INTO t1 (a) VALUES (4); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +4 NULL 2011-04-19 07:23:18 +UPDATE t1 SET c = '2004-04-04 04:04:04.444444' WHERE a = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 0 2003-03-03 03:03:03 +4 NULL 2004-04-04 04:04:04 +INSERT INTO t1 ( a ) VALUES ( 3 ), ( 5 ) ON DUPLICATE KEY UPDATE b = 3, c = c; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 3 2003-03-03 03:03:03 +4 NULL 2004-04-04 04:04:04 +5 NULL 2011-04-19 07:23:18 +INSERT INTO t1 (a, c) VALUES +(4, '2004-04-04 00:00:00.444444'), +(6, '2006-06-06 06:06:06.666666') +ON DUPLICATE KEY UPDATE b = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01 +2 2 2002-02-02 02:02:02 +3 3 2003-03-03 03:03:03 +4 4 2011-04-19 07:23:18 +5 NULL 2011-04-19 07:23:18 +6 NULL 2006-06-06 06:06:06 +DROP TABLE t1; +# +# Test of REPLACE INTO executed as UPDATE. +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +e DATETIME DEFAULT CURRENT_TIMESTAMP, +f TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h TIMESTAMP NULL, +i DATETIME +); +# 1970-09-21 09:11:12 UTC +SET TIMESTAMP = 22756272.163584; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-09-21 09:11:12 1970-09-21 09:11:12 1970-09-21 09:11:12 1970-09-21 09:11:12 0000-00-00 00:00:00 NULL NULL NULL +# 1970-11-10 14:16:17 UTC +SET TIMESTAMP = 27094577.852954; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-11-10 14:16:17 1970-11-10 14:16:17 1970-11-10 14:16:17 1970-11-10 14:16:17 0000-00-00 00:00:00 NULL NULL NULL +DROP TABLE t1; +# +# Test of insertion of NULL, DEFAULT and an empty row for DEFAULT +# CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.163578; +INSERT INTO t1 VALUES (NULL, NULL, 1), (DEFAULT, DEFAULT, 2); +INSERT INTO t1 ( a, b, c ) VALUES (NULL, NULL, 3), (DEFAULT, DEFAULT, 4); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 NULL 1 +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +2011-04-20 09:53:41 NULL 3 +2011-04-20 09:53:41 2011-04-20 09:53:41 4 +SET TIME_ZONE = "+03:00"; +SELECT * FROM t1; +a b c +2011-04-20 12:53:41 NULL 1 +2011-04-20 12:53:41 2011-04-20 09:53:41 2 +2011-04-20 12:53:41 NULL 3 +2011-04-20 12:53:41 2011-04-20 09:53:41 4 +SET TIME_ZONE = "+00:00"; +DROP TABLE t1; +# 2011-04-20 07:05:39 UTC +SET TIMESTAMP = 1303283139.195624; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '2010-10-11 12:34:56' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT '2010-10-11 12:34:56' +); +INSERT INTO t1 VALUES (NULL, NULL), (DEFAULT, DEFAULT); +INSERT INTO t1 ( a, b ) VALUES (NULL, NULL), (DEFAULT, DEFAULT); +SELECT * FROM t1; +a b +2011-04-20 07:05:39 NULL +2010-10-11 12:34:56 2010-10-11 12:34:56 +2011-04-20 07:05:39 NULL +2010-10-11 12:34:56 2010-10-11 12:34:56 +DROP TABLE t1; +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.136952; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME NULL, +j DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +INSERT INTO t1 SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL; +SELECT * FROM t1; +a b c d e f g h i j +2011-04-20 09:53:41 2011-04-20 09:53:41 0000-00-00 00:00:00 1986-09-27 03:00:00 NULL 2011-04-20 09:53:41 2011-04-20 09:53:41 NULL NULL 1986-09-27 03:00:00 +2011-04-20 09:53:41 2011-04-20 09:53:41 2011-04-20 09:53:41 2011-04-20 09:53:41 NULL NULL NULL NULL NULL NULL +DROP TABLE t1; +# +# Test of multiple-table UPDATE for DEFAULT CURRENT_TIMESTAMP +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c INT +); +INSERT INTO t1 ( c ) VALUES (1); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 1 +# 2011-04-20 17:06:13 UTC +SET TIMESTAMP = 1303311973.163587; +UPDATE t1 t11, t1 t12 SET t11.c = 1; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 1 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13 2011-04-20 09:53:41 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP, +d DATETIME ON UPDATE CURRENT_TIMESTAMP, +e INT +); +CREATE TABLE t2 ( +f INT, +g DATETIME ON UPDATE CURRENT_TIMESTAMP, +h DATETIME DEFAULT CURRENT_TIMESTAMP, +i TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +j TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP +); +# 1995-03-11 00:02:03 UTC +SET TIMESTAMP = 794880123.195676; +INSERT INTO t1 ( e ) VALUES ( 1 ), ( 2 ); +INSERT INTO t2 ( f ) VALUES ( 1 ), ( 2 ); +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 NULL 1 +1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 NULL 2 +SELECT * FROM t2; +f g h i j +1 NULL 1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 +2 NULL 1995-03-11 00:02:03 0000-00-00 00:00:00 1995-03-11 00:02:03 +# 1980-12-13 02:02:01 UTC +SET TIMESTAMP = 345520921.196755; +UPDATE t1, t2 SET t1.e = 3, t2.f = 4; +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 3 +1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 3 +SELECT * FROM t2; +f g h i j +4 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 +4 1980-12-13 02:02:01 1995-03-11 00:02:03 1980-12-13 02:02:01 1995-03-11 00:02:03 +DROP TABLE t1, t2; +# +# Test of multiple table update with temporary table and on the fly. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT, +d INT +); +CREATE TABLE t2 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT KEY, +d INT +); +INSERT INTO t1 ( c ) VALUES (1), (2); +INSERT INTO t2 ( c ) VALUES (1), (2); +# Test of multiple table update done on the fly +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.194685; +UPDATE t1 JOIN t2 USING ( c ) SET t2.d = 1; +SELECT * FROM t1; +a b c d +0000-00-00 00:00:00 NULL 1 NULL +0000-00-00 00:00:00 NULL 2 NULL +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13 2011-04-20 15:06:13 1 1 +2011-04-20 15:06:13 2011-04-20 15:06:13 2 1 +# Test of multiple table update done with temporary table. +# 1979-01-15 03:02:01 +SET TIMESTAMP = 285213721.134679; +UPDATE t1 JOIN t2 USING ( c ) SET t1.d = 1; +SELECT * FROM t1; +a b c d +1979-01-15 02:02:01 1979-01-15 02:02:01 1 1 +1979-01-15 02:02:01 1979-01-15 02:02:01 2 1 +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13 2011-04-20 15:06:13 1 1 +2011-04-20 15:06:13 2011-04-20 15:06:13 2 1 +DROP TABLE t1, t2; +# +# Test of ON UPDATE CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME ON UPDATE CURRENT_TIMESTAMP, +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.794613; +INSERT INTO t1 ( c ) VALUES ( 1 ); +SELECT * FROM t1; +a b c +0000-00-00 00:00:00 NULL 1 +UPDATE t1 SET c = 1; +SELECT * FROM t1; +a b c +0000-00-00 00:00:00 NULL 1 +UPDATE t1 SET c = 2; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +# +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41 2011-04-20 09:53:41 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +# +# Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP +# +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.534231; +UPDATE t1 t11, t1 t12 SET t11.c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13 2011-04-20 09:54:13 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13 2011-04-20 15:06:13 2 +DROP TABLE t1; +# +# Test of a multiple-table update where only one table is updated and +# the updated table has a primary key. +# +CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (a) ); +INSERT INTO t1 VALUES (1, 1),(2, 2),(3, 3),(4, 4); +CREATE TABLE t2 ( a INT, b INT ); +INSERT INTO t2 VALUES (1, 1),(2, 2),(3, 3),(4, 4),(5, 5); +UPDATE t1, t2 SET t1.b = 100 WHERE t1.a = t2.a; +SELECT * FROM t1; +a b +1 100 +2 100 +3 100 +4 100 +SELECT * FROM t2; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +DROP TABLE t1, t2; +# +# Test of ALTER TABLE, reordering columns. +# +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b INT ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(), b INT, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b INT, c TIMESTAMP NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp NULL DEFAULT NULL, + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of ALTER TABLE, adding columns. +# +CREATE TABLE t1 ( a INT ); +ALTER TABLE t1 ADD COLUMN b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of INSERT SELECT. +# +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +d DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( +placeholder1 INT, +placeholder2 INT, +placeholder3 INT, +placeholder4 INT, +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', +c DATETIME, +d DATETIME +); +# 1977-08-16 15:30:01 UTC +SET TIMESTAMP = 240589801.654312; +INSERT INTO t2 (a, b, c, d) VALUES ( +'1977-08-16 15:30:01.123456', +'1977-08-16 15:30:01.234567', +'1977-08-16 15:30:01.345678', +'1977-08-16 15:30:01.456789' +); +# 1986-09-27 01:00:00 UTC +SET TIMESTAMP = 528166800.132435; +INSERT INTO t1 ( a, c ) SELECT a, c FROM t2; +SELECT * FROM t1; +a b c d +1977-08-16 15:30:01 1986-09-27 01:00:00 1977-08-16 15:30:01 1986-09-27 01:00:00 +DROP TABLE t1, t2; +# +# Test of CREATE TABLE SELECT. +# +# We test that the columns of the source table are not used to determine +# function defaults for the receiving table. +# +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.657898; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME NULL, +j DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.164937; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +0000-00-00 00:00:00 +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +1986-09-27 03:00:00 +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +NULL +CREATE TABLE t7 SELECT f FROM t1; +SHOW CREATE TABLE t7; +Table Create Table +t7 CREATE TABLE `t7` ( + `f` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t7; +f +1970-04-11 20:13:57 +CREATE TABLE t8 SELECT g FROM t1; +SHOW CREATE TABLE t8; +Table Create Table +t8 CREATE TABLE `t8` ( + `g` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t8; +g +1970-04-11 20:13:57 +CREATE TABLE t9 SELECT h FROM t1; +SHOW CREATE TABLE t9; +Table Create Table +t9 CREATE TABLE `t9` ( + `h` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t9; +h +NULL +CREATE TABLE t10 SELECT i FROM t1; +SHOW CREATE TABLE t10; +Table Create Table +t10 CREATE TABLE `t10` ( + `i` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t10; +i +NULL +CREATE TABLE t11 SELECT j FROM t1; +SHOW CREATE TABLE t11; +Table Create Table +t11 CREATE TABLE `t11` ( + `j` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t11; +j +1986-09-27 03:00:00 +CREATE TABLE t12 ( +k TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +l TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +m TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +n TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +o TIMESTAMP NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +p TIMESTAMP NULL, +q DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +r DATETIME DEFAULT CURRENT_TIMESTAMP, +s DATETIME ON UPDATE CURRENT_TIMESTAMP, +t DATETIME NULL, +u DATETIME DEFAULT '1986-09-27 03:00:00.098765' +) +SELECT * FROM t1; +SHOW CREATE TABLE t12; +Table Create Table +t12 CREATE TABLE `t12` ( + `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', + `p` timestamp NULL DEFAULT NULL, + `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `r` datetime DEFAULT CURRENT_TIMESTAMP, + `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `t` datetime DEFAULT NULL, + `u` datetime DEFAULT '1986-09-27 03:00:00', + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', + `e` timestamp NULL DEFAULT NULL, + `f` datetime DEFAULT NULL, + `g` datetime DEFAULT NULL, + `h` datetime DEFAULT NULL, + `i` datetime DEFAULT NULL, + `j` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.164953; +CREATE TABLE t1 ( +a DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT CURRENT_TIMESTAMP, +c DATETIME ON UPDATE CURRENT_TIMESTAMP, +d DATETIME NULL, +e DATETIME DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.915736; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +NULL +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` datetime DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +NULL +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` datetime DEFAULT '1986-09-27 03:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +1986-09-27 03:00:00 +DROP TABLE t1, t2, t3, t4, t5, t6; +# +# Test of a CREATE TABLE SELECT that also declared columns. In this case +# the function default should be de-activated during the execution of the +# CREATE TABLE statement. +# +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.987654; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES ( 1 ), ( 2 ); +CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET TIMESTAMP = 2000.876543; +INSERT INTO t2( a ) VALUES ( 3 ); +SELECT * FROM t2; +b a +0000-00-00 00:00:00 1 +0000-00-00 00:00:00 2 +1970-01-01 00:33:20 3 +DROP TABLE t1, t2; +# +# Test of updating a view. +# +CREATE TABLE t1 ( a INT, b DATETIME DEFAULT CURRENT_TIMESTAMP ); +CREATE TABLE t2 ( a INT, b DATETIME ON UPDATE CURRENT_TIMESTAMP ); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci +CREATE VIEW v2 AS SELECT * FROM t2; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b` from `t2` latin1 latin1_swedish_ci +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.348564; +INSERT INTO v1 ( a ) VALUES ( 1 ); +INSERT INTO v2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1971-01-31 20:13:57 +SELECT * FROM v1; +a b +1 1971-01-31 20:13:57 +SELECT * FROM t2; +a b +1 NULL +SELECT * FROM v2; +a b +1 NULL +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.567332; +UPDATE v1 SET a = 2; +UPDATE v2 SET a = 2; +SELECT * FROM t1; +a b +2 1971-01-31 20:13:57 +SELECT * FROM v1; +a b +2 1971-01-31 20:13:57 +SELECT * FROM t2; +a b +2 1970-04-11 20:13:57 +SELECT * FROM v2; +a b +2 1970-04-11 20:13:57 +DROP VIEW v1, v2; +DROP TABLE t1, t2; +# +# Test with stored procedures. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME DEFAULT CURRENT_TIMESTAMP, +g DATETIME ON UPDATE CURRENT_TIMESTAMP +); +CREATE PROCEDURE p1() INSERT INTO test.t1( a ) VALUES ( 1 ); +CREATE PROCEDURE p2() UPDATE t1 SET a = 2 WHERE a = 1; +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.876544; +CALL p1(); +SELECT * FROM t1; +a b c d e f g +1 1971-01-31 20:13:57 1971-01-31 20:13:57 0000-00-00 00:00:00 NULL 1971-01-31 20:13:57 NULL +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.143546; +CALL p2(); +SELECT * FROM t1; +a b c d e f g +2 1970-04-11 20:13:57 1971-01-31 20:13:57 1970-04-11 20:13:57 NULL 1971-01-31 20:13:57 1970-04-11 20:13:57 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; +# +# Test with triggers. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NULL, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( a INT ); +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +INSERT INTO t1 ( a ) VALUES ( 1 ); +END| +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.978675; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1971-01-31 20:13:57 1971-01-31 20:13:57 0000-00-00 00:00:00 NULL NULL 1971-01-31 20:13:57 NULL 1971-01-31 20:13:57 +DROP TRIGGER t2_trg; +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +UPDATE t1 SET a = 2; +END| +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.456789; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +2 1970-04-11 20:13:57 1971-01-31 20:13:57 1970-04-11 20:13:57 NULL NULL 1971-01-31 20:13:57 1970-04-11 20:13:57 1970-04-11 20:13:57 +DROP TABLE t1, t2; +# +# Test where the assignment target is not a column. +# +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t2 ( a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t3 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ); +CREATE TABLE t4 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ); +CREATE VIEW v1 AS SELECT a COLLATE latin1_german1_ci AS b FROM t1; +CREATE VIEW v2 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t2; +CREATE VIEW v3 AS SELECT a COLLATE latin1_german1_ci AS b FROM t3; +CREATE VIEW v4 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t4; +INSERT INTO v1 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t1; +a +2007-10-24 00:03:34 +INSERT INTO v2 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t2; +a +2007-10-24 00:03:34 +INSERT INTO t3 VALUES (); +UPDATE v3 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t3; +a +2007-10-24 00:03:34 +INSERT INTO t4 VALUES (); +UPDATE v4 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t4; +a +2007-10-24 00:03:34 +DROP VIEW v1, v2, v3, v4; +DROP TABLE t1, t2, t3, t4; +# +# Test of LOAD DATA/XML INFILE +# This tests behavior of function defaults for TIMESTAMP and DATETIME +# columns. during LOAD ... INFILE. +# As can be seen here, a TIMESTAMP column with only ON UPDATE +# CURRENT_TIMESTAMP will still have CURRENT_TIMESTAMP inserted on LOAD +# ... INFILE if the value is missing. For DATETIME columns a NULL value +# is inserted instead. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +f DATETIME, +g DATETIME DEFAULT CURRENT_TIMESTAMP, +h DATETIME ON UPDATE CURRENT_TIMESTAMP, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); +CREATE TABLE t2 ( +a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +c TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, +d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +e DATETIME NOT NULL, +f DATETIME NOT NULL DEFAULT '1977-01-02 12:13:14', +g DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, +h DATETIME ON UPDATE CURRENT_TIMESTAMP NOT NULL, +i DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL +); +SELECT 1 INTO OUTFILE 't3.dat' FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE 't4.dat' +FROM dual; +SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.918273; +LOAD DATA INFILE 't3.dat' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19 +c 2011-08-01 15:11:19 +d 2011-08-01 15:11:19 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i NULL +LOAD DATA INFILE 't4.dat' INTO TABLE t2; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'g' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'h' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT a FROM t2; +a +2011-08-01 15:11:19 +SELECT b FROM t2; +b +2011-08-01 15:11:19 +SELECT c FROM t2; +c +2011-08-01 15:11:19 +SELECT d FROM t2; +d +2011-08-01 15:11:19 +# As shown here, supplying a NULL value to a non-nullable +# column with no default value results in the zero date. +SELECT e FROM t2; +e +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable column with a +# default value results in the zero date. +SELECT f FROM t2; +f +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable column with a +# default function results in the zero date. +SELECT g FROM t2; +g +0000-00-00 00:00:00 +# As shown here, supplying a NULL value to a non-nullable DATETIME ON +# UPDATE CURRENT_TIMESTAMP column with no default value results in the +# zero date. +SELECT h FROM t2; +h +0000-00-00 00:00:00 +SELECT i FROM t2; +i +0000-00-00 00:00:00 +DELETE FROM t1; +DELETE FROM t2; +# Read t3 file into t1 +# The syntax will cause a different code path to be taken +# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command +# above. The code in this path is copy-pasted code from the path taken +# under the syntax used in the previous LOAD command. +LOAD DATA INFILE 't3.dat' INTO TABLE t1 +FIELDS TERMINATED BY '' ENCLOSED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT b FROM t1; +b +2011-08-01 15:11:19 +SELECT c FROM t1; +c +2011-08-01 15:11:19 +SELECT d FROM t1; +d +2011-08-01 15:11:19 +SELECT e FROM t1; +e +2011-08-01 15:11:19 +# Yes, a missing field cannot be NULL using this syntax, so it will +# zero date instead. Says a comment in read_fixed_length() : "No fields +# specified in fields_vars list can be NULL in this format." +# It appears to be by design. This is inconsistent with LOAD DATA INFILE +# syntax in previous test. +SELECT f FROM t1; +f +0000-00-00 00:00:00 +SELECT g FROM t1; +g +0000-00-00 00:00:00 +# See comment above "SELECT f FROM f1". +SELECT h FROM t1; +h +0000-00-00 00:00:00 +SELECT i FROM t1; +i +0000-00-00 00:00:00 +DELETE FROM t1; +LOAD DATA INFILE 't5.dat' INTO TABLE t1 ( a, @dummy ); +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2011-08-01 15:11:19 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 +SELECT @dummy; +@dummy +2 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET c = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2005-06-06 08:09:10 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 NULL 2011-08-01 15:11:19 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET g = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19 2011-08-01 15:11:19 0000-00-00 00:00:00 2011-08-01 15:11:19 NULL 2005-06-06 08:09:10 NULL 2011-08-01 15:11:19 +DELETE FROM t1; +# Load a static XML file +LOAD XML INFILE '../../std_data/onerow.xml' INTO TABLE t1 +ROWS IDENTIFIED BY ''; +Missing tags are treated as NULL +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19 +c 2011-08-01 15:11:19 +d 2011-08-01 15:11:19 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i NULL +DROP TABLE t1, t2; +# +# Similar LOAD DATA tests in another form +# +# All of this test portion has been run on a pre-WL5874 trunk +# (except that like_b and like_c didn't exist) and all result +# differences are a bug. +# Regarding like_b its definition is the same as b's except +# that the constant default is replaced with a function +# default. Our expectation is that like_b would behave +# like b: if b is set to NULL, or set to 0000-00-00, or set to +# its default, then the same should apply to like_b. Same for +# like_c vs c. +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.089786; +SELECT 1 INTO OUTFILE "file1.dat" FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE "file2.dat" FROM dual; +# Too short row +CREATE TABLE t1 ( +dummy INT, +a DATETIME NULL DEFAULT NULL, +b DATETIME NULL DEFAULT "2011-11-18", +like_b DATETIME NULL DEFAULT CURRENT_TIMESTAMP, +c DATETIME NOT NULL DEFAULT "2011-11-18", +like_c DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +g TIMESTAMP NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +# It is strange that "like_b" gets NULL when "b" gets 0. But +# this is consistent with how "a" gets NULL when "b" gets 0, +# with how "g" gets NULL when "d" gets 0, and with how "h" gets +# NULL when "i" gets 0. Looks like "DEFAULT +# " is changed to 0, whereas DEFAULT NULL +# and DEFAULT NOW are changed to NULL. +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00 +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d 0000-00-00 00:00:00 +e 2011-08-01 15:11:19 +f 2011-08-01 15:11:19 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00 +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d 0000-00-00 00:00:00 +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i 0 +delete from t1; +drop table t1; +# Conclusion derived from trunk's results: +# DATETIME DEFAULT (b,c) gets 0000-00-00, +# DATETIME DEFAULT NULL (a) gets NULL, +# TIMESTAMP NULL DEFAULT (d) gets 0000-00-00, +# TIMESTAMP NULL DEFAULT NULL (g) gets NULL, +# TIMESTAMP NULL DEFAULT NOW (f after ALTER) gets NULL, +# TIMESTAMP NOT NULL (f before ALTER, e) gets NOW. +### Loading NULL ### +CREATE TABLE t1 ( +dummy INT, +a DATETIME NULL DEFAULT NULL, +b DATETIME NULL DEFAULT "2011-11-18", +like_b DATETIME NULL DEFAULT CURRENT_TIMESTAMP, +c DATETIME NOT NULL DEFAULT "2011-11-18", +like_c DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +d TIMESTAMP NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP, +e TIMESTAMP NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +g TIMESTAMP NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d NULL +e 2011-08-01 15:11:19 +f 2011-08-01 15:11:19 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime DEFAULT NULL, + `b` datetime DEFAULT '2011-11-18 00:00:00', + `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', + `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00 +like_c 0000-00-00 00:00:00 +d NULL +e 2011-08-01 15:11:19 +f NULL +g NULL +h NULL +i 0 +delete from t1; +# Conclusion derived from trunk's results: +# DATETIME NULL (a,b) gets NULL, +# DATETIME NOT NULL (c) gets 0000-00-00, +# TIMESTAMP NULL (d,f,g) gets NULL, +# TIMESTAMP NOT NULL (e) gets NOW. +drop table t1; +# +# Test of updatable views with check options. The option can be violated +# using ON UPDATE updates which is very strange as this offers a loophole +# in this integrity check. +# +SET TIME_ZONE = "+03:00"; +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.123456; +CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE b <= '1970-01-01 03:16:40.123456' +WITH CHECK OPTION; +SELECT * FROM v1; +a b +1 1970-01-01 03:16:40 +# 1970-01-01 03:33:20 +SET TIMESTAMP = 2000.000234; +UPDATE v1 SET a = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40 +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '1973-08-14 09:11:22.089786' ON UPDATE CURRENT_TIMESTAMP, +c INT KEY +); +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1 ( c ) VALUES ( 1 ); +CREATE VIEW v1 AS +SELECT * +FROM t1 +WHERE a >= '1973-08-14 09:11:22' +WITH LOCAL CHECK OPTION; +SELECT * FROM v1; +a c +1973-08-14 09:11:22 1 +SET TIMESTAMP = 1.126789; +INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM v1; +a c +1973-08-14 09:11:22 1 +DROP VIEW v1; +DROP TABLE t1; +# +# Bug 13095459 - MULTI-TABLE UPDATE MODIFIES A ROW TWICE +# +CREATE TABLE t1 ( +a INT, +b INT, +ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +PRIMARY KEY ( a, ts ) +); +INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES ( 1 ); +UPDATE t1 STRAIGHT_JOIN t2 +SET t1.b = t1.b + 1 +WHERE t1.a = 1 AND t1.ts >= '2000-09-28 00:00:00'; +SELECT b FROM t1; +b +1 +DROP TABLE t1, t2; +# +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP NOT NULL DEFAULT NOW() FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW() FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW() AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP NOT NULL DEFAULT NOW() AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME ON UPDATE NOW() AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME DEFAULT NOW() AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME DEFAULT NOW() ON UPDATE NOW() AFTER c5; +SELECT * FROM t1; +a1 0000-00-00 00:00:00 +a2 1970-01-01 03:16:40 +a3 1970-01-01 03:16:40 +a4 NULL +a5 1970-01-01 03:16:40 +a6 1970-01-01 03:16:40 +b 1 +c1 0000-00-00 00:00:00 +c2 1970-01-01 03:16:40 +c3 1970-01-01 03:16:40 +c4 NULL +c5 1970-01-01 03:16:40 +c6 1970-01-01 03:16:40 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP, b DATETIME DEFAULT NOW() ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP NOT NULL DEFAULT '1999-12-01 11:22:33' ON UPDATE CURRENT_TIMESTAMP, +b DATETIME DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP DEFAULT NOW(); +ALTER TABLE t1 MODIFY COLUMN b DATETIME DEFAULT NOW(); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33 1999-12-01 11:22:33 +2001-09-09 04:46:40 2001-09-09 04:46:40 +DROP TABLE t1; +# +# Function defaults run 2. Six digits scale on seconds precision. +# +SET TIME_ZONE = "+00:00"; +# +# Test of errors for column data types that dont support function +# defaults. +# +CREATE TABLE t1( a BIT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TINYINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a SMALLINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a MEDIUMINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a INT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIGINT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a FLOAT DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DECIMAL DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a DATE DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a TIME DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a YEAR DEFAULT CURRENT_TIMESTAMP(6) ); +ERROR 42000: Invalid default value for 'a' +CREATE TABLE t1( a BIT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TINYINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a SMALLINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a MEDIUMINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a INT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a BIGINT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a FLOAT ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DECIMAL ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a DATE ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a TIME ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +CREATE TABLE t1( a YEAR ON UPDATE CURRENT_TIMESTAMP(6) ); +ERROR HY000: Invalid ON UPDATE clause for 'a' column +# +# Test that the default clause behaves like NOW() regarding time zones. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL, +e DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h DATETIME(6) +); +# 2011-09-27 14:11:08 UTC +SET TIMESTAMP = 1317132668.654321; +SET @old_time_zone = @@TIME_ZONE; +SET TIME_ZONE = "+05:00"; +INSERT INTO t1( d, h ) VALUES ( NOW(6), NOW(6) ); +SELECT * FROM t1; +a b c d e f g h +2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 0000-00-00 00:00:00.000000 2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 2011-09-27 19:11:08.654321 NULL 2011-09-27 19:11:08.654321 +# 1989-05-13 01:02:03 +SET TIMESTAMP = 611017323.543212; +UPDATE t1 SET d = NOW(6), h = NOW(6); +SELECT * FROM t1; +a b c d e f g h +1989-05-13 04:02:03.543212 2011-09-27 19:11:08.654321 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 2011-09-27 19:11:08.654321 1989-05-13 04:02:03.543212 1989-05-13 04:02:03.543212 +SET TIME_ZONE = @old_time_zone; +DROP TABLE t1; +# +# Test of several TIMESTAMP columns with different function defaults. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +f INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( f ) VALUES (1); +SELECT * FROM t1; +a b c d e f +2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 0000-00-00 00:00:00.000000 0000-00-00 00:00:00.000000 1 +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.132435; +UPDATE t1 SET f = 2; +SELECT * FROM t1; +a b c d e f +2011-04-19 07:23:18.132435 2011-04-19 07:23:18.132435 2011-04-19 07:22:02.534231 2011-04-19 07:23:18.132435 2011-04-19 07:23:18.132435 2 +DROP TABLE t1; +# +# Test of inserted values out of order. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +j INT +); +# 2011-04-19 07:22:02 UTC +SET TIMESTAMP = 1303197722.534231; +INSERT INTO t1 ( j, a ) VALUES ( 1, 1 ); +SELECT * FROM t1; +a b c d e f g h i j +1 2011-04-19 07:22:02.534231 2011-04-19 07:22:02.534231 0000-00-00 00:00:00.000000 NULL NULL 2011-04-19 07:22:02.534231 NULL 2011-04-19 07:22:02.534231 1 +DROP TABLE t1; +# +# Test of ON DUPLICATE KEY UPDATE +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b INT, +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +f TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +g TIMESTAMP(6) NULL, +h DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +j DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +k DATETIME(6) NULL, +l DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +# 1977-12-21 23:00:00 UTC +SET TIMESTAMP = 251593200.192837; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 NULL 1977-12-21 23:00:00.192837 1977-12-21 23:00:00.192837 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 1977-12-21 23:00:00.192837 1977-12-21 23:00:00.192837 NULL NULL 1986-09-27 03:00:00.098765 +# 1975-05-21 23:00:00 UTC +SET TIMESTAMP = 169945200.918273; +INSERT INTO t1(a) VALUES (1) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 1986-09-27 03:00:00.098765 NULL 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 NULL 1986-09-27 03:00:00.098765 +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1(a) VALUES (2) ON DUPLICATE KEY UPDATE b = 2; +SELECT * FROM t1; +a b c d e f g h i j k l +1 2 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 1986-09-27 03:00:00.098765 NULL 1975-05-21 23:00:00.918273 1977-12-21 23:00:00.192837 1975-05-21 23:00:00.918273 NULL 1986-09-27 03:00:00.098765 +2 NULL 1973-08-14 09:11:22.534231 1973-08-14 09:11:22.534231 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 1973-08-14 09:11:22.534231 1973-08-14 09:11:22.534231 NULL NULL 1986-09-27 03:00:00.098765 +DROP TABLE t1; +CREATE TABLE t1 ( a INT PRIMARY KEY, b INT, c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +# 2011-04-19 07:23:18 UTC +SET TIMESTAMP = 1303197798.945156; +INSERT INTO t1 VALUES +(1, 0, '2001-01-01 01:01:01.111111'), +(2, 0, '2002-02-02 02:02:02.222222'), +(3, 0, '2003-03-03 03:03:03.333333'); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 0 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +UPDATE t1 SET b = 2, c = c WHERE a = 2; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +INSERT INTO t1 (a) VALUES (4); +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +4 NULL 2011-04-19 07:23:18.945156 +UPDATE t1 SET c = '2004-04-04 04:04:04.444444' WHERE a = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 0 2003-03-03 03:03:03.333333 +4 NULL 2004-04-04 04:04:04.444444 +INSERT INTO t1 ( a ) VALUES ( 3 ), ( 5 ) ON DUPLICATE KEY UPDATE b = 3, c = c; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 3 2003-03-03 03:03:03.333333 +4 NULL 2004-04-04 04:04:04.444444 +5 NULL 2011-04-19 07:23:18.945156 +INSERT INTO t1 (a, c) VALUES +(4, '2004-04-04 00:00:00.444444'), +(6, '2006-06-06 06:06:06.666666') +ON DUPLICATE KEY UPDATE b = 4; +SELECT * FROM t1; +a b c +1 0 2001-01-01 01:01:01.111111 +2 2 2002-02-02 02:02:02.222222 +3 3 2003-03-03 03:03:03.333333 +4 4 2011-04-19 07:23:18.945156 +5 NULL 2011-04-19 07:23:18.945156 +6 NULL 2006-06-06 06:06:06.666666 +DROP TABLE t1; +# +# Test of REPLACE INTO executed as UPDATE. +# +CREATE TABLE t1 ( +a INT PRIMARY KEY, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +e DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +f TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h TIMESTAMP(6) NULL, +i DATETIME(6) +); +# 1970-09-21 09:11:12 UTC +SET TIMESTAMP = 22756272.163584; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 1970-09-21 09:11:12.163584 0000-00-00 00:00:00.000000 NULL NULL NULL +# 1970-11-10 14:16:17 UTC +SET TIMESTAMP = 27094577.852954; +REPLACE INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 1970-11-10 14:16:17.852954 0000-00-00 00:00:00.000000 NULL NULL NULL +DROP TABLE t1; +# +# Test of insertion of NULL, DEFAULT and an empty row for DEFAULT +# CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.163578; +INSERT INTO t1 VALUES (NULL, NULL, 1), (DEFAULT, DEFAULT, 2); +INSERT INTO t1 ( a, b, c ) VALUES (NULL, NULL, 3), (DEFAULT, DEFAULT, 4); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.163578 NULL 1 +2011-04-20 09:53:41.163578 2011-04-20 09:53:41.163578 2 +2011-04-20 09:53:41.163578 NULL 3 +2011-04-20 09:53:41.163578 2011-04-20 09:53:41.163578 4 +SET TIME_ZONE = "+03:00"; +SELECT * FROM t1; +a b c +2011-04-20 12:53:41.163578 NULL 1 +2011-04-20 12:53:41.163578 2011-04-20 09:53:41.163578 2 +2011-04-20 12:53:41.163578 NULL 3 +2011-04-20 12:53:41.163578 2011-04-20 09:53:41.163578 4 +SET TIME_ZONE = "+00:00"; +DROP TABLE t1; +# 2011-04-20 07:05:39 UTC +SET TIMESTAMP = 1303283139.195624; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '2010-10-11 12:34:56' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT '2010-10-11 12:34:56' +); +INSERT INTO t1 VALUES (NULL, NULL), (DEFAULT, DEFAULT); +INSERT INTO t1 ( a, b ) VALUES (NULL, NULL), (DEFAULT, DEFAULT); +SELECT * FROM t1; +a b +2011-04-20 07:05:39.195624 NULL +2010-10-11 12:34:56.000000 2010-10-11 12:34:56.000000 +2011-04-20 07:05:39.195624 NULL +2010-10-11 12:34:56.000000 2010-10-11 12:34:56.000000 +DROP TABLE t1; +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.136952; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) NULL, +j DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +INSERT INTO t1 SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL; +SELECT * FROM t1; +a b c d e f g h i j +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 0000-00-00 00:00:00.000000 1986-09-27 03:00:00.098765 NULL 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 NULL NULL 1986-09-27 03:00:00.098765 +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 NULL NULL NULL NULL NULL NULL +DROP TABLE t1; +# +# Test of multiple-table UPDATE for DEFAULT CURRENT_TIMESTAMP +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c INT +); +INSERT INTO t1 ( c ) VALUES (1); +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 1 +# 2011-04-20 17:06:13 UTC +SET TIMESTAMP = 1303311973.163587; +UPDATE t1 t11, t1 t12 SET t11.c = 1; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.136952 2011-04-20 09:53:41.136952 1 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13.163587 2011-04-20 09:53:41.136952 2 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +d DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +e INT +); +CREATE TABLE t2 ( +f INT, +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +h DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +i TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +j TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) +); +# 1995-03-11 00:02:03 UTC +SET TIMESTAMP = 794880123.195676; +INSERT INTO t1 ( e ) VALUES ( 1 ), ( 2 ); +INSERT INTO t2 ( f ) VALUES ( 1 ), ( 2 ); +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 NULL 1 +1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 NULL 2 +SELECT * FROM t2; +f g h i j +1 NULL 1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 +2 NULL 1995-03-11 00:02:03.195676 0000-00-00 00:00:00.000000 1995-03-11 00:02:03.195676 +# 1980-12-13 02:02:01 UTC +SET TIMESTAMP = 345520921.196755; +UPDATE t1, t2 SET t1.e = 3, t2.f = 4; +SELECT * FROM t1; +a b c d e +1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 3 +1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 3 +SELECT * FROM t2; +f g h i j +4 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 +4 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 1980-12-13 02:02:01.196755 1995-03-11 00:02:03.195676 +DROP TABLE t1, t2; +# +# Test of multiple table update with temporary table and on the fly. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT, +d INT +); +CREATE TABLE t2 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT KEY, +d INT +); +INSERT INTO t1 ( c ) VALUES (1), (2); +INSERT INTO t2 ( c ) VALUES (1), (2); +# Test of multiple table update done on the fly +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.194685; +UPDATE t1 JOIN t2 USING ( c ) SET t2.d = 1; +SELECT * FROM t1; +a b c d +0000-00-00 00:00:00.000000 NULL 1 NULL +0000-00-00 00:00:00.000000 NULL 2 NULL +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 1 1 +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 2 1 +# Test of multiple table update done with temporary table. +# 1979-01-15 03:02:01 +SET TIMESTAMP = 285213721.134679; +UPDATE t1 JOIN t2 USING ( c ) SET t1.d = 1; +SELECT * FROM t1; +a b c d +1979-01-15 02:02:01.134679 1979-01-15 02:02:01.134679 1 1 +1979-01-15 02:02:01.134679 1979-01-15 02:02:01.134679 2 1 +SELECT * FROM t2; +a b c d +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 1 1 +2011-04-20 15:06:13.194685 2011-04-20 15:06:13.194685 2 1 +DROP TABLE t1, t2; +# +# Test of ON UPDATE CURRENT_TIMESTAMP. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +c INT +); +# 2011-04-20 09:53:41 UTC +SET TIMESTAMP = 1303293221.794613; +INSERT INTO t1 ( c ) VALUES ( 1 ); +SELECT * FROM t1; +a b c +0000-00-00 00:00:00.000000 NULL 1 +UPDATE t1 SET c = 1; +SELECT * FROM t1; +a b c +0000-00-00 00:00:00.000000 NULL 1 +UPDATE t1 SET c = 2; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +# +# Test that ON UPDATE CURRENT_TIMESTAMP works after non-changing UPDATE. +# +# 2011-04-20 09:54:13 UTC +SET TIMESTAMP = 1303293253.794613; +UPDATE t1 SET c = 2, b = '2011-04-20 09:53:41.794613'; +SELECT * FROM t1; +a b c +2011-04-20 09:53:41.794613 2011-04-20 09:53:41.794613 2 +UPDATE t1 SET c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +# +# Test of multiple-table UPDATE for ON UPDATE CURRENT_TIMESTAMP +# +# 2011-04-20 15:06:13 UTC +SET TIMESTAMP = 1303311973.534231; +UPDATE t1 t11, t1 t12 SET t11.c = 3; +SELECT * FROM t1; +a b c +2011-04-20 09:54:13.794613 2011-04-20 09:54:13.794613 3 +UPDATE t1 t11, t1 t12 SET t11.c = 2; +SELECT * FROM t1; +a b c +2011-04-20 15:06:13.534231 2011-04-20 15:06:13.534231 2 +DROP TABLE t1; +# +# Test of a multiple-table update where only one table is updated and +# the updated table has a primary key. +# +CREATE TABLE t1 ( a INT, b INT, PRIMARY KEY (a) ); +INSERT INTO t1 VALUES (1, 1),(2, 2),(3, 3),(4, 4); +CREATE TABLE t2 ( a INT, b INT ); +INSERT INTO t2 VALUES (1, 1),(2, 2),(3, 3),(4, 4),(5, 5); +UPDATE t1, t2 SET t1.b = 100 WHERE t1.a = t2.a; +SELECT * FROM t1; +a b +1 100 +2 100 +3 100 +4 100 +SELECT * FROM t2; +a b +1 1 +2 2 +3 3 +4 4 +5 5 +DROP TABLE t1, t2; +# +# Test of ALTER TABLE, reordering columns. +# +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), b TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6), b INT, c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL, + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 MODIFY a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6) AFTER b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `c` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b INT, c TIMESTAMP(6) NULL ); +ALTER TABLE t1 MODIFY c TIMESTAMP(6) NULL FIRST; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` timestamp(6) NULL DEFAULT NULL, + `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of ALTER TABLE, adding columns. +# +CREATE TABLE t1 ( a INT ); +ALTER TABLE t1 ADD COLUMN b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Test of INSERT SELECT. +# +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +d DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( +placeholder1 INT, +placeholder2 INT, +placeholder3 INT, +placeholder4 INT, +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00', +c DATETIME(6), +d DATETIME(6) +); +# 1977-08-16 15:30:01 UTC +SET TIMESTAMP = 240589801.654312; +INSERT INTO t2 (a, b, c, d) VALUES ( +'1977-08-16 15:30:01.123456', +'1977-08-16 15:30:01.234567', +'1977-08-16 15:30:01.345678', +'1977-08-16 15:30:01.456789' +); +# 1986-09-27 01:00:00 UTC +SET TIMESTAMP = 528166800.132435; +INSERT INTO t1 ( a, c ) SELECT a, c FROM t2; +SELECT * FROM t1; +a b c d +1977-08-16 15:30:01.123456 1986-09-27 01:00:00.132435 1977-08-16 15:30:01.345678 1986-09-27 01:00:00.132435 +DROP TABLE t1, t2; +# +# Test of CREATE TABLE SELECT. +# +# We test that the columns of the source table are not used to determine +# function defaults for the receiving table. +# +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.657898; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) NULL, +j DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.164937; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57.657897 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57.657897 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +0000-00-00 00:00:00.000000 +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +1986-09-27 03:00:00.098765 +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` timestamp(6) NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +NULL +CREATE TABLE t7 SELECT f FROM t1; +SHOW CREATE TABLE t7; +Table Create Table +t7 CREATE TABLE `t7` ( + `f` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t7; +f +1970-04-11 20:13:57.657897 +CREATE TABLE t8 SELECT g FROM t1; +SHOW CREATE TABLE t8; +Table Create Table +t8 CREATE TABLE `t8` ( + `g` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t8; +g +1970-04-11 20:13:57.657897 +CREATE TABLE t9 SELECT h FROM t1; +SHOW CREATE TABLE t9; +Table Create Table +t9 CREATE TABLE `t9` ( + `h` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t9; +h +NULL +CREATE TABLE t10 SELECT i FROM t1; +SHOW CREATE TABLE t10; +Table Create Table +t10 CREATE TABLE `t10` ( + `i` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t10; +i +NULL +CREATE TABLE t11 SELECT j FROM t1; +SHOW CREATE TABLE t11; +Table Create Table +t11 CREATE TABLE `t11` ( + `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t11; +j +1986-09-27 03:00:00.098765 +CREATE TABLE t12 ( +k TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +l TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +m TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +n TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +o TIMESTAMP(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', +p TIMESTAMP(6) NULL, +q DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +r DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +s DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +t DATETIME(6) NULL, +u DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +) +SELECT * FROM t1; +SHOW CREATE TABLE t12; +Table Create Table +t12 CREATE TABLE `t12` ( + `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', + `p` timestamp(6) NULL DEFAULT NULL, + `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `t` datetime(6) DEFAULT NULL, + `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `b` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', + `e` timestamp(6) NULL DEFAULT NULL, + `f` datetime(6) DEFAULT NULL, + `g` datetime(6) DEFAULT NULL, + `h` datetime(6) DEFAULT NULL, + `i` datetime(6) DEFAULT NULL, + `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12; +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.164953; +CREATE TABLE t1 ( +a DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +d DATETIME(6) NULL, +e DATETIME(6) DEFAULT '1986-09-27 03:00:00.098765' +); +INSERT INTO t1 VALUES (); +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.915736; +CREATE TABLE t2 SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t2; +a +1970-04-11 20:13:57.164953 +CREATE TABLE t3 SELECT b FROM t1; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `b` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t3; +b +1970-04-11 20:13:57.164953 +CREATE TABLE t4 SELECT c FROM t1; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `c` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t4; +c +NULL +CREATE TABLE t5 SELECT d FROM t1; +SHOW CREATE TABLE t5; +Table Create Table +t5 CREATE TABLE `t5` ( + `d` datetime(6) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t5; +d +NULL +CREATE TABLE t6 SELECT e FROM t1; +SHOW CREATE TABLE t6; +Table Create Table +t6 CREATE TABLE `t6` ( + `e` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t6; +e +1986-09-27 03:00:00.098765 +DROP TABLE t1, t2, t3, t4, t5, t6; +# +# Test of a CREATE TABLE SELECT that also declared columns. In this case +# the function default should be de-activated during the execution of the +# CREATE TABLE statement. +# +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.987654; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES ( 1 ), ( 2 ); +CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)) SELECT a FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET TIMESTAMP = 2000.876543; +INSERT INTO t2( a ) VALUES ( 3 ); +SELECT * FROM t2; +b a +0000-00-00 00:00:00.000000 1 +0000-00-00 00:00:00.000000 2 +1970-01-01 00:33:20.876543 3 +DROP TABLE t1, t2; +# +# Test of updating a view. +# +CREATE TABLE t1 ( a INT, b DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ); +CREATE TABLE t2 ( a INT, b DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci +CREATE VIEW v2 AS SELECT * FROM t2; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a`,`t2`.`b` AS `b` from `t2` latin1 latin1_swedish_ci +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.348564; +INSERT INTO v1 ( a ) VALUES ( 1 ); +INSERT INTO v2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1971-01-31 20:13:57.348564 +SELECT * FROM v1; +a b +1 1971-01-31 20:13:57.348564 +SELECT * FROM t2; +a b +1 NULL +SELECT * FROM v2; +a b +1 NULL +# 1970-04-11 20:13:57 UTC +SET TIMESTAMP = 8712837.567332; +UPDATE v1 SET a = 2; +UPDATE v2 SET a = 2; +SELECT * FROM t1; +a b +2 1971-01-31 20:13:57.348564 +SELECT * FROM v1; +a b +2 1971-01-31 20:13:57.348564 +SELECT * FROM t2; +a b +2 1970-04-11 20:13:57.567332 +SELECT * FROM v2; +a b +2 1970-04-11 20:13:57.567332 +DROP VIEW v1, v2; +DROP TABLE t1, t2; +# +# Test with stored procedures. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +g DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE PROCEDURE p1() INSERT INTO test.t1( a ) VALUES ( 1 ); +CREATE PROCEDURE p2() UPDATE t1 SET a = 2 WHERE a = 1; +# 1971-01-31 20:13:57 UTC +SET TIMESTAMP = 34200837.876544; +CALL p1(); +SELECT * FROM t1; +a b c d e f g +1 1971-01-31 20:13:57.876544 1971-01-31 20:13:57.876544 0000-00-00 00:00:00.000000 NULL 1971-01-31 20:13:57.876544 NULL +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.143546; +CALL p2(); +SELECT * FROM t1; +a b c d e f g +2 1970-04-11 20:13:57.143546 1971-01-31 20:13:57.876544 1970-04-11 20:13:57.143546 NULL 1971-01-31 20:13:57.876544 1970-04-11 20:13:57.143546 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP TABLE t1; +# +# Test with triggers. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NULL, +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( a INT ); +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +INSERT INTO t1 ( a ) VALUES ( 1 ); +END| +# 1971-01-31 21:13:57 UTC +SET TIMESTAMP = 34200837.978675; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +1 1971-01-31 20:13:57.978675 1971-01-31 20:13:57.978675 0000-00-00 00:00:00.000000 NULL NULL 1971-01-31 20:13:57.978675 NULL 1971-01-31 20:13:57.978675 +DROP TRIGGER t2_trg; +CREATE TRIGGER t2_trg BEFORE INSERT ON t2 FOR EACH ROW +BEGIN +UPDATE t1 SET a = 2; +END| +# 1970-04-11 21:13:57 UTC +SET TIMESTAMP = 8712837.456789; +INSERT INTO t2 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b c d e f g h i +2 1970-04-11 20:13:57.456789 1971-01-31 20:13:57.978675 1970-04-11 20:13:57.456789 NULL NULL 1971-01-31 20:13:57.978675 1970-04-11 20:13:57.456789 1970-04-11 20:13:57.456789 +DROP TABLE t1, t2; +# +# Test where the assignment target is not a column. +# +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t2 ( a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t3 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE TABLE t4 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6) ); +CREATE VIEW v1 AS SELECT a COLLATE latin1_german1_ci AS b FROM t1; +CREATE VIEW v2 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t2; +CREATE VIEW v3 AS SELECT a COLLATE latin1_german1_ci AS b FROM t3; +CREATE VIEW v4 ( b ) AS SELECT a COLLATE latin1_german1_ci FROM t4; +INSERT INTO v1 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t1; +a +2007-10-24 00:03:34.010203 +INSERT INTO v2 ( b ) VALUES ( '2007-10-24 00:03:34.010203' ); +SELECT a FROM t2; +a +2007-10-24 00:03:34.010203 +INSERT INTO t3 VALUES (); +UPDATE v3 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t3; +a +2007-10-24 00:03:34.010203 +INSERT INTO t4 VALUES (); +UPDATE v4 SET b = '2007-10-24 00:03:34.010203'; +SELECT a FROM t4; +a +2007-10-24 00:03:34.010203 +DROP VIEW v1, v2, v3, v4; +DROP TABLE t1, t2, t3, t4; +# +# Test of LOAD DATA/XML INFILE +# This tests behavior of function defaults for TIMESTAMP and DATETIME +# columns. during LOAD ... INFILE. +# As can be seen here, a TIMESTAMP column with only ON UPDATE +# CURRENT_TIMESTAMP will still have CURRENT_TIMESTAMP inserted on LOAD +# ... INFILE if the value is missing. For DATETIME columns a NULL value +# is inserted instead. +# +CREATE TABLE t1 ( +a INT, +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +f DATETIME(6), +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6), +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6), +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +); +CREATE TABLE t2 ( +a TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +c TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +e DATETIME(6) NOT NULL, +f DATETIME(6) NOT NULL DEFAULT '1977-01-02 12:13:14', +g DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) NOT NULL, +h DATETIME(6) ON UPDATE CURRENT_TIMESTAMP(6) NOT NULL, +i DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) NOT NULL +); +SELECT 1 INTO OUTFILE 't3.dat' FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE 't4.dat' +FROM dual; +SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.918273; +LOAD DATA INFILE 't3.dat' INTO TABLE t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19.918273 +c 2011-08-01 15:11:19.918273 +d 2011-08-01 15:11:19.918273 +e 2011-08-01 15:11:19.918273 +f NULL +g NULL +h NULL +i NULL +LOAD DATA INFILE 't4.dat' INTO TABLE t2; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'e' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'f' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'g' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'h' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT a FROM t2; +a +2011-08-01 15:11:19.918273 +SELECT b FROM t2; +b +2011-08-01 15:11:19.918273 +SELECT c FROM t2; +c +2011-08-01 15:11:19.918273 +SELECT d FROM t2; +d +2011-08-01 15:11:19.918273 +# As shown here, supplying a NULL value to a non-nullable +# column with no default value results in the zero date. +SELECT e FROM t2; +e +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable column with a +# default value results in the zero date. +SELECT f FROM t2; +f +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable column with a +# default function results in the zero date. +SELECT g FROM t2; +g +0000-00-00 00:00:00.000000 +# As shown here, supplying a NULL value to a non-nullable DATETIME ON +# UPDATE CURRENT_TIMESTAMP column with no default value results in the +# zero date. +SELECT h FROM t2; +h +0000-00-00 00:00:00.000000 +SELECT i FROM t2; +i +0000-00-00 00:00:00.000000 +DELETE FROM t1; +DELETE FROM t2; +# Read t3 file into t1 +# The syntax will cause a different code path to be taken +# (read_fixed_length()) than under the LOAD ... INTO TABLE t1 command +# above. The code in this path is copy-pasted code from the path taken +# under the syntax used in the previous LOAD command. +LOAD DATA INFILE 't3.dat' INTO TABLE t1 +FIELDS TERMINATED BY '' ENCLOSED BY ''; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT b FROM t1; +b +2011-08-01 15:11:19.918273 +SELECT c FROM t1; +c +2011-08-01 15:11:19.918273 +SELECT d FROM t1; +d +2011-08-01 15:11:19.918273 +SELECT e FROM t1; +e +2011-08-01 15:11:19.918273 +# Yes, a missing field cannot be NULL using this syntax, so it will +# zero date instead. Says a comment in read_fixed_length() : "No fields +# specified in fields_vars list can be NULL in this format." +# It appears to be by design. This is inconsistent with LOAD DATA INFILE +# syntax in previous test. +SELECT f FROM t1; +f +0000-00-00 00:00:00.000000 +SELECT g FROM t1; +g +0000-00-00 00:00:00.000000 +# See comment above "SELECT f FROM f1". +SELECT h FROM t1; +h +0000-00-00 00:00:00.000000 +SELECT i FROM t1; +i +0000-00-00 00:00:00.000000 +DELETE FROM t1; +LOAD DATA INFILE 't5.dat' INTO TABLE t1 ( a, @dummy ); +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2011-08-01 15:11:19.918273 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 +SELECT @dummy; +@dummy +2 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET c = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2005-06-06 08:09:10.000000 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 NULL 2011-08-01 15:11:19.918273 +DELETE FROM t1; +LOAD DATA INFILE 't3.dat' INTO TABLE t1 ( a ) SET g = '2005-06-06 08:09:10'; +SELECT * FROM t1; +a b c d e f g h i +1 2011-08-01 15:11:19.918273 2011-08-01 15:11:19.918273 0000-00-00 00:00:00.000000 2011-08-01 15:11:19.918273 NULL 2005-06-06 08:09:10.000000 NULL 2011-08-01 15:11:19.918273 +DELETE FROM t1; +# Load a static XML file +LOAD XML INFILE '../../std_data/onerow.xml' INTO TABLE t1 +ROWS IDENTIFIED BY ''; +Missing tags are treated as NULL +SELECT * FROM t1; +a 1 +b 2011-08-01 15:11:19.918273 +c 2011-08-01 15:11:19.918273 +d 2011-08-01 15:11:19.918273 +e 2011-08-01 15:11:19.918273 +f NULL +g NULL +h NULL +i NULL +DROP TABLE t1, t2; +# +# Similar LOAD DATA tests in another form +# +# All of this test portion has been run on a pre-WL5874 trunk +# (except that like_b and like_c didn't exist) and all result +# differences are a bug. +# Regarding like_b its definition is the same as b's except +# that the constant default is replaced with a function +# default. Our expectation is that like_b would behave +# like b: if b is set to NULL, or set to 0000-00-00, or set to +# its default, then the same should apply to like_b. Same for +# like_c vs c. +# Mon Aug 1 15:11:19 2011 UTC +SET TIMESTAMP = 1312211479.089786; +SELECT 1 INTO OUTFILE "file1.dat" FROM dual; +SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +INTO OUTFILE "file2.dat" FROM dual; +# Too short row +CREATE TABLE t1 ( +dummy INT, +a DATETIME(6) NULL DEFAULT NULL, +b DATETIME(6) NULL DEFAULT "2011-11-18", +like_b DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) NOT NULL DEFAULT "2011-11-18", +like_c DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +g TIMESTAMP(6) NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +# It is strange that "like_b" gets NULL when "b" gets 0. But +# this is consistent with how "a" gets NULL when "b" gets 0, +# with how "g" gets NULL when "d" gets 0, and with how "h" gets +# NULL when "i" gets 0. Looks like "DEFAULT +# " is changed to 0, whereas DEFAULT NULL +# and DEFAULT NOW are changed to NULL. +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00.000000 +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d 0000-00-00 00:00:00.000000 +e 2011-08-01 15:11:19.089786 +f 2011-08-01 15:11:19.089786 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file1.dat" INTO table t1; +Warnings: +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +Warning 1261 Row 1 doesn't contain data for all columns +SELECT * FROM t1; +dummy 1 +a NULL +b 0000-00-00 00:00:00.000000 +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d 0000-00-00 00:00:00.000000 +e 2011-08-01 15:11:19.089786 +f NULL +g NULL +h NULL +i 0 +delete from t1; +drop table t1; +# Conclusion derived from trunk's results: +# DATETIME DEFAULT (b,c) gets 0000-00-00, +# DATETIME DEFAULT NULL (a) gets NULL, +# TIMESTAMP NULL DEFAULT (d) gets 0000-00-00, +# TIMESTAMP NULL DEFAULT NULL (g) gets NULL, +# TIMESTAMP NULL DEFAULT NOW (f after ALTER) gets NULL, +# TIMESTAMP NOT NULL (f before ALTER, e) gets NOW. +### Loading NULL ### +CREATE TABLE t1 ( +dummy INT, +a DATETIME(6) NULL DEFAULT NULL, +b DATETIME(6) NULL DEFAULT "2011-11-18", +like_b DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6), +c DATETIME(6) NOT NULL DEFAULT "2011-11-18", +like_c DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +d TIMESTAMP(6) NULL DEFAULT "2011-05-03" ON UPDATE CURRENT_TIMESTAMP(6), +e TIMESTAMP(6) NOT NULL DEFAULT "2011-05-03", +f TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), +g TIMESTAMP(6) NULL DEFAULT NULL, +h INT NULL, +i INT NOT NULL DEFAULT 42 +); +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d NULL +e 2011-08-01 15:11:19.089786 +f 2011-08-01 15:11:19.089786 +g NULL +h NULL +i 0 +delete from t1; +alter table t1 +modify f TIMESTAMP NULL default CURRENT_TIMESTAMP; +# There is no promotion +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `dummy` int(11) DEFAULT NULL, + `a` datetime(6) DEFAULT NULL, + `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', + `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', + `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', + `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `g` timestamp(6) NULL DEFAULT NULL, + `h` int(11) DEFAULT NULL, + `i` int(11) NOT NULL DEFAULT '42' +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +LOAD DATA INFILE "file2.dat" INTO table t1; +Warnings: +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'like_c' at row 1 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'i' at row 1 +SELECT * FROM t1; +dummy NULL +a NULL +b NULL +like_b NULL +c 0000-00-00 00:00:00.000000 +like_c 0000-00-00 00:00:00.000000 +d NULL +e 2011-08-01 15:11:19.089786 +f NULL +g NULL +h NULL +i 0 +delete from t1; +# Conclusion derived from trunk's results: +# DATETIME NULL (a,b) gets NULL, +# DATETIME NOT NULL (c) gets 0000-00-00, +# TIMESTAMP NULL (d,f,g) gets NULL, +# TIMESTAMP NOT NULL (e) gets NOW. +drop table t1; +# +# Test of updatable views with check options. The option can be violated +# using ON UPDATE updates which is very strange as this offers a loophole +# in this integrity check. +# +SET TIME_ZONE = "+03:00"; +# 1970-01-01 03:16:40 +SET TIMESTAMP = 1000.123456; +CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1 ( a ) VALUES ( 1 ); +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40.123456 +CREATE VIEW v1 AS SELECT * FROM t1 WHERE b <= '1970-01-01 03:16:40.123456' +WITH CHECK OPTION; +SELECT * FROM v1; +a b +1 1970-01-01 03:16:40.123456 +# 1970-01-01 03:33:20 +SET TIMESTAMP = 2000.000234; +UPDATE v1 SET a = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM t1; +a b +1 1970-01-01 03:16:40.123456 +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '1973-08-14 09:11:22.089786' ON UPDATE CURRENT_TIMESTAMP(6), +c INT KEY +); +# 1973-08-14 09:11:22 UTC +SET TIMESTAMP = 114167482.534231; +INSERT INTO t1 ( c ) VALUES ( 1 ); +CREATE VIEW v1 AS +SELECT * +FROM t1 +WHERE a >= '1973-08-14 09:11:22' +WITH LOCAL CHECK OPTION; +SELECT * FROM v1; +a c +1973-08-14 09:11:22.089786 1 +SET TIMESTAMP = 1.126789; +INSERT INTO v1 ( c ) VALUES ( 1 ) ON DUPLICATE KEY UPDATE c = 2; +ERROR HY000: CHECK OPTION failed 'test.v1' +SELECT * FROM v1; +a c +1973-08-14 09:11:22.089786 1 +DROP VIEW v1; +DROP TABLE t1; +# +# Bug 13095459 - MULTI-TABLE UPDATE MODIFIES A ROW TWICE +# +CREATE TABLE t1 ( +a INT, +b INT, +ts TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), +PRIMARY KEY ( a, ts ) +); +INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' ); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES ( 1 ); +UPDATE t1 STRAIGHT_JOIN t2 +SET t1.b = t1.b + 1 +WHERE t1.a = 1 AND t1.ts >= '2000-09-28 00:00:00'; +SELECT b FROM t1; +b +1 +DROP TABLE t1, t2; +# +# Bug#11745578: 17392: ALTER TABLE ADD COLUMN TIMESTAMP DEFAULT +# CURRENT_TIMESTAMP INSERTS ZERO +# +SET timestamp = 1000; +CREATE TABLE t1 ( b INT ); +INSERT INTO t1 VALUES (1); +ALTER TABLE t1 ADD COLUMN a6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a5 DATETIME(6) DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a4 DATETIME(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a3 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a2 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN a1 TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6) FIRST; +ALTER TABLE t1 ADD COLUMN c1 TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE NOW(6) AFTER b; +ALTER TABLE t1 ADD COLUMN c2 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) AFTER c1; +ALTER TABLE t1 ADD COLUMN c3 TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c2; +ALTER TABLE t1 ADD COLUMN c4 DATETIME(6) ON UPDATE NOW(6) AFTER c3; +ALTER TABLE t1 ADD COLUMN c5 DATETIME(6) DEFAULT NOW(6) AFTER c4; +ALTER TABLE t1 ADD COLUMN c6 DATETIME(6) DEFAULT NOW(6) ON UPDATE NOW(6) AFTER c5; +SELECT * FROM t1; +a1 0000-00-00 00:00:00.000000 +a2 1970-01-01 03:16:40.000000 +a3 1970-01-01 03:16:40.000000 +a4 NULL +a5 1970-01-01 03:16:40.000000 +a6 1970-01-01 03:16:40.000000 +b 1 +c1 0000-00-00 00:00:00.000000 +c2 1970-01-01 03:16:40.000000 +c3 1970-01-01 03:16:40.000000 +c4 NULL +c5 1970-01-01 03:16:40.000000 +c6 1970-01-01 03:16:40.000000 +DROP TABLE t1; +CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMESTAMP(6), b DATETIME(6) DEFAULT NOW(6) ); +INSERT INTO t1 VALUES (); +SET timestamp = 1000000000; +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(3) DEFAULT CURRENT_TIMESTAMP(3); +SELECT * FROM t1; +a b +1970-01-01 03:16:40.000 1970-01-01 03:16:40.000 +DROP TABLE t1; +CREATE TABLE t1 ( +a TIMESTAMP(6) NOT NULL DEFAULT '1999-12-01 11:22:33' ON UPDATE CURRENT_TIMESTAMP(6), +b DATETIME(6) DEFAULT '1999-12-01 11:22:33' +); +INSERT INTO t1 VALUES (); +ALTER TABLE t1 MODIFY COLUMN a TIMESTAMP(6) DEFAULT NOW(6); +ALTER TABLE t1 MODIFY COLUMN b DATETIME(6) DEFAULT NOW(6); +INSERT INTO t1 VALUES (); +SELECT * FROM t1; +a b +1999-12-01 11:22:33.000000 1999-12-01 11:22:33.000000 +2001-09-09 04:46:40.000000 2001-09-09 04:46:40.000000 +DROP TABLE t1; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index a1d2ec862b7..4b7a9a5dc0c 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1557,6 +1557,12 @@ Warnings: Warning 1300 Invalid utf8 character string: 'E043' Warning 1300 Invalid utf8 character string: 'E043' drop table t1; +# +# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +# +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); +st_within(GeomFromText('Polygon((0 0))'), Point(0,0)) +1 End of 5.3 tests # # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 643849f36ed..0858198694b 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2483,6 +2483,17 @@ test 2 SET sql_mode=''; # +# MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key +# +CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (6,'b'); +CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p'); +SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 ) +WHERE t1a.c1 = c2 GROUP BY i2; +i2 +DROP TABLE t1,t2; +# # Bug #58782 # Missing rows with SELECT .. WHERE .. IN subquery # with full GROUP BY and no aggr diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 06a8a8a06b8..9421ea9e740 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2129,10 +2129,11 @@ Warnings: Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` create table t4 as select distinct a1, a2, b, c from t1; alter table t4 add unique index idxt4 (a1, a2, b, c); +# This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: explain select a1, a2, b, min(c) from t4 group by a1, a2, b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t4 index NULL idxt4 163 NULL 64 Using index +1 SIMPLE t4 range NULL idxt4 147 NULL 10 Using index for group-by select a1, a2, b, min(c) from t4 group by a1, a2, b; a1 a2 b min(c) a a a a111 @@ -2355,7 +2356,7 @@ CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c)); INSERT INTO t2 SELECT a,b,b FROM t1; explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref PRIMARY PRIMARY 8 const,const 1 Using where; Using index +1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 1 Using where; Using index for group-by SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a; MIN(c) 2 @@ -3686,3 +3687,43 @@ a b 3 2 3 3 drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +# +CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,' 2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,' 2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,' 2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,' 2001-01-04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +id MIN(a) MAX(a) +1 2001-01-04 2001-01-04 +2 2001-01-04 2001-01-04 +3 2001-01-04 2001-01-04 +4 2001-01-04 2001-01-04 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result index f3511b0ad4a..77c74fbc041 100644 --- a/mysql-test/r/group_min_max_innodb.result +++ b/mysql-test/r/group_min_max_innodb.result @@ -174,7 +174,7 @@ F 17 EXPLAIN SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range k1 k1 5 NULL 2 Using where; Using index +1 SIMPLE t1 range k1 k1 5 NULL 1 Using where; Using index for group-by SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 ) GROUP BY c1; c1 max(i2) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 11ef1acc18f..f0220e7c043 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -803,7 +803,7 @@ drop view a2, a1; drop table t_crashme; select table_schema,table_name, column_name from information_schema.columns -where data_type = 'longtext'; +where data_type = 'longtext' and table_schema != 'performance_schema'; table_schema table_name column_name information_schema ALL_PLUGINS PLUGIN_DESCRIPTION information_schema COLUMNS COLUMN_DEFAULT @@ -821,14 +821,6 @@ information_schema ROUTINES ROUTINE_COMMENT information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION -performance_schema events_statements_current SQL_TEXT -performance_schema events_statements_current DIGEST_TEXT -performance_schema events_statements_history SQL_TEXT -performance_schema events_statements_history DIGEST_TEXT -performance_schema events_statements_history_long SQL_TEXT -performance_schema events_statements_history_long DIGEST_TEXT -performance_schema events_statements_summary_by_digest DIGEST_TEXT -performance_schema threads PROCESSLIST_INFO select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%'; table_name column_name data_type @@ -1580,7 +1572,9 @@ show open tables where f1()=0; drop table t1; drop function f1; select * from information_schema.tables where 1=sleep(100000); +Got one of the listed errors select * from information_schema.columns where 1=sleep(100000); +Got one of the listed errors explain select count(*) from information_schema.tables; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result index bcee428bc57..99ed73a3e83 100644 --- a/mysql-test/r/innodb_mrr_cpk.result +++ b/mysql-test/r/innodb_mrr_cpk.result @@ -145,11 +145,47 @@ select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100; a b c filler a b set optimizer_switch='index_condition_pushdown=on'; drop table t1,t2; -set @@join_cache_level= @save_join_cache_level; -set storage_engine=@save_storage_engine; -set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; # +# MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read() +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk varchar(32) character set utf8 primary key, +kp1 char(32) not null, +col1 varchar(32), +key (kp1) +) engine=innodb; +insert into t1 +select +concat('pk-', 1000 +A.a), +concat('kp1-', 1000 +A.a), +concat('val-', 1000 +A.a) +from test.t0 A ; +create table t2 as select kp1 as a from t1; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +explain +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 10 +1 SIMPLE t1 ref kp1 kp1 32 test.t2.a 1 Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +a pk kp1 col1 +kp1-1000 pk-1000 kp1-1000 val-1000 +kp1-1001 pk-1001 kp1-1001 val-1001 +kp1-1002 pk-1002 kp1-1002 val-1002 +kp1-1003 pk-1003 kp1-1003 val-1003 +kp1-1004 pk-1004 kp1-1004 val-1004 +kp1-1005 pk-1005 kp1-1005 val-1005 +kp1-1006 pk-1006 kp1-1006 val-1006 +kp1-1007 pk-1007 kp1-1007 val-1007 +kp1-1008 pk-1008 kp1-1008 val-1008 +kp1-1009 pk-1009 kp1-1009 val-1009 +drop table t0,t1,t2; +# +# # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions # set @tmp_mdev3817=@@optimizer_switch; @@ -194,3 +230,9 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t2 ALL NULL NULL NULL NULL # set join_cache_level= @tmp_mdev5037; drop table t0,t1,t2; +# +# This must be at the end: +# +set @@join_cache_level= @save_join_cache_level; +set storage_engine=@save_storage_engine; +set optimizer_switch=@innodb_mrr_cpk_tmp; diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index 253fb61dc27..456e17a91f7 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -498,8 +498,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) 1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -576,8 +576,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -654,8 +654,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) 1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -732,8 +732,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index e303c288552..40abc197a36 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -2222,4 +2222,27 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# Bug mdev-6705: wrong on expression after constant row substitution +# that triggers a simplification of WHERE condition +# +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +a b c d +DROP TABLE t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index beea0daa1fa..81395612269 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -2233,6 +2233,29 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`i2` = `test`.`t1`.`i1`) and (`test`.`t3`.`i3` = `test`.`t1`.`i1`))) where ((`test`.`t3`.`d3` = 0) or isnull(`test`.`t3`.`d3`)) DROP TABLE t1,t2,t3; +# +# Bug mdev-6705: wrong on expression after constant row substitution +# that triggers a simplification of WHERE condition +# +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`d` = 10)) where ((`test`.`t2`.`c` = 8) and (`test`.`t3`.`d` = 8)) +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a +WHERE b IN (1,2,3) OR b = d; +a b c d +DROP TABLE t1,t2,t3; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/r/log_errchk.result b/mysql-test/r/log_errchk.result new file mode 100644 index 00000000000..407fba2323e --- /dev/null +++ b/mysql-test/r/log_errchk.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("Could not use"); +# Case 1: Setting fife file to general_log_file and slow_query_log_file +# system variable. +SET GLOBAL general_log_file="MYSQLTEST_VARDIR/tmp/general_log.fifo";; +ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/general_log.fifo' +SET GLOBAL slow_query_log_file="MYSQLTEST_VARDIR/tmp/slow_log.fifo";; +ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'MYSQLTEST_VARDIR/tmp/slow_log.fifo' +# Case 2: Starting server with fifo file as general log file +# and slow query log file. +Setting fifo file as general log file and slow query log failed. diff --git a/mysql-test/r/log_tables_upgrade.result b/mysql-test/r/log_tables_upgrade.result index 9900f6d6b5a..a609b222d53 100644 --- a/mysql-test/r/log_tables_upgrade.result +++ b/mysql-test/r/log_tables_upgrade.result @@ -11,7 +11,7 @@ Table Op Msg_type Msg_text test.bug49823 repair status OK RENAME TABLE general_log TO renamed_general_log; RENAME TABLE test.bug49823 TO general_log; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -43,9 +43,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -53,6 +53,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK DROP TABLE general_log; RENAME TABLE renamed_general_log TO general_log; diff --git a/mysql-test/r/mysql_upgrade-6984.result b/mysql-test/r/mysql_upgrade-6984.result new file mode 100644 index 00000000000..6ae995cd030 --- /dev/null +++ b/mysql-test/r/mysql_upgrade-6984.result @@ -0,0 +1,58 @@ +update mysql.user set password=password("foo") where user='root'; +Phase 1/5: Checking mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.index_stats OK +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.user OK + +Repairing tables +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables +Processing databases +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +test +Phase 5/5: Running 'FLUSH PRIVILEGES'... +OK +update mysql.user set password='' where user='root'; +flush privileges; diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 1cc448b3ba2..64c2c0222fc 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -1,5 +1,5 @@ Run mysql_upgrade once -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -30,9 +30,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -40,11 +40,12 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK Run it again - should say already completed This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade Force should run it regardless of wether it's been run before -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -75,9 +76,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -85,11 +86,12 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; GRANT ALL ON *.* TO mysqltest1@'%'; Run mysql_upgrade with password protected account -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -120,9 +122,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -130,6 +132,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK DROP USER mysqltest1@'%'; Version check failed. Got the following error when calling the 'mysql' command line client @@ -139,7 +142,7 @@ Run mysql_upgrade with a non existing server socket mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect FATAL ERROR: Upgrade failed set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -170,9 +173,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -180,6 +183,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK set GLOBAL sql_mode=default; # @@ -190,7 +194,7 @@ CREATE PROCEDURE testproc() BEGIN END; UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc'; UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc'; UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc'; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -221,9 +225,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -231,6 +235,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK CALL testproc(); DROP PROCEDURE testproc; @@ -244,7 +249,7 @@ WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; Run mysql_upgrade with all privileges on a user -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -275,9 +280,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -285,6 +290,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SHOW GRANTS FOR 'user3'@'%'; Grants for user3@% @@ -293,7 +299,7 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' DROP USER 'user3'@'%'; End of 5.1 tests The --upgrade-system-tables option was used, user tables won't be touched. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -324,7 +330,8 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION @@ -332,7 +339,7 @@ OK # # Droping the previously created mysql_upgrade_info file.. # Running mysql_upgrade with --skip-write-binlog.. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -363,9 +370,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -373,6 +380,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK # # MDEV-4332 Increase username length from 16 characters @@ -386,7 +394,7 @@ GRANT INSERT ON mysql.user TO very_long_user_name_number_2; GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1; GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2; CREATE PROCEDURE test.pr() BEGIN END; -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -417,9 +425,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -427,6 +435,7 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr'; definer diff --git a/mysql-test/r/mysql_upgrade_no_innodb.result b/mysql-test/r/mysql_upgrade_no_innodb.result index 320dcfe5d3b..e65c6ae05f7 100644 --- a/mysql-test/r/mysql_upgrade_no_innodb.result +++ b/mysql-test/r/mysql_upgrade_no_innodb.result @@ -1,5 +1,5 @@ The --upgrade-system-tables option was used, user tables won't be touched. -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -42,5 +42,6 @@ error : Corrupt mysql.innodb_table_stats Error : Unknown storage engine 'InnoDB' error : Corrupt -Phase 2/4: Running 'mysql_fix_privilege_tables'... +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK diff --git a/mysql-test/r/mysql_upgrade_ssl.result b/mysql-test/r/mysql_upgrade_ssl.result index 14671aa6409..1bbee22aba2 100644 --- a/mysql-test/r/mysql_upgrade_ssl.result +++ b/mysql-test/r/mysql_upgrade_ssl.result @@ -1,7 +1,7 @@ # # Bug#55672 mysql_upgrade dies with internal error # -Phase 1/4: Checking mysql database +Phase 1/5: Checking mysql database Processing databases mysql mysql.column_stats OK @@ -32,9 +32,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK -Phase 2/4: Running 'mysql_fix_privilege_tables'... -Phase 3/4: Fixing table and database names -Phase 4/4: Checking and upgrading tables +Phase 2/5: Running 'mysql_fix_privilege_tables'... +Phase 3/5: Fixing table and database names +Phase 4/5: Checking and upgrading tables Processing databases information_schema mtr @@ -42,4 +42,5 @@ mtr.global_suppressions OK mtr.test_suppressions OK performance_schema test +Phase 5/5: Running 'FLUSH PRIVILEGES'... OK diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index ce233e0db23..b5219333ef1 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -382,3 +382,15 @@ CREATE TABLE t2 (d DATE) ENGINE=MyISAM; SELECT * FROM t1,t2 WHERE 1 IS NOT NULL AND t1.b IS NULL; a b c d DROP TABLE t1,t2; +# +# Start of 10.0 tests +# +# +# MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +# +SELECT NOT NOT NULLIF(2,3); +NOT NOT NULLIF(2,3) +1 +# +# End of 10.0 tests +# diff --git a/mysql-test/r/old-mode.result b/mysql-test/r/old-mode.result index 7f3339e7ce4..4f650c3c781 100644 --- a/mysql-test/r/old-mode.result +++ b/mysql-test/r/old-mode.result @@ -101,3 +101,16 @@ Warnings: Warning 1292 Incorrect datetime value: '0000-00-00 00:20:12' Warning 1292 Truncated incorrect datetime value: '-00:20:12' DROP TABLE t1; +# +# MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast +# +SET @@old_mode=zero_date_time_cast; +CREATE TABLE t1 (a TIME,b TIME(1)); +INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); +SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; +TO_DAYS(a) TO_DAYS(b) +NULL NULL +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +DROP TABLE t1; diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 76b8e887d89..4627f03a8a3 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -7,6 +7,8 @@ grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; +connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); +ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO) connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) SHOW STATUS LIKE 'Ssl_cipher'; diff --git a/mysql-test/r/openssl_6975,tlsv10.result b/mysql-test/r/openssl_6975,tlsv10.result new file mode 100644 index 00000000000..52d5978749e --- /dev/null +++ b/mysql-test/r/openssl_6975,tlsv10.result @@ -0,0 +1,25 @@ +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; +TLS1.2 ciphers: user is ok with any cipher +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user is ok with any cipher +Variable_name Value +Ssl_cipher RC4-SHA +Variable_name Value +Ssl_cipher DHE-RSA-AES256-SHA +SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA +Variable_name Value +Ssl_cipher RC4-SHA +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result new file mode 100644 index 00000000000..033220427be --- /dev/null +++ b/mysql-test/r/openssl_6975,tlsv12.result @@ -0,0 +1,25 @@ +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; +TLS1.2 ciphers: user is ok with any cipher +Variable_name Value +Ssl_cipher AES128-SHA256 +Variable_name Value +Ssl_cipher DHE-RSA-AES256-GCM-SHA384 +TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +ERROR 1045 (28000): Access denied for user 'ssl_sslv3'@'localhost' (using password: NO) +TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +Variable_name Value +Ssl_cipher AES128-SHA256 +ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) +SSLv3 ciphers: user is ok with any cipher +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; diff --git a/mysql-test/r/order_by_zerolength-4285.result b/mysql-test/r/order_by_zerolength-4285.result new file mode 100644 index 00000000000..f60ce7d90c7 --- /dev/null +++ b/mysql-test/r/order_by_zerolength-4285.result @@ -0,0 +1,26 @@ +create table t1 (pk int primary key); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +select * from t1 order by now(), cast(pk as char(0)); +pk +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +Warnings: +Warning 1292 Truncated incorrect CHAR(0) value: '1' +Warning 1292 Truncated incorrect CHAR(0) value: '2' +Warning 1292 Truncated incorrect CHAR(0) value: '3' +Warning 1292 Truncated incorrect CHAR(0) value: '4' +Warning 1292 Truncated incorrect CHAR(0) value: '5' +Warning 1292 Truncated incorrect CHAR(0) value: '6' +Warning 1292 Truncated incorrect CHAR(0) value: '7' +Warning 1292 Truncated incorrect CHAR(0) value: '8' +Warning 1292 Truncated incorrect CHAR(0) value: '9' +Warning 1292 Truncated incorrect CHAR(0) value: '10' +drop table t1; diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 41ede085623..847af86913d 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1764,6 +1764,11 @@ PARTITION pmax VALUES LESS THAN MAXVALUE); ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed DROP TABLE t1; End of 5.1 tests +create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1)); +ERROR HY000: This partition function is not allowed +create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1)); +ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') (partition p0 values in (0), partition p1 values in (1))' at line 1 +End of 5.5 tests CREATE TABLE t1 (a INT) PARTITION BY LIST (a) SUBPARTITION BY HASH (a) SUBPARTITIONS 2 diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result index 127fa96b84b..0182245c278 100644 --- a/mysql-test/r/processlist.result +++ b/mysql-test/r/processlist.result @@ -1,15 +1,19 @@ SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; SELECT 1; SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed'; -SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL; +SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":TID:"; 1 1 SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; -INFO TIME TIME_MS -NULL 0 0.000 +ID TIME TIME_MS +TID 0 0.000 +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2'; +SET DEBUG_SYNC= 'now WAIT_FOR query_done'; +SET DEBUG_SYNC= 'now SIGNAL nosignal'; select sleep(5); sleep(5) 0 +SET DEBUG_SYNC = 'now WAIT_FOR query_done'; select command, time < 5 from information_schema.processlist where id != connection_id(); command time < 5 Sleep 1 diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 9899b894ff6..3f2343fa365 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -1346,4 +1346,67 @@ foo foo 1 foo foo 2 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; +# +# Bug mdev-6325: wrong selectivity of a column with ref access +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; +# +# Bug mdev-6843: col IS NULL in where condition when col is always NULL +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t2 a straight_join t2 b where a.a is null; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where +1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index 90f6dba83f1..0b7f1c950e5 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1356,6 +1356,134 @@ foo foo 1 foo foo 2 set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; DROP TABLE t1,t2; +# +# Bug mdev-6325: wrong selectivity of a column with ref access +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 0.99 Using where +1 SIMPLE t2 ref a a 5 test.t1.a 10 100.00 +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` straight_join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`a` < 10)) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; +# +# Bug mdev-6843: col IS NULL in where condition when col is always NULL +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; +set use_stat_tables='preferably'; +set histogram_size=100; +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +explain extended +select * from t2 a straight_join t2 b where a.a is null; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a ALL NULL NULL NULL NULL 1000 100.00 Using where +1 SIMPLE b ALL NULL NULL NULL NULL 1000 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`a`.`a` AS `a`,`test`.`a`.`b` AS `b`,`test`.`b`.`a` AS `a`,`test`.`b`.`b` AS `b` from `test`.`t2` `a` straight_join `test`.`t2` `b` where isnull(`test`.`a`.`a`) +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t0,t1,t2; set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; +set @tmp_ust= @@use_stat_tables; +set @tmp_oucs= @@optimizer_use_condition_selectivity; +# +# MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1 +# +set @tmp_mdev6808= @@optimizer_use_condition_selectivity; +SET optimizer_use_condition_selectivity = 2; +CREATE TABLE t1 ( +event_id int(11) unsigned NOT NULL AUTO_INCREMENT, +PRIMARY KEY (event_id) +) ENGINE=InnoDB; +CREATE TABLE t2 ( +repost_id int(11) unsigned NOT NULL AUTO_INCREMENT, +subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, +subject_id int(11) unsigned NOT NULL, +object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, +object_id int(11) unsigned NOT NULL, +is_private int(1) NOT NULL DEFAULT '0', +PRIMARY KEY (repost_id), +UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private), +KEY SUBJECT (subject_type,subject_id), +KEY OBJECT (object_type,object_id) +) ENGINE=InnoDB; +SELECT +* +FROM +t2, t1 +WHERE +t2.object_type = 'event' AND +t2.object_id = t1.event_id AND +t2.is_private = 0 AND +t2.subject_id = 127994 AND +t2.subject_type in ('user') +; +repost_id subject_type subject_id object_type object_id is_private event_id +DROP TABLE t1, t2; +set optimizer_use_condition_selectivity=@tmp_mdev6808; +# +# MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ... +# +SET use_stat_tables = PREFERABLY; +SET optimizer_use_condition_selectivity = 3; +CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English'); +CREATE TABLE t2 (i INT) ENGINE=InnoDB; +SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN ( +SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b ) +); +a b i +DROP TABLE t1,t2; +# +# MDEV-6738: use_stat_table + histograms crashing optimizer +# +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; +# Need innodb because there is a special kind of field_bit for non-myisam tables +create table t1(col1 int, col2 bit(1) DEFAULT NULL) engine=innodb; +select * from t1 where col2 != true; +col1 col2 +drop table t1; +# +# End of 10.0 tests +# +set use_stat_tables= @tmp_ust; +set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/show_bad_definer-5553.result b/mysql-test/r/show_bad_definer-5553.result new file mode 100644 index 00000000000..a1b8c6a7410 --- /dev/null +++ b/mysql-test/r/show_bad_definer-5553.result @@ -0,0 +1,13 @@ +create database mysqltest1; +use mysqltest1; +create table t1(id int primary key); +create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id; +Warnings: +Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist +show table status; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL +v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW +Warnings: +Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist +drop database mysqltest1; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index d373d14c089..dd9277517d8 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1869,3 +1869,216 @@ AVG(f1) 1.5000 drop table t1; End of 5.3 tests +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 ENUM('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE t1, t2; +# +# MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +# +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +# +CREATE TABLE t1 (id INT NOT NULL, a ENUM('04','03','02','01')) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'01'); +INSERT INTO t1 VALUES (1,'02'); +INSERT INTO t1 VALUES (1,'03'); +INSERT INTO t1 VALUES (1,'04'); +INSERT INTO t1 VALUES (2,'01'); +INSERT INTO t1 VALUES (2,'02'); +INSERT INTO t1 VALUES (2,'03'); +INSERT INTO t1 VALUES (2,'04'); +INSERT INTO t1 VALUES (3,'01'); +INSERT INTO t1 VALUES (3,'02'); +INSERT INTO t1 VALUES (3,'03'); +INSERT INTO t1 VALUES (3,'04'); +INSERT INTO t1 VALUES (4,'01'); +INSERT INTO t1 VALUES (4,'02'); +INSERT INTO t1 VALUES (4,'03'); +INSERT INTO t1 VALUES (4,'04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +# Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 6 NULL 16 Using where; Using index +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id MIN(a) MAX(a) +1 02 04 +2 02 04 +3 02 04 +4 02 04 +# Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL id 6 NULL 16 Using where; Using index +DROP TABLE t1; +# +# MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +# +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 ENUM('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +c1 +1.0 +2.0 +DROP TABLE t1,t2; +CREATE TABLE t1 (a DECIMAL(10,1), b ENUM('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +a b +1.0 1 +2.0 2 +ALTER TABLE t1 MODIFY a ENUM('1','2'); +SELECT * FROM t1; +a b +1 1 +2 2 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index f498b6889a5..57e2660750b 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -465,3 +465,70 @@ f 1 2 DROP TABLE t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +# +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +# t2 should NOT be elimitated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index fb10e65c0ce..ab075d29e22 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1988,3 +1988,93 @@ SELECT d1 * d2 FROM t1; d1 * d2 0 DROP TABLE t1; +select 0.000000000000000000000000000000000000000000000000001 mod 1; +0.000000000000000000000000000000000000000000000000001 mod 1 +0.000000000000000000000000000000 +select 0.0000000001 mod 1; +0.0000000001 mod 1 +0.0000000001 +select 0.01 mod 1; +0.01 mod 1 +0.01 +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DECIMAL(30,1)); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 00:00:00 +1999-01-01 00:00:00 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +# +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DECIMAL(30,10)); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +a +10:20:30.000000 +10:20:30.000000 +Warnings: +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000000' +Note 1292 Truncated incorrect time value: '102030.0000000010' +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 14 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 09531ec60d5..f3b7019c989 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -104,3 +104,162 @@ INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' ); ERROR 23000: Duplicate entry '' for key 'set_unique_utf8' DROP TABLE t1; End of 5.0 tests +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 SET('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE t1, t2; +# +# MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +# +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +c1 +a +a +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 1 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +# +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 SET('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +c1 +1.0 +2.0 +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +c1 +1.0 +2.0 +DROP TABLE t1,t2; +CREATE TABLE t1 (a DECIMAL(10,1), b SET('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +a b +1.0 1 +2.0 2 +ALTER TABLE t1 MODIFY a SET('1','2'); +SELECT * FROM t1; +a b +1 1 +2 2 +DROP TABLE t1; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 55b3ca1a1f4..477703edebb 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -369,6 +369,17 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); 1 DROP TABLE t1; # +# MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +# +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +d c +DROP TABLE t1; +# +# End of 5.5 tests +# +# # Start of 10.0 tests # # diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index e08605fb237..10aa2f2f393 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -14,3 +14,40 @@ this 0 4294967295 drop table t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (a DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01'); +CREATE TABLE t2 (a INT UNSIGNED); +INSERT INTO t2 VALUES (19990101); +INSERT INTO t2 VALUES (990101); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 +1999-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 +1999-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +a +1999-01-01 +1999-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +a +1999-01-01 +1999-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index +DROP TABLE t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 38ed8a47339..965d113124b 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -510,3 +510,44 @@ SELECT 5 = a FROM t1; Warnings: Warning 1292 Truncated incorrect DOUBLE value: 's ' DROP TABLE t1; +# +# Start of 10.0 tests +# +# +# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +# +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 VARCHAR(20)); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system PRIMARY NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +c1 +2001-01-01 +2001-01-01 +# t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +1 SIMPLE t2 index PRIMARY PRIMARY 22 NULL 2 Using where; Using index +DROP TABLE IF EXISTS t1,t2; +# +# End of 10.0 tests +# diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 4ecac34d9fa..40f5a77e3d0 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1935,3 +1935,23 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION t1 ALL NULL NULL NULL NULL 4 NULL UNION RESULT ALL NULL NULL NULL NULL NULL drop table t1; +# +# MDEV-6868:MariaDB server crash ( select with union and order by +# with subquery ) +# +CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) ); +INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' ); +( +SELECT sample_name1 AS testname FROM t1 +) +UNION +( +SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id) +) +; +testname +aaaa +cccc +bbbb +dddd +drop table t1; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index ca08c53cabe..ff155e5fe15 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5500,6 +5500,20 @@ a b a b a c 9 10 9 10 9 10 drop view v1; drop table t1,t2; +create table t1 (i int not null); +insert into t1 values (1),(2); +create table t2 (j int not null); +insert into t2 values (11),(12); +create algorithm=merge view v3 as select t1.* from t2 left join t1 on (t2.j = t1.i); +prepare stmt from 'select count(v3.i) from t1, v3'; +execute stmt; +count(v3.i) +0 +execute stmt; +count(v3.i) +0 +drop table t1, t2; +drop view v3; # ----------------------------------------------------------------- # -- End of 10.0 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index d80b4aaf822..ac4068a6373 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -52,6 +52,9 @@ sub skip_combinations { } $skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok(); + $skip{'t/openssl_6975.test'} = 'no or too old openssl' + unless ! IS_WINDOWS and ! system "openssl ciphers TLSv1.2 2>&1 >/dev/null"; + %skip; } diff --git a/mysql-test/suite/binlog/r/load_data_stm_view.result b/mysql-test/suite/binlog/r/load_data_stm_view.result new file mode 100644 index 00000000000..ddbdb71983f --- /dev/null +++ b/mysql-test/suite/binlog/r/load_data_stm_view.result @@ -0,0 +1,24 @@ +create table t1 (i int, j int); +create view v1 as select i from t1; +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i); +LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' INTO TABLE v1; +select * from v1; +i +1 +1 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create table t1 (i int, j int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select i from t1 +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=# +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/3940.data' IGNORE INTO TABLE `v1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`i`) ;file_id=# +master-bin.000001 # Query # # COMMIT +drop view v1; +drop table t1; diff --git a/mysql-test/suite/binlog/t/load_data_stm_view.test b/mysql-test/suite/binlog/t/load_data_stm_view.test new file mode 100644 index 00000000000..b70651b4e2d --- /dev/null +++ b/mysql-test/suite/binlog/t/load_data_stm_view.test @@ -0,0 +1,20 @@ +# +# MDEV-3940 Server crash or assertion `item->type() == Item::STRING_ITEM' failure on LOAD DATA through a view with statement binary logging +# + +--source include/have_binlog_format_statement.inc + +--write_file $MYSQLTEST_VARDIR/3940.data +1 +EOF + +create table t1 (i int, j int); +create view v1 as select i from t1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 (i) +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/3940.data' INTO TABLE v1 +select * from v1; +--source include/show_binlog_events.inc +drop view v1; +drop table t1; diff --git a/mysql-test/suite/heap/btree_varchar_null.result b/mysql-test/suite/heap/btree_varchar_null.result new file mode 100644 index 00000000000..9199cf6ef7d --- /dev/null +++ b/mysql-test/suite/heap/btree_varchar_null.result @@ -0,0 +1,6 @@ +create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory; +insert into t1 values (null,'not'),('one',null),('two',null),('three',''); +select * from t1 where f1 = 'one' and f2 is null; +f1 f2 +one NULL +drop table t1; diff --git a/mysql-test/suite/heap/btree_varchar_null.test b/mysql-test/suite/heap/btree_varchar_null.test new file mode 100644 index 00000000000..8e6625a2bfa --- /dev/null +++ b/mysql-test/suite/heap/btree_varchar_null.test @@ -0,0 +1,7 @@ +# +# MDEV-4813 Replication fails on updating a MEMORY table with an index using btree +# +create table t1 (f1 varchar(128), f2 varchar(128), key (f2,f1) using btree) engine=memory; +insert into t1 values (null,'not'),('one',null),('two',null),('three',''); +select * from t1 where f1 = 'one' and f2 is null; +drop table t1; diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index ad1323d4857..8cae44a3607 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -9,4 +9,4 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -innodb_bug14676111: MDEV-4396 + diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result new file mode 100644 index 00000000000..53ddf618244 --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -0,0 +1,16 @@ +# +# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +# ADD FOREIGN KEY +# +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); +drop table title, department, people; diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result index ebecd1d00cb..c2fdfee5522 100644 --- a/mysql-test/suite/innodb/r/innodb_bug14676111.result +++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result @@ -1,4 +1,6 @@ drop table if exists t1; +call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*"); +set global innodb_stats_persistent = false; CREATE TABLE t1 (a int not null primary key) engine=InnoDB; set global innodb_limit_optimistic_insert_debug = 2; insert into t1 values (1); @@ -9,45 +11,55 @@ insert into t1 values (2); analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -10.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +10 delete from t1 where a=4; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -8.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +8 delete from t1 where a=5; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -5.0000 -set global innodb_limit_optimistic_insert_debug = 10000; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +5 +set global innodb_limit_optimistic_insert_debug = 0; delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -3.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +3 insert into t1 values (2); delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -2.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +2 insert into t1 values (2); delete from t1 where a=2; +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; -DATA_LENGTH / 16384 -1.0000 +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; +CLUST_INDEX_SIZE +1 drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result new file mode 100644 index 00000000000..f8d24f4e6f5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_monitor.result @@ -0,0 +1,585 @@ +set global innodb_monitor_disable = All; +select name, status from information_schema.innodb_metrics; +name status +metadata_table_handles_opened disabled +metadata_table_handles_closed disabled +metadata_table_reference_count disabled +metadata_mem_pool_size disabled +lock_deadlocks disabled +lock_timeouts disabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits disabled +lock_row_lock_time disabled +lock_row_lock_time_max disabled +lock_row_lock_waits disabled +lock_row_lock_time_avg disabled +buffer_pool_size disabled +buffer_pool_reads disabled +buffer_pool_read_requests disabled +buffer_pool_write_requests disabled +buffer_pool_wait_free disabled +buffer_pool_read_ahead disabled +buffer_pool_read_ahead_evicted disabled +buffer_pool_pages_total disabled +buffer_pool_pages_misc disabled +buffer_pool_pages_data disabled +buffer_pool_bytes_data disabled +buffer_pool_pages_dirty disabled +buffer_pool_bytes_dirty disabled +buffer_pool_pages_free disabled +buffer_pages_created disabled +buffer_pages_written disabled +buffer_pages_read disabled +buffer_data_reads disabled +buffer_data_written disabled +buffer_flush_batch_scanned disabled +buffer_flush_batch_num_scan disabled +buffer_flush_batch_scanned_per_call disabled +buffer_flush_batch_rescan disabled +buffer_flush_batch_total_pages disabled +buffer_flush_batches disabled +buffer_flush_batch_pages disabled +buffer_flush_neighbor_total_pages disabled +buffer_flush_neighbor disabled +buffer_flush_neighbor_pages disabled +buffer_flush_n_to_flush_requested disabled +buffer_flush_avg_page_rate disabled +buffer_flush_lsn_avg_rate disabled +buffer_flush_pct_for_dirty disabled +buffer_flush_pct_for_lsn disabled +buffer_flush_sync_waits disabled +buffer_flush_adaptive_total_pages disabled +buffer_flush_adaptive disabled +buffer_flush_adaptive_pages disabled +buffer_flush_sync_total_pages disabled +buffer_flush_sync disabled +buffer_flush_sync_pages disabled +buffer_flush_background_total_pages disabled +buffer_flush_background disabled +buffer_flush_background_pages disabled +buffer_LRU_batch_scanned disabled +buffer_LRU_batch_num_scan disabled +buffer_LRU_batch_scanned_per_call disabled +buffer_LRU_batch_total_pages disabled +buffer_LRU_batches disabled +buffer_LRU_batch_pages disabled +buffer_LRU_single_flush_scanned disabled +buffer_LRU_single_flush_num_scan disabled +buffer_LRU_single_flush_scanned_per_call disabled +buffer_LRU_single_flush_failure_count disabled +buffer_LRU_get_free_search disabled +buffer_LRU_search_scanned disabled +buffer_LRU_search_num_scan disabled +buffer_LRU_search_scanned_per_call disabled +buffer_LRU_unzip_search_scanned disabled +buffer_LRU_unzip_search_num_scan disabled +buffer_LRU_unzip_search_scanned_per_call disabled +buffer_page_read_index_leaf disabled +buffer_page_read_index_non_leaf disabled +buffer_page_read_index_ibuf_leaf disabled +buffer_page_read_index_ibuf_non_leaf disabled +buffer_page_read_undo_log disabled +buffer_page_read_index_inode disabled +buffer_page_read_ibuf_free_list disabled +buffer_page_read_ibuf_bitmap disabled +buffer_page_read_system_page disabled +buffer_page_read_trx_system disabled +buffer_page_read_fsp_hdr disabled +buffer_page_read_xdes disabled +buffer_page_read_blob disabled +buffer_page_read_zblob disabled +buffer_page_read_zblob2 disabled +buffer_page_read_other disabled +buffer_page_written_index_leaf disabled +buffer_page_written_index_non_leaf disabled +buffer_page_written_index_ibuf_leaf disabled +buffer_page_written_index_ibuf_non_leaf disabled +buffer_page_written_undo_log disabled +buffer_page_written_index_inode disabled +buffer_page_written_ibuf_free_list disabled +buffer_page_written_ibuf_bitmap disabled +buffer_page_written_system_page disabled +buffer_page_written_trx_system disabled +buffer_page_written_fsp_hdr disabled +buffer_page_written_xdes disabled +buffer_page_written_blob disabled +buffer_page_written_zblob disabled +buffer_page_written_zblob2 disabled +buffer_page_written_other disabled +os_data_reads disabled +os_data_writes disabled +os_data_fsyncs disabled +os_pending_reads disabled +os_pending_writes disabled +os_log_bytes_written disabled +os_log_fsyncs disabled +os_log_pending_fsyncs disabled +os_log_pending_writes disabled +trx_rw_commits disabled +trx_ro_commits disabled +trx_nl_ro_commits disabled +trx_commits_insert_update disabled +trx_rollbacks disabled +trx_rollbacks_savepoint disabled +trx_rollback_active disabled +trx_active_transactions disabled +trx_rseg_history_len disabled +trx_undo_slots_used disabled +trx_undo_slots_cached disabled +trx_rseg_current_size disabled +purge_del_mark_records disabled +purge_upd_exist_or_extern_records disabled +purge_invoked disabled +purge_undo_log_pages disabled +purge_dml_delay_usec disabled +purge_stop_count disabled +purge_resume_count disabled +log_checkpoints disabled +log_lsn_last_flush disabled +log_lsn_last_checkpoint disabled +log_lsn_current disabled +log_lsn_checkpoint_age disabled +log_lsn_buf_pool_oldest disabled +log_max_modified_age_async disabled +log_max_modified_age_sync disabled +log_pending_log_writes disabled +log_pending_checkpoint_writes disabled +log_num_log_io disabled +log_waits disabled +log_write_requests disabled +log_writes disabled +compress_pages_compressed disabled +compress_pages_decompressed disabled +compression_pad_increments disabled +compression_pad_decrements disabled +index_page_splits disabled +index_page_merge_attempts disabled +index_page_merge_successful disabled +index_page_reorg_attempts disabled +index_page_reorg_successful disabled +index_page_discards disabled +adaptive_hash_searches disabled +adaptive_hash_searches_btree disabled +adaptive_hash_pages_added disabled +adaptive_hash_pages_removed disabled +adaptive_hash_rows_added disabled +adaptive_hash_rows_removed disabled +adaptive_hash_rows_deleted_no_hash_entry disabled +adaptive_hash_rows_updated disabled +file_num_open_files disabled +ibuf_merges_insert disabled +ibuf_merges_delete_mark disabled +ibuf_merges_delete disabled +ibuf_merges_discard_insert disabled +ibuf_merges_discard_delete_mark disabled +ibuf_merges_discard_delete disabled +ibuf_merges disabled +ibuf_size disabled +innodb_master_thread_sleeps disabled +innodb_activity_count disabled +innodb_master_active_loops disabled +innodb_master_idle_loops disabled +innodb_background_drop_table_usec disabled +innodb_ibuf_merge_usec disabled +innodb_log_flush_usec disabled +innodb_mem_validate_usec disabled +innodb_master_purge_usec disabled +innodb_dict_lru_usec disabled +innodb_checkpoint_usec disabled +innodb_dblwr_writes disabled +innodb_dblwr_pages_written disabled +innodb_page_size disabled +innodb_rwlock_s_spin_waits disabled +innodb_rwlock_x_spin_waits disabled +innodb_rwlock_s_spin_rounds disabled +innodb_rwlock_x_spin_rounds disabled +innodb_rwlock_s_os_waits disabled +innodb_rwlock_x_os_waits disabled +dml_reads disabled +dml_inserts disabled +dml_deletes disabled +dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled +ddl_background_drop_indexes disabled +ddl_background_drop_tables disabled +ddl_online_create_index disabled +ddl_pending_alter_table disabled +icp_attempts disabled +icp_no_match disabled +icp_out_of_range disabled +icp_match disabled +set global innodb_monitor_enable = all; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_enable = aaa; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' +set global innodb_monitor_disable = All; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_reset_all = all; +select name from information_schema.innodb_metrics where count!=0; +name +set global innodb_monitor_enable = "%lock%"; +select name from information_schema.innodb_metrics +where status != IF(name like "%lock%", 'enabled', 'disabled'); +name +set global innodb_monitor_disable = "%lock%"; +select name, status from information_schema.innodb_metrics +where name like "%lock%"; +name status +lock_deadlocks disabled +lock_timeouts disabled +lock_rec_lock_waits disabled +lock_table_lock_waits disabled +lock_rec_lock_requests disabled +lock_rec_lock_created disabled +lock_rec_lock_removed disabled +lock_rec_locks disabled +lock_table_lock_created disabled +lock_table_lock_removed disabled +lock_table_locks disabled +lock_row_lock_current_waits disabled +lock_row_lock_time disabled +lock_row_lock_time_max disabled +lock_row_lock_waits disabled +lock_row_lock_time_avg disabled +innodb_rwlock_s_spin_waits disabled +innodb_rwlock_x_spin_waits disabled +innodb_rwlock_s_spin_rounds disabled +innodb_rwlock_x_spin_rounds disabled +innodb_rwlock_s_os_waits disabled +innodb_rwlock_x_os_waits disabled +set global innodb_monitor_enable = "%lock*"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' +set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_disable="%%%%%"; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_enable="%"; +select name from information_schema.innodb_metrics where status!='enabled'; +name +set global innodb_monitor_disable="%_%"; +select name from information_schema.innodb_metrics where status!='disabled'; +name +set global innodb_monitor_enable="log%%%%"; +select name from information_schema.innodb_metrics +where status != IF(name like "log%", 'enabled', 'disabled'); +name +set global innodb_monitor_enable="os_%a_fs_ncs"; +set global innodb_monitor_enable="os%pending%"; +select name, status from information_schema.innodb_metrics +where name like "os%"; +name status +os_data_reads disabled +os_data_writes disabled +os_data_fsyncs enabled +os_pending_reads enabled +os_pending_writes enabled +os_log_bytes_written disabled +os_log_fsyncs disabled +os_log_pending_fsyncs enabled +os_log_pending_writes enabled +set global innodb_monitor_enable=""; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' +set global innodb_monitor_enable="_"; +ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' +set global innodb_monitor_disable = module_metadata; +set global innodb_monitor_reset_all = module_metadata; +set global innodb_monitor_enable = metadata_table_handles_opened; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled +set global innodb_monitor_disable = metadata_table_handles_opened; +set global innodb_monitor_reset = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +drop table monitor_test; +create table monitor_test(col int) engine = innodb; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +set global innodb_monitor_reset_all = metadata_table_handles_opened; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = metadata_table_handles_opened; +drop table monitor_test; +create table monitor_test(col int) engine = innodb stats_persistent=0; +select * from monitor_test; +col +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled +set global innodb_monitor_enable = metadata_table_handles_closed; +create index idx on monitor_test(col); +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_closed"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled +metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_disable = module_metadata; +set global innodb_monitor_reset = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled +metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_reset_all = module_metadata; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled +metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled +metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled +metadata_mem_pool_size NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = module_trx; +begin; +insert into monitor_test values(9); +commit; +begin; +insert into monitor_test values(9); +rollback; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "trx_rollbacks" or name like "trx_active_transactions"; +name max_count min_count count max_count_reset min_count_reset count_reset status +trx_rollbacks 1 NULL 1 1 NULL 1 enabled +trx_active_transactions 1 0 0 1 0 0 enabled +set global innodb_monitor_disable = module_trx; +set global innodb_monitor_enable = module_dml; +insert into monitor_test values(9); +update monitor_test set col = 10 where col = 9; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 4 NULL 4 4 NULL 4 enabled +dml_inserts 1 NULL 1 1 NULL 1 enabled +dml_deletes 0 NULL 0 0 NULL 0 enabled +dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 6 NULL 6 6 NULL 6 enabled +dml_inserts 1 NULL 1 1 NULL 1 enabled +dml_deletes 2 NULL 2 2 NULL 2 enabled +dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_reset = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 6 NULL 6 0 NULL 0 enabled +dml_inserts 1 NULL 1 0 NULL 0 enabled +dml_deletes 2 NULL 2 0 NULL 0 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +insert into monitor_test values(9); +insert into monitor_test values(1); +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 enabled +dml_inserts 3 NULL 3 2 NULL 2 enabled +dml_deletes 4 NULL 4 2 NULL 2 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_reset_all = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 enabled +dml_inserts 3 NULL 3 2 NULL 2 enabled +dml_deletes 4 NULL 4 2 NULL 2 enabled +dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled +set global innodb_monitor_disable = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads 8 NULL 8 2 NULL 2 disabled +dml_inserts 3 NULL 3 2 NULL 2 disabled +dml_deletes 4 NULL 4 2 NULL 2 disabled +dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled +set global innodb_monitor_reset_all = module_dml; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads NULL NULL 0 NULL NULL 0 disabled +dml_inserts NULL NULL 0 NULL NULL 0 disabled +dml_deletes NULL NULL 0 NULL NULL 0 disabled +dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_enable = dml_inserts; +insert into monitor_test values(9); +insert into monitor_test values(1); +delete from monitor_test; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; +name max_count min_count count max_count_reset min_count_reset count_reset status +dml_reads NULL NULL 0 NULL NULL 0 disabled +dml_inserts 2 NULL 2 2 NULL 2 enabled +dml_deletes NULL NULL 0 NULL NULL 0 disabled +dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled +set global innodb_monitor_disable = module_dml; +drop table monitor_test; +set global innodb_monitor_enable = file_num_open_files; +select name, max_count, min_count, count, +max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "file_num_open_files"; +name max_count min_count count max_count_reset min_count_reset count_reset status +file_num_open_files # # # # # # enabled +set global innodb_monitor_disable = file_num_open_files; +set global innodb_monitor_enable = "icp%"; +create table monitor_test(a char(3), b int, c char(2), +primary key (a(1), c(1)), key(b)) engine = innodb; +insert into monitor_test values("13", 2, "aa"); +select a from monitor_test where b < 1 for update; +a +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 1 +icp_no_match 0 +icp_out_of_range 1 +icp_match 0 +select a from monitor_test where b < 3 for update; +a +13 +select name, count from information_schema.innodb_metrics +where name like "icp%"; +name count +icp_attempts 2 +icp_no_match 0 +icp_out_of_range 1 +icp_match 1 +drop table monitor_test; +set global innodb_monitor_disable = all; +set global innodb_monitor_reset_all = all; +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; +1 +set global innodb_monitor_enable = default; +set global innodb_monitor_disable = default; +set global innodb_monitor_reset = default; +set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test new file mode 100644 index 00000000000..8ee96347208 --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign-keys.test @@ -0,0 +1,31 @@ +--source include/have_innodb.inc +--source include/have_debug.inc + +if (`select plugin_auth_version <= "5.5.39-MariaDB-36.0" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB as of 5.5.39-MariaDB-36.0 or earlier +} + +--echo # +--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE +--echo # ADD FOREIGN KEY +--echo # + +CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT, +PRIMARY KEY (`department_id`)) engine=innodb; + +CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT, +`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb; + +CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb; + +ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES +`people` (`people_id`); + +ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people` +(`people_id`); + +ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people` +(`people_id`); + +drop table title, department, people; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index f687f089d78..b519c48b23d 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1314,7 +1314,7 @@ drop table t1; # Test for testable InnoDB status variables. This test # uses previous ones(pages_created, rows_deleted, ...). ---replace_result 511 ok 512 ok 2047 ok 513 ok +--replace_result 511 ok 512 ok 2047 ok 513 ok 515 ok SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.opt b/mysql-test/suite/innodb/t/innodb_bug14676111.opt new file mode 100644 index 00000000000..77945d1e4bb --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.opt @@ -0,0 +1 @@ +--innodb-sys-tablestats=1 \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test index 41862b8105e..ba04d421fde 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14676111.test +++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test @@ -3,11 +3,6 @@ -- source include/have_innodb.inc -- source include/have_debug.inc -# Note that this test needs to be able to manipulate how/when purge is done -# using @@innodb_limit_optimistic_insert_debug. This does not work with -# background purge threads, so we disabled them in the -master.opt (they are -# off by default in normal 5.5 innodb but on by default in xtradb) - if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`) { --skip Test requires InnoDB built with UNIV_DEBUG definition. @@ -15,16 +10,20 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n --disable_query_log set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; +set @old_innodb_stats_persistent = @@innodb_stats_persistent; +set @old_innodb_undo_logs = @@innodb_undo_logs; +# Limit undo segments for stable progress of purge. +set global innodb_undo_logs = 1; --enable_query_log --disable_warnings drop table if exists t1; --enable_warnings -CREATE TABLE t1 (a int not null primary key) engine=InnoDB; +call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*"); -let $wait_condition= - SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS - WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE'; +set global innodb_stats_persistent = false; + +CREATE TABLE t1 (a int not null primary key) engine=InnoDB; # # make 4 leveled straight tree @@ -55,10 +54,12 @@ insert into t1 values (2); #(1, 2) (3) (4) (5) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; delete from t1 where a=4; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #deleting 1 record of 2 records don't cause merge artificially. #current tree form # (1, 5) @@ -67,10 +68,12 @@ delete from t1 where a=4; #(1, 2) (3) (5) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; delete from t1 where a=5; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #deleting 1 record of 2 records don't cause merge artificially. #current tree form # (1) @@ -79,16 +82,18 @@ delete from t1 where a=5; #(1, 2) (3) <- merged next analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; # # cause merge at level 0 # #disable the artificial limitation of records in a page -set global innodb_limit_optimistic_insert_debug = 10000; +set global innodb_limit_optimistic_insert_debug = 0; delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #merge page occurs. and lift up occurs. #current tree form # (1) @@ -96,7 +101,7 @@ delete from t1 where a=2; # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; insert into t1 values (2); #current tree form @@ -105,13 +110,15 @@ insert into t1 values (2); # (1, 2, 3) delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #current tree form # (1) # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; insert into t1 values (2); #current tree form @@ -119,15 +126,19 @@ insert into t1 values (2); # (1, 2, 3) <- lift up this level next, because the father is root delete from t1 where a=2; ---source include/wait_condition.inc +set global innodb_purge_stop_now=ON; +set global innodb_purge_run_now=ON; +--source include/wait_innodb_all_purged.inc #current tree form # (1, 3) analyze table t1; -select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; +select CLUST_INDEX_SIZE from information_schema.INNODB_SYS_TABLESTATS where NAME = 'test/t1'; drop table t1; --disable_query_log set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; +set global innodb_stats_persistent = @old_innodb_stats_persistent; +set global innodb_undo_logs = @old_innodb_undo_logs; --enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb/t/innodb_information_schema.test index 205344a1cd7..95b436d676c 100644 --- a/mysql-test/suite/innodb/t/innodb_information_schema.test +++ b/mysql-test/suite/innodb/t/innodb_information_schema.test @@ -122,7 +122,7 @@ SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE; # then its contents will never change because the cache from which it is # filled is updated only if it has not been read for 0.1 seconds. See # CACHE_MIN_IDLE_TIME_US in trx/trx0i_s.c. -let $cnt=10; +let $cnt=200; while ($cnt) { let $success=`SELECT COUNT(*) = 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`; diff --git a/mysql-test/suite/innodb/t/innodb_monitor.test b/mysql-test/suite/innodb/t/innodb_monitor.test new file mode 100644 index 00000000000..864e0cae862 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_monitor.test @@ -0,0 +1,387 @@ +# This is the test for Metrics Monitor Table feature. +# Test the metrics monitor system's control system +# and counter accuracy. + +--source include/have_innodb.inc + +set global innodb_monitor_disable = All; + +# Test turn on/off the monitor counter with "all" option +# By default, they will be off +select name, status from information_schema.innodb_metrics; + +# Turn on all monitor counters +set global innodb_monitor_enable = all; + +# status should all change to "enabled" +select name from information_schema.innodb_metrics where status!='enabled'; + +# Test wrong argument to the global configure option +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable = aaa; + +# We require a valid monitor counter/module name. There is no default +# counter name or module. A warning will be printed asking user to +# specify a valid counter name. +#--disable_warnings +#set global innodb_monitor_enable = default; +#--enable_warnings + +# Turn off all monitor counters, option name should be case +# insensitive +set global innodb_monitor_disable = All; + +# status should all change to "disabled" +select name from information_schema.innodb_metrics where status!='disabled'; + +# Reset all counter values +set global innodb_monitor_reset_all = all; + +# count should all change to 0 +select name from information_schema.innodb_metrics where count!=0; + +# Test wildcard match, turn on all counters contain string "lock" +set global innodb_monitor_enable = "%lock%"; + +# All lock related counter should be enabled +select name from information_schema.innodb_metrics +where status != IF(name like "%lock%", 'enabled', 'disabled'); + +# Disable them +set global innodb_monitor_disable = "%lock%"; + +# All lock related counter should be disabled +select name, status from information_schema.innodb_metrics +where name like "%lock%"; + +# No match for "%lock*" +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable = "%lock*"; + +# All counters will be turned on with wildcard match string with all "%" +set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; + +select name from information_schema.innodb_metrics where status!='enabled'; + +# Turn off all counters +set global innodb_monitor_disable="%%%%%"; + +select name from information_schema.innodb_metrics where status!='disabled'; + +# One more round testing. All counters will be turned on with +# single wildcard character "%" +set global innodb_monitor_enable="%"; + +select name from information_schema.innodb_metrics where status!='enabled'; + +# Turn off all the counters with "%_%" +set global innodb_monitor_disable="%_%"; + +select name from information_schema.innodb_metrics where status!='disabled'; + +# Turn on all counters start with "log" +set global innodb_monitor_enable="log%%%%"; + +select name from information_schema.innodb_metrics +where status != IF(name like "log%", 'enabled', 'disabled'); + +# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" +# is single character wildcard match word +set global innodb_monitor_enable="os_%a_fs_ncs"; + +# Turn on counters whose name contains "os" and "pending" with +# wildcard match "os%pending%" +set global innodb_monitor_enable="os%pending%"; + +select name, status from information_schema.innodb_metrics +where name like "os%"; + +# Empty string is an invalid option +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable=""; + +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_monitor_enable="_"; + +# Reset counters only in "module_metadata" module +set global innodb_monitor_disable = module_metadata; + +set global innodb_monitor_reset_all = module_metadata; + +# Only turn on "table_open" counter +set global innodb_monitor_enable = metadata_table_handles_opened; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +# This will open the monitor_test table +select * from monitor_test; + +# "metadata_table_handles_opened" should increment by 1 +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Reset the counter value while counter is still on (started) +# This will reset value "count_reset" but not +# "count" +set global innodb_monitor_reset = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# re-create table again to increment "metadata_table_handles_opened" again +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +select * from monitor_test; + +# "metadata_table_handles_opened" should increment +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Cannot reset all monitor value while the counter is on +set global innodb_monitor_reset_all = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Turn off the counter "metadata_table_handles_opened" +set global innodb_monitor_disable = metadata_table_handles_opened; + +# Reset the counter value while counter is off (disabled) +set global innodb_monitor_reset = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# re-create table again. Since monitor is off, "metadata_table_handles_opened" +# should not be incremented +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb; + +# "metadata_table_handles_opened" should increment +select * from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Reset all the counters, include those counter *_since_start +set global innodb_monitor_reset_all = metadata_table_handles_opened; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Turn on "table_open" counter again +set global innodb_monitor_enable = metadata_table_handles_opened; + +# Test metadata_table_handles_opened again to see if it is working correctly +# after above round of turning on/off/reset +drop table monitor_test; + +# Create a new table to test "metadata_table_handles_opened" counter +create table monitor_test(col int) engine = innodb stats_persistent=0; + +select * from monitor_test; + +# "metadata_table_handles_opened" should increment +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_opened"; + +# Test counter "metadata_table_handles_closed", +# create index will close the old handle +set global innodb_monitor_enable = metadata_table_handles_closed; + +create index idx on monitor_test(col); + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name = "metadata_table_handles_closed"; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +# Reset counters only in "module_metadata" module +set global innodb_monitor_disable = module_metadata; + +set global innodb_monitor_reset = module_metadata; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +set global innodb_monitor_reset_all = module_metadata; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "metadata%"; + +# Test Transaction Module +set global innodb_monitor_enable = module_trx; + +begin; +insert into monitor_test values(9); +commit; + +begin; +insert into monitor_test values(9); +rollback; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "trx_rollbacks" or name like "trx_active_transactions"; + +set global innodb_monitor_disable = module_trx; + +# Test DML Module +set global innodb_monitor_enable = module_dml; + +insert into monitor_test values(9); + +update monitor_test set col = 10 where col = 9; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +delete from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status + from information_schema.innodb_metrics + where name like "dml%"; + +# test reset counter while the counter is on +set global innodb_monitor_reset = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# insert/delete some rows after the reset +insert into monitor_test values(9); +insert into monitor_test values(1); + +delete from monitor_test; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# We do not allow reset_all while the counter is on, nothing +# should be reset here +set global innodb_monitor_reset_all = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Turn off the counter +set global innodb_monitor_disable = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Reset all counter values +set global innodb_monitor_reset_all = module_dml; + +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +# Open individual counter "dml_inserts" +set global innodb_monitor_enable = dml_inserts; + +insert into monitor_test values(9); +insert into monitor_test values(1); + +delete from monitor_test; + +# Only counter "dml_inserts" should be updated +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "dml%"; + +set global innodb_monitor_disable = module_dml; + +drop table monitor_test; + +set global innodb_monitor_enable = file_num_open_files; + +# Counters are unpredictable when innodb-file-per-table is on +--replace_column 2 # 3 # 4 # 5 # 6 # 7 # +select name, max_count, min_count, count, + max_count_reset, min_count_reset, count_reset, status +from information_schema.innodb_metrics +where name like "file_num_open_files"; + +set global innodb_monitor_disable = file_num_open_files; + +# Test ICP module counters +set global innodb_monitor_enable = "icp%"; + +create table monitor_test(a char(3), b int, c char(2), +primary key (a(1), c(1)), key(b)) engine = innodb; + +insert into monitor_test values("13", 2, "aa"); + +select a from monitor_test where b < 1 for update; + +# should have icp_attempts = 1 and icp_out_of_range = 1 +select name, count from information_schema.innodb_metrics +where name like "icp%"; + +# should have icp_attempts = 2 and icp_match = 1 +select a from monitor_test where b < 3 for update; + +select name, count from information_schema.innodb_metrics +where name like "icp%"; + +drop table monitor_test; + +set global innodb_monitor_disable = all; +set global innodb_monitor_reset_all = all; + +# Test for bug #13966091 +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; + +-- disable_warnings +set global innodb_monitor_enable = default; +set global innodb_monitor_disable = default; +set global innodb_monitor_reset = default; +set global innodb_monitor_reset_all = default; +-- enable_warnings diff --git a/mysql-test/suite/multi_source/simple.test b/mysql-test/suite/multi_source/simple.test index c3b7a60448a..6108d3043d5 100644 --- a/mysql-test/suite/multi_source/simple.test +++ b/mysql-test/suite/multi_source/simple.test @@ -33,6 +33,13 @@ set default_master_connection = ''; --connection slave --sync_with_master 0,'slave2' +# MDEV-7074 (Sporadic test failure due to a race condition) +let $show_statement = SHOW ALL SLAVES STATUS; +let $field = Executed_log_entries; +let $condition = = 7; +let $wait_for_all = 1; +--source include/wait_show_condition.inc + --replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 show all slaves status; diff --git a/mysql-test/suite/perfschema/t/mks_timer-6258.test b/mysql-test/suite/perfschema/t/mks_timer-6258.test index b4e5791298a..2bc14abf2f1 100644 --- a/mysql-test/suite/perfschema/t/mks_timer-6258.test +++ b/mysql-test/suite/perfschema/t/mks_timer-6258.test @@ -1,4 +1,5 @@ --source include/not_embedded.inc +--source include/have_perfschema.inc # # MDEV-6258 MariaDB 10.0 performance schema timestamps relative to epoch # diff --git a/mysql-test/suite/plugins/t/unix_socket.test b/mysql-test/suite/plugins/t/unix_socket.test index 2c1af9fb1da..1522c9b7cbe 100644 --- a/mysql-test/suite/plugins/t/unix_socket.test +++ b/mysql-test/suite/plugins/t/unix_socket.test @@ -12,11 +12,14 @@ eval install plugin unix_socket soname '$AUTH_SOCKET_SO'; --echo # with named user --echo # ---replace_result $USER USER +--let $replace=create user $USER +--replace_result $replace "create user USER" eval create user $USER identified via unix_socket; --write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt ---replace_result $USER USER +--let $replace1=$USER@localhost +--let $replace2=$USER@% +--replace_result $replace1 "USER@localhost" $replace2 "USER@%" select user(), current_user(), database(); EOF @@ -31,7 +34,8 @@ EOF --error 1 --exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt ---replace_result $USER USER +--let $replace=drop user $USER +--replace_result $replace "drop user USER" eval drop user $USER; --echo # diff --git a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc new file mode 100644 index 00000000000..b624853cd37 --- /dev/null +++ b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc @@ -0,0 +1,50 @@ +######################################### +# Author: Benjamin Renard benj@fb.com +# Date: 11/15/2013 +# Purpose: Showing the difference between current innodb rows stats and the ones recorded at the beginning of the test +# Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created +######################################### + +--connection master +--echo ==========MASTER========== + +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; + +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; + +--sync_slave_with_master +--echo ==========SLAVE=========== + +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; + +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; + +--connection master diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index debd107221f..3417ad561f4 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -124,7 +124,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (11); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -141,7 +141,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (12); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -164,7 +164,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (21); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors @@ -185,7 +185,7 @@ SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; INSERT INTO t1 VALUES (22); COMMIT; -ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +ERROR HY000: Error writing file 'master-bin' (errno: 28 "No space left on device") SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; COMMIT; Got one of the listed errors diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result b/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result new file mode 100644 index 00000000000..b8e9262c771 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result @@ -0,0 +1,225 @@ +include/master-slave.inc +[connection master] +select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +CREATE DATABASE testdb; +USE testdb; +CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO testdb.t1 VALUES (1); +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +0 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +0 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +0 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +0 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +UPDATE t1 SET i=2 WHERE i=1; +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +1 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +1 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +0 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +DELETE FROM t1 WHERE i=2; +==========MASTER========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @master_rows_read; +@rows_read - @master_rows_read +2 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @master_rows_updated; +@rows_updated - @master_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @master_rows_deleted; +@rows_deleted - @master_rows_deleted +1 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @master_rows_inserted; +@rows_inserted - @master_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @master_system_rows_read; +@system_rows_read - @master_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @master_system_rows_updated; +@system_rows_updated - @master_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @master_system_rows_deleted; +@system_rows_deleted - @master_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @master_system_rows_inserted; +@system_rows_inserted - @master_system_rows_inserted +0 +==========SLAVE=========== +select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select @rows_read - @slave_rows_read; +@rows_read - @slave_rows_read +2 +select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select @rows_updated - @slave_rows_updated; +@rows_updated - @slave_rows_updated +1 +select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select @rows_deleted - @slave_rows_deleted; +@rows_deleted - @slave_rows_deleted +1 +select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select @rows_inserted - @slave_rows_inserted; +@rows_inserted - @slave_rows_inserted +1 +select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select @system_rows_read - @slave_system_rows_read; +@system_rows_read - @slave_system_rows_read +0 +select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select @system_rows_updated - @slave_system_rows_updated; +@system_rows_updated - @slave_system_rows_updated +0 +select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select @system_rows_deleted - @slave_system_rows_deleted; +@system_rows_deleted - @slave_system_rows_deleted +0 +select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; +select @system_rows_inserted - @slave_system_rows_inserted; +@system_rows_inserted - @slave_system_rows_inserted +0 +DROP TABLE t1; +DROP DATABASE testdb; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result index e25401d310f..328c3c3423f 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result @@ -13,6 +13,34 @@ INSERT INTO tt_2(ddl_case) VALUES(0); # CHECK IMPLICT COMMIT ######################################################################### SET AUTOCOMMIT= 0; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (43) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (42) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; diff --git a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result index 296d21d8ef9..63a5493f045 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12815,6 +12826,352 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -12838,4 +13195,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result index a2dcd4fd39b..5811617e71e 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -13187,6 +13198,372 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -13210,4 +13587,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result index 4e8e83d2187..39e1541eb0e 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -15011,6 +15022,460 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -15034,4 +15499,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result index bc09916361e..8a110048d80 100644 --- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12318,6 +12329,338 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -12341,4 +12684,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index fb86d46b01e..ac21e7a3e01 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -923,6 +923,55 @@ a 32 33 34 +*** MDEV-6775: Wrong binlog order in parallel replication *** +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +UPDATE t4 SET b=NULL WHERE a=6; +SET debug_sync='now WAIT_FOR master_queued1'; +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +DELETE FROM t4 WHERE b <= 3; +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; +SET binlog_format= @old_format; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +SELECT * FROM t4 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +SET debug_sync= 'now SIGNAL cont'; +include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +include/start_slave.inc include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; include/start_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_retry.result b/mysql-test/suite/rpl/r/rpl_parallel_retry.result index cd12d92430b..0129814e6a8 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_retry.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_retry.result @@ -188,9 +188,120 @@ a LENGTH(b) 3 5012 4 5000 SET GLOBAL max_relay_log_size=@old_max; +*** MDEV-7065: Incorrect relay log position in parallel replication after retry of transaction *** +include/stop_slave.inc +BEGIN; +INSERT INTO t1 VALUES (100, 0); +INSERT INTO t1 VALUES (101, 0); +INSERT INTO t1 VALUES (102, 0); +INSERT INTO t1 VALUES (103, 0); +COMMIT; +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +include/start_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +retries +1 +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +include/stop_slave_sql.inc +INSERT INTO t1 VALUES (104, 1); +INSERT INTO t1 VALUES (105, 1); +INSERT INTO t1 VALUES (106, 1); +INSERT INTO t1 VALUES (107, 1); +INSERT INTO t1 VALUES (108, 1); +INSERT INTO t1 VALUES (109, 1); +include/start_slave.inc +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +a b +100 0 +101 0 +102 0 +103 0 +104 1 +105 1 +106 1 +107 1 +108 1 +109 1 +*** MDEV-6917: Parallel replication: "Commit failed due to failure of an earlier commit on which this one depends", but no prior failure seen ** +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (10, foo(1, 'before_execute_sql_command WAIT_FOR t1_start', '')); +UPDATE t3 SET b=NULL WHERE a=6; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued1'; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (20, foo(2, 'group_commit_waiting_for_prior SIGNAL t2_waiting', '')); +DELETE FROM t3 WHERE b <= 3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued2'; +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (30, foo(3, 'before_execute_sql_command WAIT_FOR t3_start', 'group_commit_waiting_for_prior SIGNAL t3_waiting')); +INSERT INTO t3 VALUES (7,7); +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +COMMIT; +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; +SET binlog_format=@old_format; +SET binlog_format=@old_format; +SET debug_sync='RESET'; +SET binlog_format=@old_format; +SELECT * FROM t3 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +7 7 +SET @old_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,thd_need_ordering_with_force"; +include/start_slave.inc +SET debug_sync='now WAIT_FOR t2_waiting'; +SET debug_sync='now SIGNAL t3_start'; +SET debug_sync='now WAIT_FOR t3_waiting'; +SET debug_sync='now SIGNAL t1_start'; +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; +retries +1 +SELECT * FROM t3 ORDER BY a; +a b +1 NULL +3 NULL +4 4 +5 NULL +6 NULL +7 7 +SET binlog_format=@old_format; include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; include/start_slave.inc -DROP TABLE t1, t2; +DROP TABLE t1, t2, t3, t4; DROP function foo; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result index b69deb17c4c..d454fa41111 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_show_binlog_events_purge_logs.result @@ -7,7 +7,6 @@ SHOW BINLOG EVENTS; SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; FLUSH LOGS; SET DEBUG_SYNC= 'now SIGNAL end'; -SET DEBUG_SYNC= 'RESET'; [connection slave] SET DEBUG_SYNC= 'RESET'; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result index 289cc313e2a..cc537f83ca4 100644 --- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result @@ -13,6 +13,36 @@ INSERT INTO tt_2(ddl_case) VALUES(0); # CHECK IMPLICT COMMIT ######################################################################### SET AUTOCOMMIT= 0; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; diff --git a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result index 4e8e83d2187..39e1541eb0e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -15011,6 +15022,460 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_5) +master-bin.000001 # Table_map # # table_id: # (test.nt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.tt_5) +master-bin.000001 # Table_map # # table_id: # (test.tt_6) +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.tt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Table_map # # table_id: # (test.nt_3) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -15034,4 +15499,5 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result index 91adfc7965c..cb702ad64ef 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result @@ -13,6 +13,34 @@ INSERT INTO tt_2(ddl_case) VALUES(0); # CHECK IMPLICT COMMIT ######################################################################### SET AUTOCOMMIT= 0; +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (43); +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (43) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "LIB" +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +INSERT INTO tt_1(ddl_case) VALUES (42); +DROP FUNCTION myfunc_int; +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (42) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP FUNCTION myfunc_int +-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e- + -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b- INSERT INTO tt_1(ddl_case) VALUES (41); LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; diff --git a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result index 9ca811c29c8..1cf49b30fcd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result +++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result @@ -63,6 +63,17 @@ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1); RETURN "fc_i_nt_5_suc"; END| +CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64) +BEGIN +DECLARE in_stmt_id INTEGER; +SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id; +SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id; +INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id); +RETURN "fc_i_nt_3_tt_3_suc"; +END| CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW BEGIN DECLARE in_stmt_id INTEGER; @@ -12521,6 +12532,344 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_16` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e- +################################################################################### +# 5 - SET WITH ROW CHANGES +################################################################################### +rpl_mixing_engines.inc [commands=set-T] +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(363, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(363,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-N] +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(364, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(364,1) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=set-NT] +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(365, 1); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(365,1) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(366, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(366, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(366,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(366,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(367, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(367, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(367,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(367,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-N set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(368, 2); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(368, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-N set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(368,2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(368,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-N set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-N R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(369, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-N << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_5_suc(369, 4); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +-e-e-e-e-e-e-e-e-e-e-e- >> set-N << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-N R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(369,4) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(369,2) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-N R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(370, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(370, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(370,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(370,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT C] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(371, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(371, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b- +COMMIT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT C << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(371,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(371,4) +master-bin.000001 # Xid # # COMMIT /* XID */ +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT C << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-NT set-T R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(372, 2); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(372, 4); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-NT set-T R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(372,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(372,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-NT set-T R << -e-e-e-e-e-e-e-e-e-e-e- + +rpl_mixing_engines.inc [commands=B set-T set-NT R] +-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b- +BEGIN; +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-T << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_tt_5_suc(373, 2); +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-T << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> set-NT << -b-b-b-b-b-b-b-b-b-b-b- +SET @var= fc_i_nt_3_tt_3_suc(373, 4); +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +include/show_binlog_events.inc +-e-e-e-e-e-e-e-e-e-e-e- >> set-NT << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b- +ROLLBACK; +Warnings: +Warning # Some non-transactional changed tables couldn't be rolled back +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e- +-b-b-b-b-b-b-b-b-b-b-b- >> B set-T set-NT R << -b-b-b-b-b-b-b-b-b-b-b- +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(373,2) +master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_3_tt_3_suc`(373,4) +master-bin.000001 # Query # # ROLLBACK +-e-e-e-e-e-e-e-e-e-e-e- >> B set-T set-NT R << -e-e-e-e-e-e-e-e-e-e-e- + ################################################################################### # CHECK CONSISTENCY ################################################################################### @@ -12544,6 +12893,7 @@ DROP PROCEDURE pc_i_tt_5_suc; DROP PROCEDURE pc_i_nt_5_suc; DROP FUNCTION fc_i_tt_5_suc; DROP FUNCTION fc_i_nt_5_suc; +DROP FUNCTION fc_i_nt_3_tt_3_suc; include/rpl_reset.inc CREATE TABLE `t1` ( `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test new file mode 100644 index 00000000000..76e7c60fd59 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test @@ -0,0 +1,53 @@ +--source include/have_innodb.inc +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +# +# Bug#68220: innodb_rows_updated is misleading on slave when *info_repository=TABLE +# + +# created all the base variables at the beginning at the test +--connection master +select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; + +--connection slave +select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read'; +select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated'; +select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted'; +select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted'; +select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read'; +select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated'; +select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted'; +select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted'; + +--connection master +CREATE DATABASE testdb; +USE testdb; +CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB; + +# insert a row and show counters on master and slave +INSERT INTO testdb.t1 VALUES (1); +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# update the row and show counters on master and slave +UPDATE t1 SET i=2 WHERE i=1; +--sync_slave_with_master +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# delete the row and show counters on master and slave +DELETE FROM t1 WHERE i=2; +--source suite/rpl/include/rpl_innodb_rows_counters.inc + +# clean the test +DROP TABLE t1; +DROP DATABASE testdb; +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test index 161ab2f9dca..b2e8308b34d 100644 --- a/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_mixed.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test index 4f01ef7765b..d3ec08f5508 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel.test +++ b/mysql-test/suite/rpl/t/rpl_parallel.test @@ -1466,6 +1466,75 @@ SET sql_slave_skip_counter= 1; SELECT * FROM t2 WHERE a >= 30 ORDER BY a; +--echo *** MDEV-6775: Wrong binlog order in parallel replication *** +--connection server_1 +# A bit tricky bug to reproduce. On the master, we binlog in statement-mode +# two transactions, an UPDATE followed by a DELETE. On the slave, we replicate +# with binlog-mode set to ROW, which means the DELETE, which modifies no rows, +# is not binlogged. Then we inject a wait in the group commit code on the +# slave, shortly before the actual commit of the UPDATE. The bug was that the +# DELETE could wake up from wait_for_prior_commit() before the commit of the +# UPDATE. So the test could see the slave position updated to after DELETE, +# while the UPDATE was still not visible. +DELETE FROM t4; +INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); +--source include/save_master_gtid.inc + +--connection server_2 +--source include/sync_with_master_gtid.inc +--source include/stop_slave.inc +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,inject_binlog_commit_before_get_LOCK_log"; +SET @old_format=@@GLOBAL.binlog_format; +SET GLOBAL binlog_format=ROW; +# Re-spawn the worker threads to be sure they pick up the new binlog format +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; + +--connection con1 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send UPDATE t4 SET b=NULL WHERE a=6; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connection con2 +SET @old_format= @@binlog_format; +SET binlog_format= statement; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send DELETE FROM t4 WHERE b <= 3; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format= @old_format; +--connection con2 +REAP; +SET binlog_format= @old_format; +SET debug_sync='RESET'; +--save_master_pos +SELECT * FROM t4 ORDER BY a; + +--connection server_2 +--source include/start_slave.inc +SET debug_sync= 'now WAIT_FOR waiting'; +--sync_with_master +SELECT * FROM t4 ORDER BY a; +SET debug_sync= 'now SIGNAL cont'; + +# Re-spawn the worker threads to remove any DBUG injections or DEBUG_SYNC. +--source include/stop_slave.inc +SET GLOBAL debug_dbug=@old_dbug; +SET GLOBAL binlog_format= @old_format; +SET GLOBAL slave_parallel_threads=0; +SET GLOBAL slave_parallel_threads=10; +--source include/start_slave.inc + + --connection server_2 --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test index d3be6262cb0..b3a8ea45cf0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test @@ -135,7 +135,6 @@ SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_gtid_0_x_100,rpl_parall let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); START SLAVE; --let $slave_sql_errno= 1213 ---let $slave_timeout= 10 --source include/wait_for_slave_sql_error.inc SET GLOBAL debug_dbug=@old_dbug; let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); @@ -208,13 +207,178 @@ SELECT a, LENGTH(b) FROM t2 ORDER BY a; SET GLOBAL max_relay_log_size=@old_max; +--echo *** MDEV-7065: Incorrect relay log position in parallel replication after retry of transaction *** + +--connection server_2 +--source include/stop_slave.inc + +--connection server_1 +BEGIN; +INSERT INTO t1 VALUES (100, 0); +INSERT INTO t1 VALUES (101, 0); +INSERT INTO t1 VALUES (102, 0); +INSERT INTO t1 VALUES (103, 0); +COMMIT; +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +--save_master_pos + +--connection server_2 +# Inject a DBUG error insert to cause the XID event of the single transaction +# from the master to fail with a deadlock error and be retried. +# The bug was that the retry of the XID would leave the relay log position +# incorrect (off by the size of XID event). +SET @old_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,rpl_parallel_simulate_temp_err_xid"; +let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--source include/start_slave.inc +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; +let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--disable_query_log +eval SELECT $new_retry - $old_retry AS retries; +--enable_query_log + +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; +# Stop the SQL thread. When the bug was there to give the incorrect relay log +# position, the restart of the SQL thread would read garbage data from the +# middle of an event and fail with relay log IO error. +--source include/stop_slave_sql.inc + +--connection server_1 +INSERT INTO t1 VALUES (104, 1); +INSERT INTO t1 VALUES (105, 1); +INSERT INTO t1 VALUES (106, 1); +INSERT INTO t1 VALUES (107, 1); +INSERT INTO t1 VALUES (108, 1); +INSERT INTO t1 VALUES (109, 1); +--save_master_pos + +--connection server_2 +--source include/start_slave.inc +--sync_with_master +SELECT * FROM t1 WHERE a >= 100 ORDER BY a; + + +--echo *** MDEV-6917: Parallel replication: "Commit failed due to failure of an earlier commit on which this one depends", but no prior failure seen ** + +--connection server_1 +CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6); +CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; + +# We need statement binlog format to be able to inject debug_sync statements +# on the slave with calls to foo(). +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +--save_master_pos + +--connection server_2 +--sync_with_master +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=no; + +--connection server_1 + +# Create a group commit with three transactions T1, T2, T3. +# T2 will block T1 on the slave where we will make it run first, so it will be +# deadlock killed. +# The bug was that in this case, T3 was signalled to fail due to T2 failing, +# even though the retry of T2 was later successful. + +--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (10, foo(1, 'before_execute_sql_command WAIT_FOR t1_start', '')); +UPDATE t3 SET b=NULL WHERE a=6; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1'; +send COMMIT; +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued1'; + +--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (20, foo(2, 'group_commit_waiting_for_prior SIGNAL t2_waiting', '')); +DELETE FROM t3 WHERE b <= 3; +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2'; +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued2'; + +--connect (con3,127.0.0.1,root,,test,$SERVER_MYPORT_1,) +SET @old_format= @@SESSION.binlog_format; +SET binlog_format='statement'; +BEGIN; +INSERT INTO t4 VALUES (30, foo(3, 'before_execute_sql_command WAIT_FOR t3_start', 'group_commit_waiting_for_prior SIGNAL t3_waiting')); +INSERT INTO t3 VALUES (7,7); +SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued3'; +send COMMIT; + +--connection server_1 +SET debug_sync='now WAIT_FOR master_queued3'; +SET debug_sync='now SIGNAL master_cont1'; + +--connection con1 +REAP; +SET binlog_format=@old_format; +--connection con2 +REAP; +SET binlog_format=@old_format; +--connection con3 +REAP; +SET debug_sync='RESET'; +SET binlog_format=@old_format; + +--connection server_1 +--save_master_pos +SELECT * FROM t3 ORDER BY a; + + +--connection server_2 +let $old_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +SET @old_dbug=@@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,thd_need_ordering_with_force"; +--source include/start_slave.inc +# First, wait for T2 to complete up to where it is waiting for T1 to group +# commit for both of them. This will set locks that will block T1, causing +# a deadlock kill and retry of T2. T1 and T3 are still blocked at the start +# of each their SQL statements. +SET debug_sync='now WAIT_FOR t2_waiting'; +# Now let T3 move on until the point where it is itself ready to commit. +SET debug_sync='now SIGNAL t3_start'; +SET debug_sync='now WAIT_FOR t3_waiting'; +# Now T2 and T3 are set up, so we can let T1 proceed. +SET debug_sync='now SIGNAL t1_start'; +# Now we can wait for the slave to catch up. +# We should see T2 being deadlock killed and retried. +# The bug was that T2 deadlock kill would cause T3 to fail due to failure +# of an earlier commit. This is wrong as T2 did not fail, it was only +# retried. +--sync_with_master +SET GLOBAL debug_dbug=@old_dbug; +SET debug_sync='RESET'; +let $new_retry= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1); +--disable_query_log +eval SELECT $new_retry - $old_retry >= 1 AS retries; +--enable_query_log +SELECT * FROM t3 ORDER BY a; + + +--connection server_1 +SET binlog_format=@old_format; + + +# Clean up. --connection server_2 --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; --source include/start_slave.inc --connection server_1 -DROP TABLE t1, t2; +DROP TABLE t1, t2, t3, t4; DROP function foo; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test index 16d986268c9..83d847318d8 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_show_binlog_events_purge_logs.test @@ -22,7 +22,6 @@ SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events'; FLUSH LOGS; SET DEBUG_SYNC= 'now SIGNAL end'; -SET DEBUG_SYNC= 'RESET'; --echo [connection slave] --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test index 8eb397c3460..b13fa5a01b1 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_temptable.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_temptable.test @@ -1,6 +1,8 @@ --source include/have_innodb.inc --source include/have_debug.inc --source include/have_binlog_format_statement.inc +# Valgrind does not work well with test that crashes the server +--source include/not_valgrind.inc --let $rpl_topology=1->2 --source include/rpl_init.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test index cfad4fca433..2b35f68ff63 100644 --- a/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test index 7ba5e90b96d..84c5c215a08 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_hosts.test @@ -25,6 +25,11 @@ let $field= Server_id; # 3 is server_id of slave2. let $condition= ='3'; source include/wait_show_condition.inc; +# Make sure that the other slave also had time to register. Otherwise we get +# occasional spurious failures where server_id=2 is missing from SHOW SLAVE +# HOSTS, when that slave is much slower to register due to thread scheduling. +let $condition= ='2'; +source include/wait_show_condition.inc; --replace_column 3 'SLAVE_PORT' --replace_result $SLAVE_MYPORT SLAVE_PORT $DEFAULT_MASTER_PORT DEFAULT_PORT SHOW SLAVE HOSTS; diff --git a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test index ae59008c3ee..1e66b76abc8 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test +++ b/mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test @@ -1,6 +1,7 @@ ################################################################################ # Check file extra/rpl_tests/rpl_implicit_commit_binlog.test ################################################################################ +--source include/have_udf.inc --source include/have_binlog_format_statement.inc --source include/master-slave.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test index 995878424f4..8256d068ade 100644 --- a/mysql-test/suite/storage_engine/trx/xa_recovery.test +++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test @@ -56,10 +56,14 @@ XA PREPARE 'xa2'; --connection default --enable_reconnect --append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart +wait EOF --shutdown_server 0 --source include/wait_until_disconnected.inc + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF --source include/wait_until_connected_again.inc XA RECOVER; XA ROLLBACK 'xa1'; diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_func.result b/mysql-test/suite/sys_vars/r/character_set_connection_func.result index 6fc33a4f369..7f3c4e42ce6 100644 --- a/mysql-test/suite/sys_vars/r/character_set_connection_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_connection_func.result @@ -11,7 +11,7 @@ SELECT @@global.character_set_connection; utf8 SELECT @@session.character_set_connection; @@session.character_set_connection -utf8 +latin1 '#--------------------FN_DYNVARS_011_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/character_set_results_func.result b/mysql-test/suite/sys_vars/r/character_set_results_func.result index d92821fdfa6..14bad0f4eb4 100644 --- a/mysql-test/suite/sys_vars/r/character_set_results_func.result +++ b/mysql-test/suite/sys_vars/r/character_set_results_func.result @@ -9,7 +9,7 @@ SELECT @@global.character_set_results; utf8 SELECT @@session.character_set_results; @@session.character_set_results -utf8 +latin1 '#--------------------FN_DYNVARS_012_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/collation_connection_func.result b/mysql-test/suite/sys_vars/r/collation_connection_func.result index 18f82dc60e1..b40efda517f 100644 --- a/mysql-test/suite/sys_vars/r/collation_connection_func.result +++ b/mysql-test/suite/sys_vars/r/collation_connection_func.result @@ -9,7 +9,7 @@ SELECT @@global.collation_connection; latin1_danish_ci SELECT @@session.collation_connection; @@session.collation_connection -latin1_danish_ci +latin1_swedish_ci '#--------------------FN_DYNVARS_015_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result index 1797845def2..bfd59cfd9cc 100644 --- a/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_adaptive_flushing_lwm_basic.result @@ -7,55 +7,55 @@ SET @@global.innodb_adaptive_flushing_lwm = 1; SET @@global.innodb_adaptive_flushing_lwm = DEFAULT; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -10 +10.000000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_adaptive_flushing_lwm = 1; ERROR HY000: Variable 'innodb_adaptive_flushing_lwm' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_adaptive_flushing_lwm; @@innodb_adaptive_flushing_lwm -10 +10.000000 SELECT local.innodb_adaptive_flushing_lwm; ERROR 42S02: Unknown table 'local' in field list SET global innodb_adaptive_flushing_lwm = 1; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_adaptive_flushing_lwm = 1; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 SET @@global.innodb_adaptive_flushing_lwm = 60; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -60 +60.000000 SET @@global.innodb_adaptive_flushing_lwm = 70; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_adaptive_flushing_lwm = -1; Warnings: Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '-1' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = 71; Warnings: Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '71' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_adaptive_flushing_lwm = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -65,32 +65,32 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_adaptive_flushing_lwm'; VARIABLE_VALUE -70 +70.000000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_adaptive_flushing_lwm = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 SET @@global.innodb_adaptive_flushing_lwm = ON; ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm' SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -70 +70.000000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_adaptive_flushing_lwm = TRUE; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -1 +1.000000 SET @@global.innodb_adaptive_flushing_lwm = FALSE; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -0 +0.000000 SET @@global.innodb_adaptive_flushing_lwm = @global_start_value; SELECT @@global.innodb_adaptive_flushing_lwm; @@global.innodb_adaptive_flushing_lwm -10 +10.000000 diff --git a/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result b/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result index ebc934acf6e..f22d11e1b62 100644 --- a/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_io_capacity_max_basic.result @@ -45,27 +45,42 @@ set global innodb_io_capacity_max=1e1; ERROR 42000: Incorrect argument type to variable 'innodb_io_capacity_max' set global innodb_io_capacity_max="foo"; ERROR 42000: Incorrect argument type to variable 'innodb_io_capacity_max' -set global innodb_io_capacity_max=@start_innodb_capacity - 1; +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity_max=400; Warnings: -Warning 1210 innodb_io_capacity_max cannot be set lower than innodb_io_capacity. -Warning 1210 Setting innodb_io_capacity_max to 200 +Warning 1210 Setting innodb_io_capacity_max 400 lower than innodb_io_capacity 500. +Warning 1210 Setting innodb_io_capacity to 400 select @@global.innodb_io_capacity_max; @@global.innodb_io_capacity_max -200 +400 +select @@global.innodb_io_capacity; +@@global.innodb_io_capacity +400 select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; VARIABLE_NAME VARIABLE_VALUE -INNODB_IO_CAPACITY_MAX 200 -set global innodb_io_capacity_max=-7; +INNODB_IO_CAPACITY_MAX 400 +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_IO_CAPACITY 400 +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity=1400; Warnings: -Warning 1292 Truncated incorrect innodb_io_capacity_max value: '-7' -Warning 1210 innodb_io_capacity_max cannot be set lower than innodb_io_capacity. -Warning 1210 Setting innodb_io_capacity_max to 200 +Warning 1210 Setting innodb_io_capacity to 1400 higher than innodb_io_capacity_max 1000 +Warning 1210 Setting innodb_max_io_capacity to 2800 select @@global.innodb_io_capacity_max; @@global.innodb_io_capacity_max -200 +2800 +select @@global.innodb_io_capacity; +@@global.innodb_io_capacity +1400 select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; VARIABLE_NAME VARIABLE_VALUE -INNODB_IO_CAPACITY_MAX 200 +INNODB_IO_CAPACITY_MAX 2800 +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_IO_CAPACITY 1400 set global innodb_io_capacity=100; set global innodb_io_capacity_max=100; select @@global.innodb_io_capacity_max; diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result index eff72613102..d705624eb53 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_basic.result @@ -4,58 +4,64 @@ SELECT @global_start_value; 75 '#--------------------FN_DYNVARS_046_01------------------------#' SET @@global.innodb_max_dirty_pages_pct = 0; -SET @@global.innodb_max_dirty_pages_pct = DEFAULT; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' +SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_max_dirty_pages_pct = 1; ERROR HY000: Variable 'innodb_max_dirty_pages_pct' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_max_dirty_pages_pct; @@innodb_max_dirty_pages_pct -75 +75.000000 SELECT local.innodb_max_dirty_pages_pct; ERROR 42S02: Unknown table 'local' in field list SET global innodb_max_dirty_pages_pct = 0; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_max_dirty_pages_pct = 0; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = 1; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct = 99; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_max_dirty_pages_pct = -1; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '-1' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = 1001; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '1001' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_max_dirty_pages_pct = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -65,32 +71,34 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct'; VARIABLE_VALUE -99 +99.999000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_max_dirty_pages_pct = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 SET @@global.innodb_max_dirty_pages_pct = ON; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -99 +99.999000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_max_dirty_pages_pct = TRUE; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct = FALSE; +Warnings: +Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -0 +0.001000 SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result index 55de5adbc33..05aa3e5fd89 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result @@ -5,13 +5,13 @@ SET @@global.innodb_max_dirty_pages_pct = 80; 'connection con1' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -80 +80.000000 SET @@global.innodb_max_dirty_pages_pct = 70; 'connect (con2,localhost,root,,,,)' 'connection con2' SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -70 +70.000000 'connection default' 'disconnect con2' 'disconnect con1' diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result index 82388cebc82..676ec103664 100644 --- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_lwm_basic.result @@ -1,70 +1,70 @@ SET @pct_lwm_start_value = @@global.innodb_max_dirty_pages_pct_lwm; SELECT @pct_lwm_start_value; @pct_lwm_start_value -0 +0.001 SET @pct_start_value = @@global.innodb_max_dirty_pages_pct; SELECT @pct_start_value; @pct_start_value 75 '#--------------------FN_DYNVARS_046_01------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = 0; -SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.001000 '#---------------------FN_DYNVARS_046_02-------------------------#' SET innodb_max_dirty_pages_pct_lwm = 1; ERROR HY000: Variable 'innodb_max_dirty_pages_pct_lwm' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@innodb_max_dirty_pages_pct_lwm; @@innodb_max_dirty_pages_pct_lwm -0 +0.001000 SELECT local.innodb_max_dirty_pages_pct_lwm; ERROR 42S02: Unknown table 'local' in field list SET global innodb_max_dirty_pages_pct_lwm = 0; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 '#--------------------FN_DYNVARS_046_03------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = 0; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#--------------------FN_DYNVARS_046_04-------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = -1; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '-1' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = "T"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = "Y"; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value + 1; Warnings: Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct. -Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75 +Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = 100; Warnings: Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '100' Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct. -Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75 +Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#----------------------FN_DYNVARS_046_05------------------------#' SELECT @@global.innodb_max_dirty_pages_pct_lwm = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -74,36 +74,36 @@ VARIABLE_VALUE 1 SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct_lwm'; VARIABLE_VALUE -75 +75.000000 '#---------------------FN_DYNVARS_046_06-------------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = OFF; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = ON; ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm' SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -75 +75.000000 '#---------------------FN_DYNVARS_046_07----------------------#' SET @@global.innodb_max_dirty_pages_pct_lwm = TRUE; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -1 +1.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = FALSE; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.000000 SET @@global.innodb_max_dirty_pages_pct = @pct_start_value; SELECT @@global.innodb_max_dirty_pages_pct; @@global.innodb_max_dirty_pages_pct -75 +75.000000 SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; @@global.innodb_max_dirty_pages_pct_lwm -0 +0.001000 diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result index 6f1c4c21d17..8c0af874228 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result @@ -207,6 +207,10 @@ dml_reads disabled dml_inserts disabled dml_deletes disabled dml_updates disabled +dml_system_reads disabled +dml_system_inserts disabled +dml_system_deletes disabled +dml_system_updates disabled ddl_background_drop_indexes disabled ddl_background_drop_tables disabled ddl_online_create_index disabled @@ -429,6 +433,10 @@ dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled delete from monitor_test; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -439,6 +447,10 @@ dml_reads 6 NULL 6 6 NULL 6 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -449,6 +461,10 @@ dml_reads 6 NULL 6 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled insert into monitor_test values(9); insert into monitor_test values(1); delete from monitor_test; @@ -461,6 +477,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -471,6 +491,10 @@ dml_reads 8 NULL 8 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled +dml_system_reads 0 NULL 0 0 NULL 0 enabled +dml_system_inserts 0 NULL 0 0 NULL 0 enabled +dml_system_deletes 0 NULL 0 0 NULL 0 enabled +dml_system_updates 0 NULL 0 0 NULL 0 enabled set global innodb_monitor_disable = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -481,6 +505,10 @@ dml_reads 8 NULL 8 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled +dml_system_reads 0 NULL 0 0 NULL 0 disabled +dml_system_inserts 0 NULL 0 0 NULL 0 disabled +dml_system_deletes 0 NULL 0 0 NULL 0 disabled +dml_system_updates 0 NULL 0 0 NULL 0 disabled set global innodb_monitor_reset_all = module_dml; select name, max_count, min_count, count, max_count_reset, min_count_reset, count_reset, status @@ -491,6 +519,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts NULL NULL 0 NULL NULL 0 disabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_enable = dml_inserts; insert into monitor_test values(9); insert into monitor_test values(1); @@ -504,6 +536,10 @@ dml_reads NULL NULL 0 NULL NULL 0 disabled dml_inserts 2 NULL 2 2 NULL 2 enabled dml_deletes NULL NULL 0 NULL NULL 0 disabled dml_updates NULL NULL 0 NULL NULL 0 disabled +dml_system_reads NULL NULL 0 NULL NULL 0 disabled +dml_system_inserts NULL NULL 0 NULL NULL 0 disabled +dml_system_deletes NULL NULL 0 NULL NULL 0 disabled +dml_system_updates NULL NULL 0 NULL NULL 0 disabled set global innodb_monitor_disable = module_dml; drop table monitor_test; set global innodb_monitor_enable = file_num_open_files; diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result new file mode 100644 index 00000000000..fa0861d7930 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_stats_modified_counter_basic.result @@ -0,0 +1,56 @@ +SET @start_global_value = @@global.innodb_stats_modified_counter; +SELECT @start_global_value; +@start_global_value +0 +Valid values are one or above +select @@global.innodb_stats_modified_counter >=1; +@@global.innodb_stats_modified_counter >=1 +0 +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 +select @@session.innodb_stats_modified_counter; +ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable +show global variables like 'innodb_stats_modified_counter'; +Variable_name Value +innodb_stats_modified_counter 0 +show session variables like 'innodb_stats_modified_counter'; +Variable_name Value +innodb_stats_modified_counter 0 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +set global innodb_stats_modified_counter=10; +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +10 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 10 +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 10 +set session innodb_stats_modified_counter=1; +ERROR HY000: Variable 'innodb_stats_modified_counter' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_stats_modified_counter=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter="foo"; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_modified_counter' +set global innodb_stats_modified_counter=-7; +Warnings: +Warning 1292 Truncated incorrect innodb_stats_modified_counter value: '-7' +select @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_MODIFIED_COUNTER 0 +SET @@global.innodb_stats_modified_counter = @start_global_value; +SELECT @@global.innodb_stats_modified_counter; +@@global.innodb_stats_modified_counter +0 diff --git a/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result b/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result new file mode 100644 index 00000000000..00ee2877e58 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_stats_traditional_basic.result @@ -0,0 +1,92 @@ +SET @start_global_value = @@global.innodb_stats_traditional; +SELECT @start_global_value; +@start_global_value +1 +Valid values are 'ON' and 'OFF' +select @@global.innodb_stats_traditional in (0, 1); +@@global.innodb_stats_traditional in (0, 1) +1 +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select @@session.innodb_stats_traditional; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable +show global variables like 'innodb_stats_traditional'; +Variable_name Value +innodb_stats_traditional ON +show session variables like 'innodb_stats_traditional'; +Variable_name Value +innodb_stats_traditional ON +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional='OFF'; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +0 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +set @@global.innodb_stats_traditional=1; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional=0; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +0 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL OFF +set @@global.innodb_stats_traditional='ON'; +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set session innodb_stats_traditional='OFF'; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL +set @@session.innodb_stats_traditional='ON'; +ERROR HY000: Variable 'innodb_stats_traditional' is a GLOBAL variable and should be set with SET GLOBAL +set global innodb_stats_traditional=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional' +set global innodb_stats_traditional=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_stats_traditional' +set global innodb_stats_traditional=2; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '2' +set global innodb_stats_traditional=-3; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of '-3' +select @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_STATS_TRADITIONAL ON +set global innodb_stats_traditional='AUTO'; +ERROR 42000: Variable 'innodb_stats_traditional' can't be set to the value of 'AUTO' +SET @@global.innodb_stats_traditional = @start_global_value; +SELECT @@global.innodb_stats_traditional; +@@global.innodb_stats_traditional +1 diff --git a/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test index 125ceaa1c30..cedc6c0c45e 100644 --- a/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_io_capacity_max_basic.test @@ -25,7 +25,7 @@ select * from information_schema.global_variables where variable_name='innodb_io select * from information_schema.session_variables where variable_name='innodb_io_capacity_max'; # -# show that it's writable. Allowed value cannot be lower than innodb_io_capacity +# show that it's writable. # set global innodb_io_capacity_max=@start_innodb_capacity + 1; select @@global.innodb_io_capacity_max; @@ -45,15 +45,26 @@ set global innodb_io_capacity_max=1e1; set global innodb_io_capacity_max="foo"; # -# can't set it below innodb_io_capacity +# Setting io_capacity_max lower than io_capacity affects also io_capacity # -set global innodb_io_capacity_max=@start_innodb_capacity - 1; -select @@global.innodb_io_capacity_max; -select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; -set global innodb_io_capacity_max=-7; +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity_max=400; select @@global.innodb_io_capacity_max; +select @@global.innodb_io_capacity; select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; +# +# Setting io_capacity higher than io_capacity_max affects also io_capacity_max +# +set global innodb_io_capacity_max=1000; +set global innodb_io_capacity=500; +set global innodb_io_capacity=1400; +select @@global.innodb_io_capacity_max; +select @@global.innodb_io_capacity; +select * from information_schema.global_variables where variable_name='innodb_io_capacity_max'; +select * from information_schema.global_variables where variable_name='innodb_io_capacity'; # # min/max values # diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test index 7e70ed11351..5b4eaa41598 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test @@ -44,7 +44,7 @@ SELECT @global_start_value; ######################################################################## SET @@global.innodb_max_dirty_pages_pct = 0; -SET @@global.innodb_max_dirty_pages_pct = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct = @global_start_value; SELECT @@global.innodb_max_dirty_pages_pct; --echo '#---------------------FN_DYNVARS_046_02-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test index 7a6da2e6a08..d81b6cc725b 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_lwm_basic.test @@ -47,7 +47,7 @@ SELECT @pct_start_value; ######################################################################## SET @@global.innodb_max_dirty_pages_pct_lwm = 0; -SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT; +SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value; SELECT @@global.innodb_max_dirty_pages_pct_lwm; --echo '#---------------------FN_DYNVARS_046_02-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test new file mode 100644 index 00000000000..98fc804906b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_stats_modified_counter_basic.test @@ -0,0 +1,47 @@ +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_stats_modified_counter; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are one or above +select @@global.innodb_stats_modified_counter >=1; +select @@global.innodb_stats_modified_counter; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_stats_modified_counter; +show global variables like 'innodb_stats_modified_counter'; +show session variables like 'innodb_stats_modified_counter'; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; + +# +# show that it's writable +# +set global innodb_stats_modified_counter=10; +select @@global.innodb_stats_modified_counter; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; +select * from information_schema.session_variables where variable_name='innodb_stats_modified_counter'; +--error ER_GLOBAL_VARIABLE +set session innodb_stats_modified_counter=1; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter=1e1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_modified_counter="foo"; + +set global innodb_stats_modified_counter=-7; +select @@global.innodb_stats_modified_counter; +select * from information_schema.global_variables where variable_name='innodb_stats_modified_counter'; + +# +# cleanup +# +SET @@global.innodb_stats_modified_counter = @start_global_value; +SELECT @@global.innodb_stats_modified_counter; diff --git a/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test new file mode 100644 index 00000000000..d0872616114 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_stats_traditional_basic.test @@ -0,0 +1,65 @@ +--source include/have_innodb.inc + +SET @start_global_value = @@global.innodb_stats_traditional; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are 'ON' and 'OFF' +select @@global.innodb_stats_traditional in (0, 1); +select @@global.innodb_stats_traditional; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +select @@session.innodb_stats_traditional; +show global variables like 'innodb_stats_traditional'; +show session variables like 'innodb_stats_traditional'; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; + +# +# show that it's writable +# +set global innodb_stats_traditional='OFF'; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set @@global.innodb_stats_traditional=1; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set global innodb_stats_traditional=0; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +set @@global.innodb_stats_traditional='ON'; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +--error ER_GLOBAL_VARIABLE +set session innodb_stats_traditional='OFF'; +--error ER_GLOBAL_VARIABLE +set @@session.innodb_stats_traditional='ON'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_traditional=1.1; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_stats_traditional=1e1; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional=2; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional=-3; +select @@global.innodb_stats_traditional; +select * from information_schema.global_variables where variable_name='innodb_stats_traditional'; +select * from information_schema.session_variables where variable_name='innodb_stats_traditional'; +--error ER_WRONG_VALUE_FOR_VAR +set global innodb_stats_traditional='AUTO'; + +# +# Cleanup +# + +SET @@global.innodb_stats_traditional = @start_global_value; +SELECT @@global.innodb_stats_traditional; diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result new file mode 100644 index 00000000000..06627fccf8b --- /dev/null +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -0,0 +1,67 @@ +set lc_time_names = 'es_MX'; +set time_zone='+10:00'; +set div_precision_increment=20; +create table t1 (a int, b int, v decimal(20,19) as (a/3)); +create table t2 (a int, b int, v int as (a+@a)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t3 (a int, b int, v int as (a+@@error_count)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t4 (a int, b int, v int as (@a:=a)); +ERROR HY000: Function or expression is not allowed for column 'v' +create table t5 (a int, b int, v varchar(100) as (monthname(a))); +create table t6 (a int, b int, v varchar(100) as (dayname(a))); +create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b'))); +create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); +insert t1 (a,b) values (1,2); +insert t5 (a,b) values (20141010,2); +insert t6 (a,b) values (20141010,2); +insert t7 (a,b) values (20141010,2); +insert t8 (a,b) values (1234567890,2); +select * from t1; +a b v +1 2 0.3333333333333333333 +select * from t5; +a b v +20141010 2 octubre +select * from t6; +a b v +20141010 2 viernes +select * from t7; +a b v +20141010 2 viernes vie octubre oct +select * from t8; +a b v +1234567890 2 2009-02-14 09:31:30 +set time_zone='+1:00'; +select * from t1; +a b v +1 2 0.3333333333333333333 +select * from t5; +a b v +20141010 2 octubre +select * from t6; +a b v +20141010 2 viernes +select * from t7; +a b v +20141010 2 viernes vie octubre oct +select * from t8; +a b v +1234567890 2 2009-02-14 09:31:30 +flush tables; +select * from t1; +a b v +1 2 0.3333333330000000000 +select * from t5; +a b v +20141010 2 October +select * from t6; +a b v +20141010 2 Friday +select * from t7; +a b v +20141010 2 Friday Fri October Oct +select * from t8; +a b v +1234567890 2 2009-02-14 00:31:30 +drop table t1, t5, t6, t7, t8; diff --git a/mysql-test/suite/vcol/t/not_supported.test b/mysql-test/suite/vcol/t/not_supported.test new file mode 100644 index 00000000000..70b9dea69fd --- /dev/null +++ b/mysql-test/suite/vcol/t/not_supported.test @@ -0,0 +1,58 @@ +# +# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor +# + +# the following functions must not be supported in virtual columns. +# but for compatibility reasons it won't be done in a GA version, +# we'll only fix most critical issues (inconsistent results, crashes) + +connect (con1, localhost, root); + +set lc_time_names = 'es_MX'; +set time_zone='+10:00'; +set div_precision_increment=20; + +create table t1 (a int, b int, v decimal(20,19) as (a/3)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t2 (a int, b int, v int as (a+@a)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t3 (a int, b int, v int as (a+@@error_count)); +--error ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED +create table t4 (a int, b int, v int as (@a:=a)); +create table t5 (a int, b int, v varchar(100) as (monthname(a))); +create table t6 (a int, b int, v varchar(100) as (dayname(a))); +create table t7 (a int, b int, v varchar(100) as (date_format(a, '%W %a %M %b'))); +create table t8 (a int, b int, v varchar(100) as (from_unixtime(a))); + +insert t1 (a,b) values (1,2); +insert t5 (a,b) values (20141010,2); +insert t6 (a,b) values (20141010,2); +insert t7 (a,b) values (20141010,2); +insert t8 (a,b) values (1234567890,2); + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +disconnect con1; +connection default; +set time_zone='+1:00'; + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +flush tables; + +select * from t1; +select * from t5; +select * from t6; +select * from t7; +select * from t8; + +drop table t1, t5, t6, t7, t8; + diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt index 1b8937b91f3..5a4902eeafd 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.opt +++ b/mysql-test/suite/wsrep/t/binlog_format.opt @@ -1 +1 @@ ---binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' --wsrep-on=1 --log-bin +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' --wsrep-on=1 --log-bin diff --git a/mysql-test/suite/wsrep/t/foreign_key.opt b/mysql-test/suite/wsrep/t/foreign_key.opt index 9d6f257aca7..ebc85eae9f0 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.opt +++ b/mysql-test/suite/wsrep/t/foreign_key.opt @@ -1 +1 @@ ---binlog-format=row --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_provider_options='base_port=$GALERA_BASE_PORT' diff --git a/mysql-test/suite/wsrep/t/foreign_key.test b/mysql-test/suite/wsrep/t/foreign_key.test index 87eb4a88115..71f6076a1d7 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.test +++ b/mysql-test/suite/wsrep/t/foreign_key.test @@ -1,4 +1,5 @@ --source include/have_wsrep_enabled.inc +--source include/have_binlog_format_row.inc --source include/have_innodb.inc USE test; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 8bb7339ce83..4d57a5a110a 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2022,9 +2022,40 @@ select * from t1; unlock tables; drop table t1,t2; +--echo # +--echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't +--echo # play nice with CREATE/ALTER TABLE +--echo # +create table t1 ( + color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent, + cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent, + item_name varchar(32) primary key, -- A common attribute for all items + i int, + dynamic_cols blob -- Dynamic columns will be stored here +); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES + ('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1); +INSERT INTO t1(item_name, dynamic_cols, i) VALUES + ('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2); + +select item_name, color, cl from t1; +show create table t1; + +drop table t1; + +create table t1 ( + n int, + c char(32) as (convert(cast(n as char), char)) persistent +); +insert into t1(n) values (1),(2),(3); + +select * from t1; +show create table t1; + +drop table t1; + # # MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS # --error ER_TABLE_MUST_HAVE_COLUMNS create table t1; - diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test new file mode 100644 index 00000000000..96a2666f69b --- /dev/null +++ b/mysql-test/t/ctype_cp932.test @@ -0,0 +1,29 @@ +-- source include/have_cp932.inc +--echo # +--echo # Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE +--echo # USED. +--echo # + +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET character_set_client= 'utf8'; +SET character_set_connection= 'utf8'; +SET character_set_results= 'utf8'; + +CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin); +INSERT INTO t1 VALUES('ï½¶ï½¶'); +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; + +ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin; +SELECT * FROM t1 WHERE a LIKE '%ï½¶'; +SELECT * FROM t1 WHERE a LIKE '_ï½¶'; +SELECT * FROM t1 WHERE a LIKE '%_ï½¶'; +DROP TABLE t1; + +## Reset to initial values +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index b146dc63626..be8e044f2e4 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -1,5 +1,7 @@ -- source include/have_ucs2.inc +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); + # # MySQL Bug#15276: MySQL ignores collation-server # diff --git a/mysql-test/t/ctype_ucs2_query_cache.test b/mysql-test/t/ctype_ucs2_query_cache.test index 0ac09b2ba4b..acb39419751 100644 --- a/mysql-test/t/ctype_ucs2_query_cache.test +++ b/mysql-test/t/ctype_ucs2_query_cache.test @@ -1,6 +1,8 @@ -- source include/have_query_cache.inc -- source include/have_ucs2.inc +call mtr.add_suppression("Cannot use ucs2 as character_set_client"); + --echo # --echo # Start of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index c92889da2dc..e4305ed9879 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -787,6 +787,14 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; ## TODO: add tests for all engines # +--echo # +--echo # MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS.. +--echo # +--error ER_INVALID_CHARACTER_STRING +DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); +--error ER_INVALID_CHARACTER_STRING +DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf16_def.test b/mysql-test/t/ctype_utf16_def.test index d8ef4a4278b..fad61b057c3 100644 --- a/mysql-test/t/ctype_utf16_def.test +++ b/mysql-test/t/ctype_utf16_def.test @@ -1,4 +1,5 @@ --source include/have_utf16.inc +call mtr.add_suppression("Cannot use utf16 as character_set_client"); # # Bug #32391 Character sets: crash with --character-set-server diff --git a/mysql-test/t/derived_opt.test b/mysql-test/t/derived_opt.test index b01c479111b..7f19553e4e5 100644 --- a/mysql-test/t/derived_opt.test +++ b/mysql-test/t/derived_opt.test @@ -1,6 +1,7 @@ # Initialize --disable_warnings -drop table if exists t1,t2,t3; +drop table if exists t0,t1,t2,t3; +drop database if exists test1; --enable_warnings set @exit_optimizer_switch=@@optimizer_switch; @@ -272,5 +273,95 @@ limit 10; drop table t1, t2, t3, t4; +--echo # +--echo # MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled +--echo # +create database test1; +use test1; + +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; + +CREATE TABLE t0 ( + f1 bigint(20) DEFAULT NULL, + f2 char(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two'); + +CREATE TABLE t1 ( + f1 decimal(64,30) DEFAULT NULL, + f2 varchar(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES +(NULL,'numeric column is NULL'), +(0.000000000000000000000000000000,NULL), +(5.000000000000000000000000000000,'five'), +(1.000000000000000000000000000000,'one'), +(3.000000000000000000000000000000,'three'); + +CREATE TABLE t2 ( + f1 double DEFAULT NULL, + f2 varbinary(50) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three'); + +create VIEW v0 AS select f1,f2 from t1 ; + +let $cnt= 27; +while ($cnt) +{ +# i runs from 1 to 27 + let $i= `select 28 - $cnt`; + let $prev=`select $i - 1`; + +# rem = i mod 3 + let $rem= `select MOD($i, 3)`; +# view uses $i, $prev and $rem: + eval create VIEW v$i AS select tab1_v$i.f1,tab1_v$i.f2 from t$rem tab1_v$i join v$prev tab2 on tab1_v$i.f1 = tab2.f1 and tab1_v$i.f2 = tab2.f2; + dec $cnt; +} + +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; +--echo # This used to hang forever: +EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27; + +use test; +drop database test1; +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; + + +--echo # +--echo # MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost() +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2 (a int, b int, c text); +insert into t2 +select + A.a + B.a* 10, + A.a + B.a* 10, + 'blob-data' +from t1 A, t1 B; + +set @tmp_jcl= @@join_cache_level; +set @tmp_os= @@optimizer_switch; +set join_cache_level=6; +set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on'; +explain +select * from + t1 join + (select * from t2 order by a limit 1000) as D1 +where + D1.a= t1.a; + +set join_cache_level=@tmp_jcl; +set optimizer_switch=@tmp_os; +drop table t1, t2; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index c5d442ebe49..65a94dcb49e 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -838,6 +838,32 @@ select group_concat(cast(column_json(dyn) as char)) from t1; drop table t1; +--echo # +--echo # MDEV-7116: Dynamic column hangs/segfaults +--echo # +create table t1 ( + impressions mediumblob +); + +insert into t1 values (""); + +update t1 +set impressions = column_add(impressions, + 'total', 12, + '2014-10-28 16:00:00', 3, + '2014-10-30 15:00:00', 3, + '2014-11-04 09:00:00', 6 + ); +update t1 +set impressions = column_add(impressions, + 'total', "a12", + '2014-10-28 16:00:00', "a3", + '2014-10-30 15:00:00', "a3", + '2014-11-04 09:00:00', "a6" + ); + +drop table t1; + --echo # --echo # end of 10.0 tests --echo # diff --git a/mysql-test/t/ext_key_noPK_6794.test b/mysql-test/t/ext_key_noPK_6794.test new file mode 100644 index 00000000000..fc8a2724c22 --- /dev/null +++ b/mysql-test/t/ext_key_noPK_6794.test @@ -0,0 +1,15 @@ +# +# MDEV-6794 XtraDB no longer using UNIQUE as clustered index when PK missing +# + +--source include/have_innodb.inc + +create table t1 (c1 int not null, c2 int, unique index(c1), index (c2)) engine=innodb; +insert into t1 (c1, c2) select 1, round(rand()*100); +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1; +select count(*) from t1; +--query_vertical explain select * from t1 where c2 = 1 order by c1 +drop table t1; + diff --git a/mysql-test/t/failed_auth_unixsocket.test b/mysql-test/t/failed_auth_unixsocket.test index ba31cf6a59f..f7345f44698 100644 --- a/mysql-test/t/failed_auth_unixsocket.test +++ b/mysql-test/t/failed_auth_unixsocket.test @@ -16,11 +16,17 @@ change_user $USER; eval install plugin unix_socket soname '$AUTH_SOCKET_SO'; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $USER USER +# Make sure that the replace works, even if $USER is 'user' or something else +# that matches other parts of the error message. +--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); +--let $replace=Access denied for user '$USER' +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $replace "Access denied for user 'USER'" +--disable_query_log --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR connect (fail,localhost,$USER); +--enable_query_log ---replace_result $USER USER +--replace_result $replace "Access denied for user 'USER'" --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR change_user $USER; diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index eaed0c88fe1..fc3d2697426 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -136,3 +136,12 @@ DROP TABLE t1; --echo # --echo # End of 5.3 tests --echo # + +# +# MDEV-4513 Valgrind warnings (Conditional jump or move depends on uninitialised value) in inflate on UNCOMPRESS +# +SELECT UNCOMPRESS(CAST(0 AS BINARY(5))); + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test index 7e8df840239..6710f5cf096 100644 --- a/mysql-test/t/func_regexp_pcre.test +++ b/mysql-test/t/func_regexp_pcre.test @@ -397,3 +397,8 @@ SET default_regex_flags='UNGREEDY'; SELECT REGEXP_SUBSTR('abc','.+'); SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2'); SET default_regex_flags=DEFAULT; + +--echo # +--echo # MDEV-6965 non-captured group \2 in regexp_replace +--echo # +SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that'); diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 6a99b975e81..d3703de26c5 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -180,3 +180,17 @@ select * from t1 where not (a+0); explain extended select * from t1 where not (a+0); drop table t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +--echo # +SELECT NOT NOT strcmp('a','b'); +EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b'); + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/function_defaults.test b/mysql-test/t/function_defaults.test index dd29b4609cb..f8b23d0eda8 100644 --- a/mysql-test/t/function_defaults.test +++ b/mysql-test/t/function_defaults.test @@ -2,8 +2,6 @@ --echo # Test of function defaults for any server, including embedded. --echo # ---source include/have_innodb.inc - --echo # --echo # Function defaults run 1. No microsecond precision. --echo # diff --git a/mysql-test/t/function_defaults_innodb.test b/mysql-test/t/function_defaults_innodb.test new file mode 100644 index 00000000000..de5a6d34b73 --- /dev/null +++ b/mysql-test/t/function_defaults_innodb.test @@ -0,0 +1,24 @@ +--echo # +--echo # Test of function defaults for any server, including embedded. +--echo # + +--source include/have_innodb.inc +set default_storage_engine=innodb; + +--echo # +--echo # Function defaults run 1. No microsecond precision. +--echo # +let $current_timestamp=CURRENT_TIMESTAMP; +let $now=NOW(); +let $timestamp=TIMESTAMP; +let $datetime=DATETIME; +source 'include/function_defaults.inc'; + +--echo # +--echo # Function defaults run 2. Six digits scale on seconds precision. +--echo # +let $current_timestamp=CURRENT_TIMESTAMP(6); +let $now=NOW(6); +let $timestamp=TIMESTAMP(6); +let $datetime=DATETIME(6); +source 'include/function_defaults.inc'; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index d20e4c1711e..2625ec5d3c9 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1413,6 +1413,11 @@ insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); select equals(`a`,convert(`a` using utf8)) from `t1`; drop table t1; +--echo # +--echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +--echo # +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); + --echo End of 5.3 tests --echo # diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 5d59acf9320..35bd447e9ea 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1650,6 +1650,20 @@ SET sql_mode='ONLY_FULL_GROUP_BY'; SELECT 1 AS test UNION SELECT 2 AS test ORDER BY test IS NULL ASC; SET sql_mode=''; +--echo # +--echo # MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key +--echo # +CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (6,'b'); + +CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p'); + +SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 ) +WHERE t1a.c1 = c2 GROUP BY i2; + +DROP TABLE t1,t2; + # # End of MariaDB 5.5 tests # diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index c809401bbf8..8c9be0ca8db 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -704,6 +704,7 @@ explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; create table t4 as select distinct a1, a2, b, c from t1; alter table t4 add unique index idxt4 (a1, a2, b, c); +--echo # This is "superceded" by MDEV-7118, and Loose Index Scan is again an option: explain select a1, a2, b, min(c) from t4 group by a1, a2, b; select a1, a2, b, min(c) from t4 group by a1, a2, b; @@ -1488,3 +1489,38 @@ SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; drop table t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +--echo # +CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2001-01-01'); +INSERT INTO t1 VALUES (1,'2001-01-02'); +INSERT INTO t1 VALUES (1,'2001-01-03'); +INSERT INTO t1 VALUES (1,' 2001-01-04'); +INSERT INTO t1 VALUES (2,'2001-01-01'); +INSERT INTO t1 VALUES (2,'2001-01-02'); +INSERT INTO t1 VALUES (2,'2001-01-03'); +INSERT INTO t1 VALUES (2,' 2001-01-04'); +INSERT INTO t1 VALUES (3,'2001-01-01'); +INSERT INTO t1 VALUES (3,'2001-01-02'); +INSERT INTO t1 VALUES (3,'2001-01-03'); +INSERT INTO t1 VALUES (3,' 2001-01-04'); +INSERT INTO t1 VALUES (4,'2001-01-01'); +INSERT INTO t1 VALUES (4,'2001-01-02'); +INSERT INTO t1 VALUES (4,'2001-01-03'); +INSERT INTO t1 VALUES (4,' 2001-01-04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; +DROP TABLE t1; + + +--echo # +--echo # End of 10.0 tests +--echo # + diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 09a3f590a1f..6f4c81a8bb5 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -496,7 +496,7 @@ drop table t_crashme; # select table_schema,table_name, column_name from information_schema.columns -where data_type = 'longtext'; +where data_type = 'longtext' and table_schema != 'performance_schema'; select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%'; @@ -1298,12 +1298,16 @@ info='select * from information_schema.tables where 1=sleep(100000)'; disable_query_log; eval kill $ID; enable_query_log; -disconnect conn1; let $wait_timeout= 10; let $wait_condition=select count(*)=0 from information_schema.processlist where state='User sleep' and info='select * from information_schema.tables where 1=sleep(100000)'; --source include/wait_condition.inc +connection conn1; +--error 2013,ER_CONNECTION_KILLED +reap; +connection default; +disconnect conn1; connect (conn1, localhost, root,,); connection conn1; @@ -1318,12 +1322,16 @@ info='select * from information_schema.columns where 1=sleep(100000)'; disable_query_log; eval kill $ID; enable_query_log; -disconnect conn1; let $wait_timeout= 10; let $wait_condition=select count(*)=0 from information_schema.processlist where state='User sleep' and info='select * from information_schema.columns where 1=sleep(100000)'; --source include/wait_condition.inc +connection conn1; +--error 2013,ER_CONNECTION_KILLED +reap; +connection default; +disconnect conn1; # diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test index c7955a38e1b..9b2a3e68bcd 100644 --- a/mysql-test/t/information_schema_all_engines.test +++ b/mysql-test/t/information_schema_all_engines.test @@ -4,6 +4,7 @@ --source include/not_embedded.inc --source include/have_xtradb.inc +--source include/have_perfschema.inc --source include/not_staging.inc use INFORMATION_SCHEMA; diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test index bee8d5796ce..cb79c238f2b 100644 --- a/mysql-test/t/innodb_mrr_cpk.test +++ b/mysql-test/t/innodb_mrr_cpk.test @@ -134,11 +134,39 @@ set optimizer_switch='index_condition_pushdown=on'; drop table t1,t2; -set @@join_cache_level= @save_join_cache_level; -set storage_engine=@save_storage_engine; -set optimizer_switch=@innodb_mrr_cpk_tmp; drop table t0; +--echo # +--echo # MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read() +--echo # +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + pk varchar(32) character set utf8 primary key, + kp1 char(32) not null, + col1 varchar(32), + key (kp1) +) engine=innodb; + +insert into t1 +select + concat('pk-', 1000 +A.a), + concat('kp1-', 1000 +A.a), + concat('val-', 1000 +A.a) +from test.t0 A ; + +create table t2 as select kp1 as a from t1; + +set join_cache_level=8; +set optimizer_switch='mrr=on,mrr_sort_keys=on'; +explain +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; +select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a; + +drop table t0,t1,t2; + +--echo # --echo # --echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions --echo # @@ -190,5 +218,12 @@ set join_cache_level=3; explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id; set join_cache_level= @tmp_mdev5037; - drop table t0,t1,t2; + +--echo # +--echo # This must be at the end: +--echo # + +set @@join_cache_level= @save_join_cache_level; +set storage_engine=@save_storage_engine; +set optimizer_switch=@innodb_mrr_cpk_tmp; diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index 7a70c413e8d..19c5f64de78 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -1777,4 +1777,28 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3 DROP TABLE t1,t2,t3; +--echo # +--echo # Bug mdev-6705: wrong on expression after constant row substitution +--echo # that triggers a simplification of WHERE condition +--echo # + +CREATE TABLE t1 (a int, b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,8); + +CREATE TABLE t2 (c int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (8),(9); + +CREATE TABLE t3 (d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES (3),(8); + +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a + WHERE b IN (1,2,3) OR b = d; + +SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a + WHERE b IN (1,2,3) OR b = d; + +DROP TABLE t1,t2,t3; + + SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test new file mode 100644 index 00000000000..e4bc6a841dd --- /dev/null +++ b/mysql-test/t/log_errchk.test @@ -0,0 +1,64 @@ +# +--source include/not_windows.inc +--source include/not_embedded.inc + +# +# Bug#14757009 : WHEN THE GENERAL_LOG IS A SOCKET AND THE READER GOES AWAY, +# MYSQL QUITS WORKING. +# +call mtr.add_suppression("Could not use"); + +--let $gen_log_file= $MYSQLTEST_VARDIR/tmp/general_log.fifo +--let $slow_query_log_file= $MYSQLTEST_VARDIR/tmp/slow_log.fifo +--let GREP_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err + +--exec mkfifo $gen_log_file +--exec mkfifo $slow_query_log_file + +--echo # Case 1: Setting fife file to general_log_file and slow_query_log_file +--echo # system variable. +# Only regular files can be set to general log. Setting fifo file to general log +# reports an error. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--error ER_WRONG_VALUE_FOR_VAR +--eval SET GLOBAL general_log_file="$gen_log_file"; + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--error ER_WRONG_VALUE_FOR_VAR +--eval SET GLOBAL slow_query_log_file="$slow_query_log_file"; + +--echo # Case 2: Starting server with fifo file as general log file +--echo # and slow query log file. +# Restart server with fifo file as general log file. +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--shutdown_server 60 +--source include/wait_until_disconnected.inc +--enable_reconnect +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/wait_until_connected_again.inc + +# With fix error should be reported in the error log file if file is not a +# regular file. +--perl + my $file= $ENV{'GREP_FILE'}; + my $pattern= "Turning logging off for the whole duration"; + open(FILE, "$file") or die("Unable to open $file: $!\n"); + my $count = 0; + while () { + if ($_ =~ m/$pattern/) { + $count++; + break; + } + } + if ($count >= 2){ + print "Setting fifo file as general log file and slow query log failed.\n"; + } else { + print "test failed.\n"; + } + close(FILE); +EOF + +# Cleanup +--remove_file $gen_log_file +--remove_file $slow_query_log_file diff --git a/mysql-test/t/mysql_upgrade-6984.opt b/mysql-test/t/mysql_upgrade-6984.opt new file mode 100644 index 00000000000..97669d95260 --- /dev/null +++ b/mysql-test/t/mysql_upgrade-6984.opt @@ -0,0 +1 @@ +--skip-grant-tables --group-concat-max-len=1023 diff --git a/mysql-test/t/mysql_upgrade-6984.test b/mysql-test/t/mysql_upgrade-6984.test new file mode 100644 index 00000000000..6f10d3f33e9 --- /dev/null +++ b/mysql-test/t/mysql_upgrade-6984.test @@ -0,0 +1,22 @@ +# +# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10 +# +--source include/not_embedded.inc + +# +# When 'root' account is password protected and MYSQL_UPGRADE doesn't +# know the password (meaning, MYSQL_UPGRADE is run automatically +# on upgrade), MYSQLD has to be started with --skip-grant-tables. +# +# In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES +# + +update mysql.user set password=password("foo") where user='root'; + +--exec $MYSQL_UPGRADE + +connect(con1,localhost,root,foo,,,); + +update mysql.user set password='' where user='root'; +flush privileges; + diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 81951a9ce68..40f66946822 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -295,3 +295,16 @@ CREATE TABLE t2 (d DATE) ENGINE=MyISAM; SELECT * FROM t1,t2 WHERE 1 IS NOT NULL AND t1.b IS NULL; DROP TABLE t1,t2; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3) +--echo # +SELECT NOT NOT NULLIF(2,3); + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test index 483549886db..c2a43f91ecb 100644 --- a/mysql-test/t/old-mode.test +++ b/mysql-test/t/old-mode.test @@ -64,3 +64,12 @@ INSERT INTO t1 VALUES (NULL, '00:20:12'); INSERT INTO t1 VALUES (NULL, '-00:20:12'); SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast +--echo # +SET @@old_mode=zero_date_time_cast; +CREATE TABLE t1 (a TIME,b TIME(1)); +INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30'); +SELECT TO_DAYS(a), TO_DAYS(b) FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 0c8f81e4712..bee0e2cc720 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -20,13 +20,16 @@ grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; flush privileges; -connect (con1,localhost,ssl_user1,,,,,SSL); -connect (con2,localhost,ssl_user2,,,,,SSL); -connect (con3,localhost,ssl_user3,,,,,SSL); -connect (con4,localhost,ssl_user4,,,,,SSL); +connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (con5,localhost,ssl_user5,,,,,SSL); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=RC4-SHA); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); connection con1; # Check ssl turned on @@ -129,6 +132,7 @@ drop table t1; # verification of servers certificate by setting both ca certificate # and ca path to NULL # +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA --exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 --echo End of 5.0 tests @@ -255,6 +259,7 @@ select 'is still running; no cipher request crashed the server' as result from d GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect(con1,localhost,bug42158,,,,,SSL); +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; disconnect con1; connection default; diff --git a/mysql-test/t/openssl_6975.combinations b/mysql-test/t/openssl_6975.combinations new file mode 100644 index 00000000000..17517b7d552 --- /dev/null +++ b/mysql-test/t/openssl_6975.combinations @@ -0,0 +1,6 @@ +[tlsv12] +loose-ssl-cipher=TLSv1.2 + +[tlsv10] +loose-ssl-cipher=SSLv3 + diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test new file mode 100644 index 00000000000..bc6397c5c28 --- /dev/null +++ b/mysql-test/t/openssl_6975.test @@ -0,0 +1,38 @@ +# +# MDEV-6975 Implement TLS protocol +# +# test SSLv3 and TLSv1.2 ciphers when OpenSSL is restricted to SSLv3 or TLSv1.2 +# +source include/have_ssl_communication.inc; + +# this is OpenSSL test. + +grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; +grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; + +let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1; + +disable_abort_on_error; +echo TLS1.2 ciphers: user is ok with any cipher; +exec $mysql --ssl-cipher=AES128-SHA256; +exec $mysql --ssl-cipher=TLSv1.2; +echo TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256; +exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2; +echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2; + +echo SSLv3 ciphers: user is ok with any cipher; +exec $mysql --ssl-cipher=RC4-SHA; +exec $mysql --ssl-cipher=SSLv3; +echo SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=RC4-SHA; +exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3; +echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256; +exec $mysql --user ssl_tls12 --ssl-cipher=RC4-SHA; +exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3; + +drop user ssl_sslv3@localhost; +drop user ssl_tls12@localhost; + diff --git a/mysql-test/t/order_by_zerolength-4285.test b/mysql-test/t/order_by_zerolength-4285.test new file mode 100644 index 00000000000..2fb58edd36d --- /dev/null +++ b/mysql-test/t/order_by_zerolength-4285.test @@ -0,0 +1,8 @@ +# +# MDEV-4285 Server crashes in ptr_compare on NOW and CAST in ORDER BY +# +create table t1 (pk int primary key); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +select * from t1 order by now(), cast(pk as char(0)); +drop table t1; + diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index c5b37615a92..5396b9e3543 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -2017,6 +2017,17 @@ DROP TABLE t1; --echo End of 5.1 tests +# +# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor +# +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1)); + +--error ER_PARSE_ERROR +create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1)); + +--echo End of 5.5 tests + CREATE TABLE t1 (a INT) PARTITION BY LIST (a) SUBPARTITION BY HASH (a) SUBPARTITIONS 2 diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test index 7a2b33699d5..9c555c0f9fb 100644 --- a/mysql-test/t/processlist.test +++ b/mysql-test/t/processlist.test @@ -4,19 +4,22 @@ source include/have_debug_sync.inc; +let $tid= `SELECT CONNECTION_ID()`; SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; send SELECT 1; connect (con1,localhost,root,,); SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed'; -send SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL; +--replace_result $tid TID +send_eval SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":$tid:"; connection default; reap; SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; connection con1; +--replace_result $tid TID reap; connection default; @@ -24,10 +27,24 @@ connection default; # MDEV-4683 query start_time not reset when going to sleep # +connection con1; +# Trigger a signal once the thread has gone from "Query" to "Sleep" command +# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC, +# and once for the intended time, at the end of SELECT SLEEP(). +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2'; +connection default; +# Wait for and clear the first signal set during SET DEBUG_SYNC. +SET DEBUG_SYNC= 'now WAIT_FOR query_done'; +SET DEBUG_SYNC= 'now SIGNAL nosignal'; connection con1; select sleep(5); #run a query that will take some time connection default; +# Need to ensure that the previous query has really completed. Otherwise, +# the select could see the previous query still in "Query" stage in the +# processlist. +SET DEBUG_SYNC = 'now WAIT_FOR query_done'; + # verify that the time in COM_SLEEP doesn't include the query run time select command, time < 5 from information_schema.processlist where id != connection_id(); diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 8cb2620550e..77ee5f49bef 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -889,4 +889,58 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit DROP TABLE t1,t2; +--echo # +--echo # Bug mdev-6325: wrong selectivity of a column with ref access +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int, key(a)); +insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C; + +set use_stat_tables='preferably'; +set histogram_size=100; + +set optimizer_use_condition_selectivity=4; +analyze table t1 persistent for all; +analyze table t2 persistent for all; + +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10; +explain extended +select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10; + +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +drop table t0,t1,t2; + +--echo # +--echo # Bug mdev-6843: col IS NULL in where condition when col is always NULL +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 (a int, b int); +insert into t2 select NULL, a from t1; + +set use_stat_tables='preferably'; +set histogram_size=100; + +set optimizer_use_condition_selectivity=4; +analyze table t2 persistent for all; + +explain extended +select * from t2 a straight_join t2 b where a.a is null; + +set histogram_size=@save_histogram_size; +set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; + +drop table t0,t1,t2; + set use_stat_tables=@save_use_stat_tables; + diff --git a/mysql-test/t/selectivity_innodb.test b/mysql-test/t/selectivity_innodb.test index 6b67e2d0529..5674cb5c006 100644 --- a/mysql-test/t/selectivity_innodb.test +++ b/mysql-test/t/selectivity_innodb.test @@ -8,5 +8,81 @@ set optimizer_switch='extended_keys=on'; --source selectivity.test set optimizer_switch=@save_optimizer_switch_for_selectivity_test; +set @tmp_ust= @@use_stat_tables; +set @tmp_oucs= @@optimizer_use_condition_selectivity; + +--echo # +--echo # MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1 +--echo # +set @tmp_mdev6808= @@optimizer_use_condition_selectivity; +SET optimizer_use_condition_selectivity = 2; +CREATE TABLE t1 ( + event_id int(11) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (event_id) +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + repost_id int(11) unsigned NOT NULL AUTO_INCREMENT, + subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, + subject_id int(11) unsigned NOT NULL, + object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL, + object_id int(11) unsigned NOT NULL, + is_private int(1) NOT NULL DEFAULT '0', + PRIMARY KEY (repost_id), + UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private), + KEY SUBJECT (subject_type,subject_id), + KEY OBJECT (object_type,object_id) +) ENGINE=InnoDB; + +SELECT + * +FROM + t2, t1 +WHERE + t2.object_type = 'event' AND + t2.object_id = t1.event_id AND + t2.is_private = 0 AND + t2.subject_id = 127994 AND + t2.subject_type in ('user') +; +DROP TABLE t1, t2; +set optimizer_use_condition_selectivity=@tmp_mdev6808; + +--echo # +--echo # MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ... +--echo # +SET use_stat_tables = PREFERABLY; +SET optimizer_use_condition_selectivity = 3; + +CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English'); + +CREATE TABLE t2 (i INT) ENGINE=InnoDB; + +SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN ( + SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b ) +); +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6738: use_stat_table + histograms crashing optimizer +--echo # + +set use_stat_tables='preferably'; +set optimizer_use_condition_selectivity=4; + +--echo # Need innodb because there is a special kind of field_bit for non-myisam tables +create table t1(col1 int, col2 bit(1) DEFAULT NULL) engine=innodb; + +select * from t1 where col2 != true; + +drop table t1; + +--echo # +--echo # End of 10.0 tests +--echo # + +set use_stat_tables= @tmp_ust; +set optimizer_use_condition_selectivity= @tmp_oucs; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/show_bad_definer-5553.test b/mysql-test/t/show_bad_definer-5553.test new file mode 100644 index 00000000000..c5b6f1b3d10 --- /dev/null +++ b/mysql-test/t/show_bad_definer-5553.test @@ -0,0 +1,12 @@ +--source include/not_embedded.inc +# +# MDEV-5553 A view or procedure with a non existing definer can block "SHOW TABLE STATUS" with an unclear error message +# + +create database mysqltest1; # all-open privileges on test db desroy the test +use mysqltest1; +create table t1(id int primary key); +create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id; +--replace_column 8 # 12 # 13 # +show table status; +drop database mysqltest1; diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index eb4da99588c..988a9d6c056 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -11,6 +11,7 @@ connect (ssl_con,localhost,root,,,,,SSL); # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check ssl expiration @@ -21,6 +22,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; -- source include/common-tests.inc # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; connection default; diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt index 8d103df3a95..531c0abc9f1 100644 --- a/mysql-test/t/ssl_8k_key-master.opt +++ b/mysql-test/t/ssl_8k_key-master.opt @@ -1 +1,3 @@ ---ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem +--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem +--loose-ssl-cipher=DHE-RSA-AES256-SHA diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test index 8e0dea53fe7..5e45e3824a2 100644 --- a/mysql-test/t/ssl_compress.test +++ b/mysql-test/t/ssl_compress.test @@ -11,6 +11,7 @@ connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check compression turned on @@ -20,6 +21,7 @@ SHOW STATUS LIKE 'Compression'; -- source include/common-tests.inc # Check ssl turned on +--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA SHOW STATUS LIKE 'Ssl_cipher'; # Check compression turned on diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 5b0b70631a5..9ce34c0b55b 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -236,3 +236,124 @@ SELECT AVG(f1) FROM t1; drop table t1; --echo End of 5.3 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/ENUM/VARCHAR columns +--echo # + +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 ENUM('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1); +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +--echo # +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases +--echo # +CREATE TABLE t1 (id INT NOT NULL, a ENUM('04','03','02','01')) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'01'); +INSERT INTO t1 VALUES (1,'02'); +INSERT INTO t1 VALUES (1,'03'); +INSERT INTO t1 VALUES (1,'04'); +INSERT INTO t1 VALUES (2,'01'); +INSERT INTO t1 VALUES (2,'02'); +INSERT INTO t1 VALUES (2,'03'); +INSERT INTO t1 VALUES (2,'04'); +INSERT INTO t1 VALUES (3,'01'); +INSERT INTO t1 VALUES (3,'02'); +INSERT INTO t1 VALUES (3,'03'); +INSERT INTO t1 VALUES (3,'04'); +INSERT INTO t1 VALUES (4,'01'); +INSERT INTO t1 VALUES (4,'02'); +INSERT INTO t1 VALUES (4,'03'); +INSERT INTO t1 VALUES (4,'04'); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +ALTER TABLE t1 ADD KEY(id,a); +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +--echo # Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id; +SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +--echo # Should NOT use group_min_max optimization +EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id; +DROP TABLE t1; + +--echo # +--echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +--echo # +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 ENUM('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +DROP TABLE t1,t2; + +CREATE TABLE t1 (a DECIMAL(10,1), b ENUM('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +ALTER TABLE t1 MODIFY a ENUM('1','2'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 96ce1bcbd9e..bb7a784553e 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -343,3 +343,45 @@ INSERT INTO t1 VALUES ('2.0.'); INSERT INTO t1 VALUES ('.'); SELECT * FROM t1 ORDER BY f; DROP TABLE t1; + + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +--echo # +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DOUBLE); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +--echo # t2 should NOT be elimitated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index bf7e3794a19..09149253c67 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1570,3 +1570,55 @@ SELECT d1 * d2 FROM t1; DROP TABLE t1; +# +# Test for Bug#18469276: MOD FOR SMALL DECIMALS FAILS +# +select 0.000000000000000000000000000000000000000000000000001 mod 1; + +# +# incorrect result +# +select 0.0000000001 mod 1; +select 0.01 mod 1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATETIME PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01 00:00:00'); +CREATE TABLE t2 (a DECIMAL(30,1)); +INSERT INTO t2 VALUES (19990101000000); +INSERT INTO t2 VALUES (990101000000); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns +--echo # +CREATE TABLE t1 (a TIME(6) PRIMARY KEY); +INSERT INTO t1 VALUES ('10:20:30'); +CREATE TABLE t2 (a DECIMAL(30,10)); +INSERT INTO t2 VALUES (102030),(102030.000000001); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1 JOIN t2 USING(a); +SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a); +DROP TABLE t1,t2; + + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index a851d116743..8b9da6962d5 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -95,3 +95,93 @@ DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns +--echo # + +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 SET('2001-01-01','2001/01/01')); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column +--echo # +CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY); +INSERT INTO t1 VALUES ('a'); +CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin); +INSERT INTO t2 VALUES ('a'),('A'); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns +--echo # +CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (c1 SET('a','b')); +INSERT INTO t2 VALUES ('a'),('b'); +SELECT t1.* FROM t1 NATURAL JOIN t2; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1 NATURAL JOIN t2; +SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1); +DROP TABLE t1,t2; + +CREATE TABLE t1 (a DECIMAL(10,1), b SET('1','2')); +INSERT INTO t1 (a) VALUES (1),(2); +UPDATE t1 SET b=a; +SELECT * FROM t1; +ALTER TABLE t1 MODIFY a SET('1','2'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 4f23f7b1bb8..d36c6af65e8 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -250,9 +250,20 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); DROP TABLE t1; --echo # ---echo # Start of 10.0 tests +--echo # MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +--echo # +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests --echo # +--echo # +--echo # Start of 10.0 tests +--echo # --echo # --echo # MDEV-6102 Comparison between TIME and DATETIME does not use CURRENT_DATE diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index a9212183cb6..3a949c5c47a 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -15,3 +15,29 @@ select * from t1; drop table t1; # End of 4.1 tests + + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (a DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('1999-01-01'); +CREATE TABLE t2 (a INT UNSIGNED); +INSERT INTO t2 VALUES (19990101); +INSERT INTO t2 VALUES (990101); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +ALTER TABLE t2 ADD PRIMARY KEY(a); +SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a; +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 33b84266118..528d26d6f86 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -217,3 +217,29 @@ CREATE TABLE t1 (a CHAR(16)); INSERT INTO t1 VALUES ('5'), ('s'), (''); SELECT 5 = a FROM t1; DROP TABLE t1; + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns +--echo # +CREATE TABLE t1 (c1 DATE PRIMARY KEY); +INSERT INTO t1 VALUES ('2001-01-01'); +CREATE TABLE t2 (c1 VARCHAR(20)); +INSERT INTO t2 VALUES ('2001-01-01'); +INSERT INTO t2 VALUES ('2001/01/01'); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +ALTER TABLE t2 ADD PRIMARY KEY(c1); +SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1; +SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +--echo # t2 should NOT be eliminated +EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1; +DROP TABLE IF EXISTS t1,t2; + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index a5d7dae606f..9204ddd22e5 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1330,3 +1330,23 @@ create table t1 (a int); insert t1 values (1),(2),(3),(1); explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1); drop table t1; + +--echo # +--echo # MDEV-6868:MariaDB server crash ( select with union and order by +--echo # with subquery ) +--echo # + +CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) ); + +INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' ); + +( + SELECT sample_name1 AS testname FROM t1 +) +UNION +( + SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id) +) +; + +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6029ad471f6..eb905b5c4df 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5364,6 +5364,21 @@ select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a; drop view v1; drop table t1,t2; +# +# MDEV-6785 Wrong result on 2nd execution of PS with aggregate function, FROM SQ or MERGE view +# + +create table t1 (i int not null); +insert into t1 values (1),(2); +create table t2 (j int not null); +insert into t2 values (11),(12); +create algorithm=merge view v3 as select t1.* from t2 left join t1 on (t2.j = t1.i); +prepare stmt from 'select count(v3.i) from t1, v3'; +execute stmt; +execute stmt; +drop table t1, t2; +drop view v3; + --echo # ----------------------------------------------------------------- --echo # -- End of 10.0 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index ca190104d79..5c54c4ff30c 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1269,3 +1269,16 @@ fun:__tls_get_addr } +{ + Mroonga: dlopen leaves some "still reachable" + Memcheck:Leak + fun:malloc + ... + fun:dl_open_worker + fun:_dl_catch_error + fun:_dl_open + fun:dlopen_doit + fun:_dl_catch_error + fun:_dlerror_run + fun:dlopen@@GLIBC_2.2.5 +} diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index c0508b97922..a7a048acac1 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3591,7 +3591,6 @@ end: create_new_string: /* There is no columns from before, so let's just add the new ones */ rc= ER_DYNCOL_OK; - my_free(alloc_plan); if (not_null != 0) rc= dynamic_column_create_many_internal_fmt(str, add_column_count, (uint*)column_keys, values, diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c index cbf0d5dd9e4..b78d73074da 100644 --- a/mysys/mf_fn_ext.c +++ b/mysys/mf_fn_ext.c @@ -29,7 +29,7 @@ (normally '.') after the directory name. RETURN VALUES - Pointer to to the extension character. If there isn't any extension, + Pointer to the extension character. If there isn't any extension, points at the end ASCII(0) of the filename. */ @@ -49,7 +49,7 @@ char *fn_ext(const char *name) if (!(gpos= strrchr(name, FN_LIBCHAR))) gpos= name; #endif - pos=strchr(gpos,FN_EXTCHAR); + pos= strchr(gpos, FN_EXTCHAR); DBUG_RETURN((char*) (pos ? pos : strend(gpos))); } /* fn_ext */ @@ -58,7 +58,7 @@ char *fn_ext(const char *name) Return a pointer to the extension of the filename. SYNOPSIS - fn_ext() + fn_ext2() name Name of file DESCRIPTION @@ -66,7 +66,7 @@ char *fn_ext(const char *name) (normally '.') after the directory name. RETURN VALUES - Pointer to to the extension character. If there isn't any extension, + Pointer to the extension character. If there isn't any extension, points at the end ASCII(0) of the filename. */ @@ -86,6 +86,8 @@ char *fn_ext2(const char *name) if (!(gpos= strrchr(name, FN_LIBCHAR))) gpos= name; #endif - pos=strrchr(gpos,FN_EXTCHAR); + // locate the last occurence of FN_EXTCHAR + pos= strrchr(gpos, FN_EXTCHAR); DBUG_RETURN((char*) (pos ? pos : strend(gpos))); -} /* fn_ext */ +} /* fn_ext2 */ + diff --git a/mysys/my_default.c b/mysys/my_default.c index f383a3ce1e6..a39c61a9d16 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -861,7 +861,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler, for (i= 0; i < (uint) search_dir->number_of_files; i++) { search_file= search_dir->dir_entry + i; - ext= fn_ext(search_file->name); + ext= fn_ext2(search_file->name); /* check extension */ for (tmp_ext= (char**) f_extensions; *tmp_ext; tmp_ext++) diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in index ba57515678c..d8cf49fe993 100644 --- a/packaging/rpm-oel/mysql.spec.in +++ b/packaging/rpm-oel/mysql.spec.in @@ -85,7 +85,7 @@ Name: mysql-%{product_suffix} Summary: A very fast and reliable SQL database server Group: Applications/Databases Version: @VERSION@ -Release: 4%{?commercial:.1}%{?dist} +Release: 2%{?commercial:.1}%{?dist} License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{?license_type} license as shown in the Description field. Source0: https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz URL: http://www.mysql.com/ @@ -156,8 +156,8 @@ Requires: net-tools Provides: MySQL-server-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-server-advanced < %{version}-%{release} Obsoletes: mysql-community-server < %{version}-%{release} -Requires: mysql-enterprise-client%{?_isa} = %{version}-%{release} -Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-client%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-common%{?_isa} = %{version}-%{release} %else Provides: MySQL-server%{?_isa} = %{version}-%{release} Requires: mysql-community-client%{?_isa} = %{version}-%{release} @@ -169,6 +169,8 @@ Obsoletes: mariadb-server Obsoletes: mariadb-galera-server Provides: mysql-server = %{version}-%{release} Provides: mysql-server%{?_isa} = %{version}-%{release} +Provides: mysql-compat-server = %{version}-%{release} +Provides: mysql-compat-server%{?_isa} = %{version}-%{release} %if 0%{?systemd} Requires(post): systemd Requires(preun): systemd @@ -207,7 +209,7 @@ Group: Applications/Databases Provides: MySQL-client-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-client-advanced < %{version}-%{release} Obsoletes: mysql-community-client < %{version}-%{release} -Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-libs%{?_isa} = %{version}-%{release} %else Provides: MySQL-client%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} @@ -246,7 +248,7 @@ Group: Applications/Databases Provides: MySQL-test-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-test-advanced < %{version}-%{release} Obsoletes: mysql-community-test < %{version}-%{release} -Requires: mysql-enterprise-server%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-server%{?_isa} = %{version}-%{release} %else Provides: MySQL-test%{?_isa} = %{version}-%{release} Requires: mysql-community-server%{?_isa} = %{version}-%{release} @@ -268,7 +270,7 @@ Summary: MySQL benchmark suite Group: Applications/Databases %if 0%{?commercial} Obsoletes: mysql-community-bench < %{version}-%{release} -Requires: mysql-enterprise-server%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-server%{?_isa} = %{version}-%{release} %else Requires: mysql-community-server%{?_isa} = %{version}-%{release} %endif @@ -289,7 +291,7 @@ Group: Applications/Databases Provides: MySQL-devel-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-devel-advanced < %{version}-%{release} Obsoletes: mysql-community-devel < %{version}-%{release} -Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-libs%{?_isa} = %{version}-%{release} %else Provides: MySQL-devel%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} @@ -311,7 +313,7 @@ Group: Applications/Databases Provides: MySQL-shared-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-shared-advanced < %{version}-%{release} Obsoletes: mysql-community-libs < %{version}-%{release} -Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-common%{?_isa} = %{version}-%{release} %else Provides: MySQL-shared%{?_isa} = %{version}-%{release} Requires: mysql-community-common%{?_isa} = %{version}-%{release} @@ -337,7 +339,7 @@ Provides: mysql-libs-compat%{?_isa} = %{version}-%{release} Provides: MySQL-shared-compat-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-shared-compat-advanced < %{version}-%{release} Obsoletes: mysql-community-libs-compat < %{version}-%{release} -Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-libs%{?_isa} = %{version}-%{release} %else Provides: MySQL-shared-compat%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} @@ -359,7 +361,7 @@ Group: Applications/Databases Provides: MySQL-embedded-advanced%{?_isa} = %{version}-%{release} Obsoletes: MySQL-embedded-advanced < %{version}-%{release} Obsoletes: mysql-community-embedded < %{version}-%{release} -Requires: mysql-enterprise-common%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-common%{?_isa} = %{version}-%{release} %else Provides: MySQL-embedded%{?_isa} = %{version}-%{release} Requires: mysql-community-common%{?_isa} = %{version}-%{release} @@ -387,8 +389,8 @@ Summary: Development header files and libraries for MySQL as an embeddabl Group: Applications/Databases %if 0%{?commercial} Obsoletes: mysql-community-embedded-devel < %{version}-%{release} -Requires: mysql-enterprise-devel%{?_isa} = %{version}-%{release} -Requires: mysql-enterprise-embedded%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-devel%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-embedded%{?_isa} = %{version}-%{release} %else Requires: mysql-community-devel%{?_isa} = %{version}-%{release} Requires: mysql-community-embedded%{?_isa} = %{version}-%{release} @@ -407,9 +409,9 @@ the embedded version of the MySQL server. Summary: Convenience package for easy upgrades of MySQL package set Group: Applications/Databases %if 0%{?commercial} -Requires: mysql-enterprise-client%{?_isa} = %{version}-%{release} -Requires: mysql-enterprise-libs%{?_isa} = %{version}-%{release} -Requires: mysql-enterprise-libs-compat%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-client%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-libs%{?_isa} = %{version}-%{release} +Requires: mysql-commercial-libs-compat%{?_isa} = %{version}-%{release} %else Requires: mysql-community-client%{?_isa} = %{version}-%{release} Requires: mysql-community-libs%{?_isa} = %{version}-%{release} @@ -911,6 +913,9 @@ fi %endif %changelog +* Tue Jul 22 2014 Balasubramanian Kandasamy - 5.5.39-5 +- Provide mysql-compat-server dependencies + * Tue Jul 08 2014 Balasubramanian Kandasamy - 5.5.39-4 - Remove perl(GD) and dtrace dependencies diff --git a/pcre/ChangeLog b/pcre/ChangeLog index 7801ef84117..8abdfb5f117 100644 --- a/pcre/ChangeLog +++ b/pcre/ChangeLog @@ -1,6 +1,104 @@ ChangeLog for PCRE ------------------ +Version 8.36 26-September-2014 +------------------------------ + +1. Got rid of some compiler warnings in the C++ modules that were shown up by + -Wmissing-field-initializers and -Wunused-parameter. + +2. The tests for quantifiers being too big (greater than 65535) were being + applied after reading the number, and stupidly assuming that integer + overflow would give a negative number. The tests are now applied as the + numbers are read. + +3. Tidy code in pcre_exec.c where two branches that used to be different are + now the same. + +4. The JIT compiler did not generate match limit checks for certain + bracketed expressions with quantifiers. This may lead to exponential + backtracking, instead of returning with PCRE_ERROR_MATCHLIMIT. This + issue should be resolved now. + +5. Fixed an issue, which occures when nested alternatives are optimized + with table jumps. + +6. Inserted two casts and changed some ints to size_t in the light of some + reported 64-bit compiler warnings (Bugzilla 1477). + +7. Fixed a bug concerned with zero-minimum possessive groups that could match + an empty string, which sometimes were behaving incorrectly in the + interpreter (though correctly in the JIT matcher). This pcretest input is + an example: + + '\A(?:[^"]++|"(?:[^"]*+|"")*+")++' + NON QUOTED "QUOT""ED" AFTER "NOT MATCHED + + the interpreter was reporting a match of 'NON QUOTED ' only, whereas the + JIT matcher and Perl both matched 'NON QUOTED "QUOT""ED" AFTER '. The test + for an empty string was breaking the inner loop and carrying on at a lower + level, when possessive repeated groups should always return to a higher + level as they have no backtrack points in them. The empty string test now + occurs at the outer level. + +8. Fixed a bug that was incorrectly auto-possessifying \w+ in the pattern + ^\w+(?>\s*)(?<=\w) which caused it not to match "test test". + +9. Give a compile-time error for \o{} (as Perl does) and for \x{} (which Perl + doesn't). + +10. Change 8.34/15 introduced a bug that caused the amount of memory needed + to hold a pattern to be incorrectly computed (too small) when there were + named back references to duplicated names. This could cause "internal + error: code overflow" or "double free or corruption" or other memory + handling errors. + +11. When named subpatterns had the same prefixes, back references could be + confused. For example, in this pattern: + + /(?Pa)?(?Pb)?(?()c|d)*l/ + + the reference to 'Name' was incorrectly treated as a reference to a + duplicate name. + +12. A pattern such as /^s?c/mi8 where the optional character has more than + one "other case" was incorrectly compiled such that it would only try to + match starting at "c". + +13. When a pattern starting with \s was studied, VT was not included in the + list of possible starting characters; this should have been part of the + 8.34/18 patch. + +14. If a character class started [\Qx]... where x is any character, the class + was incorrectly terminated at the ]. + +15. If a pattern that started with a caseless match for a character with more + than one "other case" was studied, PCRE did not set up the starting code + unit bit map for the list of possible characters. Now it does. This is an + optimization improvement, not a bug fix. + +16. The Unicode data tables have been updated to Unicode 7.0.0. + +17. Fixed a number of memory leaks in pcregrep. + +18. Avoid a compiler warning (from some compilers) for a function call with + a cast that removes "const" from an lvalue by using an intermediate + variable (to which the compiler does not object). + +19. Incorrect code was compiled if a group that contained an internal recursive + back reference was optional (had quantifier with a minimum of zero). This + example compiled incorrect code: /(((a\2)|(a*)\g<-1>))*/ and other examples + caused segmentation faults because of stack overflows at compile time. + +20. A pattern such as /((?(R)a|(?1)))+/, which contains a recursion within a + group that is quantified with an indefinite repeat, caused a compile-time + loop which used up all the system stack and provoked a segmentation fault. + This was not the same bug as 19 above. + +21. Add PCRECPP_EXP_DECL declaration to operator<< in pcre_stringpiece.h. + Patch by Mike Frysinger. + + Version 8.35 04-April-2014 -------------------------- @@ -27,9 +125,9 @@ Version 8.35 04-April-2014 6. Improve character range checks in JIT. Characters are read by an inprecise function now, which returns with an unknown value if the character code is - above a certain treshold (e.g: 256). The only limitation is that the value - must be bigger than the treshold as well. This function is useful, when - the characters above the treshold are handled in the same way. + above a certain threshold (e.g: 256). The only limitation is that the value + must be bigger than the threshold as well. This function is useful when + the characters above the threshold are handled in the same way. 7. The macros whose names start with RAWUCHAR are placeholders for a future mode in which only the bottom 21 bits of 32-bit data items are used. To diff --git a/pcre/NEWS b/pcre/NEWS index 6331e9908d1..5b8c60c14b8 100644 --- a/pcre/NEWS +++ b/pcre/NEWS @@ -1,6 +1,13 @@ News about PCRE releases ------------------------ +Release 8.36 26-September-2014 +------------------------------ + +This is primarily a bug-fix release. However, in addition, the Unicode data +tables have been updated to Unicode 7.0.0. + + Release 8.35 04-April-2014 -------------------------- diff --git a/pcre/README b/pcre/README index 88f2dfd4efd..e30bd0fd5b7 100644 --- a/pcre/README +++ b/pcre/README @@ -45,14 +45,16 @@ the 16-bit library, which processes strings of 16-bit values, and one for the 32-bit library, which processes strings of 32-bit values. The distribution also includes a set of C++ wrapper functions (see the pcrecpp man page for details), courtesy of Google Inc., which can be used to call the 8-bit PCRE library from -C++. +C++. Other C++ wrappers have been created from time to time. See, for example: +https://github.com/YasserAsmi/regexp, which aims to be simple and similar in +style to the C API. -In addition, there is a set of C wrapper functions (again, just for the 8-bit -library) that are based on the POSIX regular expression API (see the pcreposix -man page). These end up in the library called libpcreposix. Note that this just -provides a POSIX calling interface to PCRE; the regular expressions themselves -still follow Perl syntax and semantics. The POSIX API is restricted, and does -not give full access to all of PCRE's facilities. +The distribution also contains a set of C wrapper functions (again, just for +the 8-bit library) that are based on the POSIX regular expression API (see the +pcreposix man page). These end up in the library called libpcreposix. Note that +this just provides a POSIX calling interface to PCRE; the regular expressions +themselves still follow Perl syntax and semantics. The POSIX API is restricted, +and does not give full access to all of PCRE's facilities. The header file for the POSIX-style functions is called pcreposix.h. The official POSIX name is regex.h, but I did not want to risk possible problems @@ -988,4 +990,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 17 January 2014 +Last updated: 24 October 2014 diff --git a/pcre/configure.ac b/pcre/configure.ac index aab2f56c218..e7dffbe003f 100644 --- a/pcre/configure.ac +++ b/pcre/configure.ac @@ -9,19 +9,19 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might dnl be defined as -RC2, for example. For real releases, it should be empty. m4_define(pcre_major, [8]) -m4_define(pcre_minor, [35]) +m4_define(pcre_minor, [36]) m4_define(pcre_prerelease, []) -m4_define(pcre_date, [2014-04-04]) +m4_define(pcre_date, [2014-09-26]) # NOTE: The CMakeLists.txt file searches for the above variables in the first # 50 lines of this file. Please update that if the variables above are moved. # Libtool shared library interface versions (current:revision:age) -m4_define(libpcre_version, [3:3:2]) -m4_define(libpcre16_version, [2:3:2]) -m4_define(libpcre32_version, [0:3:0]) -m4_define(libpcreposix_version, [0:2:0]) -m4_define(libpcrecpp_version, [0:0:0]) +m4_define(libpcre_version, [3:4:2]) +m4_define(libpcre16_version, [2:4:2]) +m4_define(libpcre32_version, [0:4:0]) +m4_define(libpcreposix_version, [0:3:0]) +m4_define(libpcrecpp_version, [0:1:0]) AC_PREREQ(2.57) AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre) diff --git a/pcre/doc/html/README.txt b/pcre/doc/html/README.txt index 88f2dfd4efd..e30bd0fd5b7 100644 --- a/pcre/doc/html/README.txt +++ b/pcre/doc/html/README.txt @@ -45,14 +45,16 @@ the 16-bit library, which processes strings of 16-bit values, and one for the 32-bit library, which processes strings of 32-bit values. The distribution also includes a set of C++ wrapper functions (see the pcrecpp man page for details), courtesy of Google Inc., which can be used to call the 8-bit PCRE library from -C++. +C++. Other C++ wrappers have been created from time to time. See, for example: +https://github.com/YasserAsmi/regexp, which aims to be simple and similar in +style to the C API. -In addition, there is a set of C wrapper functions (again, just for the 8-bit -library) that are based on the POSIX regular expression API (see the pcreposix -man page). These end up in the library called libpcreposix. Note that this just -provides a POSIX calling interface to PCRE; the regular expressions themselves -still follow Perl syntax and semantics. The POSIX API is restricted, and does -not give full access to all of PCRE's facilities. +The distribution also contains a set of C wrapper functions (again, just for +the 8-bit library) that are based on the POSIX regular expression API (see the +pcreposix man page). These end up in the library called libpcreposix. Note that +this just provides a POSIX calling interface to PCRE; the regular expressions +themselves still follow Perl syntax and semantics. The POSIX API is restricted, +and does not give full access to all of PCRE's facilities. The header file for the POSIX-style functions is called pcreposix.h. The official POSIX name is regex.h, but I did not want to risk possible problems @@ -988,4 +990,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 17 January 2014 +Last updated: 24 October 2014 diff --git a/pcre/doc/html/pcre_config.html b/pcre/doc/html/pcre_config.html index bcdcdded708..72fb9caa1ff 100644 --- a/pcre/doc/html/pcre_config.html +++ b/pcre/doc/html/pcre_config.html @@ -39,8 +39,10 @@ arguments are as follows: where Points to where to put the data The where argument must point to an integer variable, except for -PCRE_CONFIG_MATCH_LIMIT and PCRE_CONFIG_MATCH_LIMIT_RECURSION, when it must -point to an unsigned long integer. The available codes are: +PCRE_CONFIG_MATCH_LIMIT, PCRE_CONFIG_MATCH_LIMIT_RECURSION, and +PCRE_CONFIG_PARENS_LIMIT, when it must point to an unsigned long integer, +and for PCRE_CONFIG_JITTARGET, when it must point to a const char*. +The available codes are:
   PCRE_CONFIG_JIT           Availability of just-in-time compiler
                               support (1=yes 0=no)
diff --git a/pcre/doc/html/pcre_fullinfo.html b/pcre/doc/html/pcre_fullinfo.html
index b88fc1155bd..2b7c72b3b98 100644
--- a/pcre/doc/html/pcre_fullinfo.html
+++ b/pcre/doc/html/pcre_fullinfo.html
@@ -57,6 +57,10 @@ The following information is available:
   PCRE_INFO_JITSIZE         Size of JIT compiled code
   PCRE_INFO_LASTLITERAL     Literal last data unit required
   PCRE_INFO_MINLENGTH       Lower bound length of matching strings
+  PCRE_INFO_MATCHEMPTY      Return 1 if the pattern can match an empty string,
+                               0 otherwise
+  PCRE_INFO_MATCHLIMIT      Match limit if set, otherwise PCRE_RROR_UNSET
+  PCRE_INFO_MAXLOOKBEHIND   Length (in characters) of the longest lookbehind assertion
   PCRE_INFO_NAMECOUNT       Number of named subpatterns
   PCRE_INFO_NAMEENTRYSIZE   Size of name table entry
   PCRE_INFO_NAMETABLE       Pointer to name table
@@ -72,6 +76,7 @@ The following information is available:
                                   2 if the first character is at the start of the data
                                     string or after a newline, and
                                   0 otherwise
+  PCRE_INFO_RECURSIONLIMIT    Recursion limit if set, otherwise PCRE_ERROR_UNSET
   PCRE_INFO_REQUIREDCHAR      Literal last data unit required
   PCRE_INFO_REQUIREDCHARFLAGS Returns 1 if the last data character is set (which can then
                               be retrieved using PCRE_INFO_REQUIREDCHAR); 0 otherwise
@@ -79,14 +84,18 @@ The following information is available:
 The where argument must point to an integer variable, except for the
 following what values:
 
-  PCRE_INFO_DEFAULT_TABLES  const unsigned char *
-  PCRE_INFO_FIRSTTABLE      const unsigned char *
+  PCRE_INFO_DEFAULT_TABLES  const uint8_t *
+  PCRE_INFO_FIRSTCHARACTER  uint32_t
+  PCRE_INFO_FIRSTTABLE      const uint8_t *
+  PCRE_INFO_JITSIZE         size_t
+  PCRE_INFO_MATCHLIMIT      uint32_t
   PCRE_INFO_NAMETABLE       PCRE_SPTR16           (16-bit library)
   PCRE_INFO_NAMETABLE       PCRE_SPTR32           (32-bit library)
   PCRE_INFO_NAMETABLE       const unsigned char * (8-bit library)
   PCRE_INFO_OPTIONS         unsigned long int
   PCRE_INFO_SIZE            size_t
-  PCRE_INFO_FIRSTCHARACTER  uint32_t
+  PCRE_INFO_STUDYSIZE       size_t
+  PCRE_INFO_RECURSIONLIMIT  uint32_t
   PCRE_INFO_REQUIREDCHAR    uint32_t
 
The yield of the function is zero on success or: @@ -95,6 +104,7 @@ The yield of the function is zero on success or: the argument where was NULL PCRE_ERROR_BADMAGIC the "magic number" was not found PCRE_ERROR_BADOPTION the value of what was invalid + PCRE_ERROR_UNSET the option was not set

diff --git a/pcre/doc/html/pcrepattern.html b/pcre/doc/html/pcrepattern.html index c06d1e03f11..71fd907d26f 100644 --- a/pcre/doc/html/pcrepattern.html +++ b/pcre/doc/html/pcrepattern.html @@ -703,6 +703,7 @@ Armenian, Avestan, Balinese, Bamum, +Bassa_Vah, Batak, Bengali, Bopomofo, @@ -712,6 +713,7 @@ Buginese, Buhid, Canadian_Aboriginal, Carian, +Caucasian_Albanian, Chakma, Cham, Cherokee, @@ -722,11 +724,14 @@ Cypriot, Cyrillic, Deseret, Devanagari, +Duployan, Egyptian_Hieroglyphs, +Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, +Grantha, Greek, Gujarati, Gurmukhi, @@ -746,40 +751,56 @@ Katakana, Kayah_Li, Kharoshthi, Khmer, +Khojki, +Khudawadi, Lao, Latin, Lepcha, Limbu, +Linear_A, Linear_B, Lisu, Lycian, Lydian, +Mahajani, Malayalam, Mandaic, +Manichaean, Meetei_Mayek, +Mende_Kikakui, Meroitic_Cursive, Meroitic_Hieroglyphs, Miao, +Modi, Mongolian, +Mro, Myanmar, +Nabataean, New_Tai_Lue, Nko, Ogham, +Ol_Chiki, Old_Italic, +Old_North_Arabian, +Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, -Ol_Chiki, Oriya, Osmanya, +Pahawh_Hmong, +Palmyrene, +Pau_Cin_Hau, Phags_Pa, Phoenician, +Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Shavian, +Siddham, Sinhala, Sora_Sompeng, Sundanese, @@ -797,8 +818,10 @@ Thaana, Thai, Tibetan, Tifinagh, +Tirhuta, Ugaritic, Vai, +Warang_Citi, Yi.

diff --git a/pcre/doc/html/pcresyntax.html b/pcre/doc/html/pcresyntax.html index 89f35737b4f..5896b9e0688 100644 --- a/pcre/doc/html/pcresyntax.html +++ b/pcre/doc/html/pcresyntax.html @@ -171,6 +171,7 @@ Armenian, Avestan, Balinese, Bamum, +Bassa_Vah, Batak, Bengali, Bopomofo, @@ -180,6 +181,7 @@ Buginese, Buhid, Canadian_Aboriginal, Carian, +Caucasian_Albanian, Chakma, Cham, Cherokee, @@ -190,11 +192,14 @@ Cypriot, Cyrillic, Deseret, Devanagari, +Duployan, Egyptian_Hieroglyphs, +Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, +Grantha, Greek, Gujarati, Gurmukhi, @@ -214,40 +219,56 @@ Katakana, Kayah_Li, Kharoshthi, Khmer, +Khojki, +Khudawadi, Lao, Latin, Lepcha, Limbu, +Linear_A, Linear_B, Lisu, Lycian, Lydian, +Mahajani, Malayalam, Mandaic, +Manichaean, Meetei_Mayek, +Mende_Kikakui, Meroitic_Cursive, Meroitic_Hieroglyphs, Miao, +Modi, Mongolian, +Mro, Myanmar, +Nabataean, New_Tai_Lue, Nko, Ogham, +Ol_Chiki, Old_Italic, +Old_North_Arabian, +Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, -Ol_Chiki, Oriya, Osmanya, +Pahawh_Hmong, +Palmyrene, +Pau_Cin_Hau, Phags_Pa, Phoenician, +Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Shavian, +Siddham, Sinhala, Sora_Sompeng, Sundanese, @@ -265,8 +286,10 @@ Thaana, Thai, Tibetan, Tifinagh, +Tirhuta, Ugaritic, Vai, +Warang_Citi, Yi.


CHARACTER CLASSES
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt index 14cbb8bf2be..ce27f4b3e0c 100644 --- a/pcre/doc/pcre.txt +++ b/pcre/doc/pcre.txt @@ -5326,21 +5326,25 @@ BACKSLASH Those that are not part of an identified script are lumped together as "Common". The current list of scripts is: - Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo, - Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma, - Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret, - Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic, - Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira- - gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip- - tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li, - Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian, - Lydian, Malayalam, Mandaic, Meetei_Mayek, Meroitic_Cursive, - Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko, - Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic, - Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari- - tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese, - Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, - Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai, + Arabic, Armenian, Avestan, Balinese, Bamum, Bassa_Vah, Batak, Bengali, + Bopomofo, Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Car- + ian, Caucasian_Albanian, Chakma, Cham, Cherokee, Common, Coptic, Cunei- + form, Cypriot, Cyrillic, Deseret, Devanagari, Duployan, Egyptian_Hiero- + glyphs, Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, Grantha, + Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, + Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip- + tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li, + Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin- + ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic, + Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive, + Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean, + New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian, + Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya, + Pahawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician, + Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha- + vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac, + Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu, + Thaana, Thai, Tibetan, Tifinagh, Tirhuta, Ugaritic, Vai, Warang_Citi, Yi. Each character has exactly one Unicode general category property, spec- @@ -7777,21 +7781,25 @@ PCRE SPECIAL CATEGORY PROPERTIES FOR \p and \P SCRIPT NAMES FOR \p AND \P - Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo, - Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma, - Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret, - Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic, - Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira- - gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip- - tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li, - Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian, - Lydian, Malayalam, Mandaic, Meetei_Mayek, Meroitic_Cursive, - Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko, - Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic, - Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari- - tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese, - Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, - Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai, + Arabic, Armenian, Avestan, Balinese, Bamum, Bassa_Vah, Batak, Bengali, + Bopomofo, Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Car- + ian, Caucasian_Albanian, Chakma, Cham, Cherokee, Common, Coptic, Cunei- + form, Cypriot, Cyrillic, Deseret, Devanagari, Duployan, Egyptian_Hiero- + glyphs, Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, Grantha, + Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hiragana, + Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip- + tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li, + Kharoshthi, Khmer, Khojki, Khudawadi, Lao, Latin, Lepcha, Limbu, Lin- + ear_A, Linear_B, Lisu, Lycian, Lydian, Mahajani, Malayalam, Mandaic, + Manichaean, Meetei_Mayek, Mende_Kikakui, Meroitic_Cursive, + Meroitic_Hieroglyphs, Miao, Modi, Mongolian, Mro, Myanmar, Nabataean, + New_Tai_Lue, Nko, Ogham, Ol_Chiki, Old_Italic, Old_North_Arabian, + Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, Oriya, Osmanya, + Pahawh_Hmong, Palmyrene, Pau_Cin_Hau, Phags_Pa, Phoenician, + Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Sha- + vian, Siddham, Sinhala, Sora_Sompeng, Sundanese, Syloti_Nagri, Syriac, + Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet, Takri, Tamil, Telugu, + Thaana, Thai, Tibetan, Tifinagh, Tirhuta, Ugaritic, Vai, Warang_Citi, Yi. diff --git a/pcre/doc/pcre_config.3 b/pcre/doc/pcre_config.3 index d3de14bb73c..d14ffdadeb1 100644 --- a/pcre/doc/pcre_config.3 +++ b/pcre/doc/pcre_config.3 @@ -1,4 +1,4 @@ -.TH PCRE_CONFIG 3 "05 November 2013" "PCRE 8.34" +.TH PCRE_CONFIG 3 "20 April 2014" "PCRE 8.36" .SH NAME PCRE - Perl-compatible regular expressions .SH SYNOPSIS @@ -24,8 +24,10 @@ arguments are as follows: \fIwhere\fP Points to where to put the data .sp The \fIwhere\fP argument must point to an integer variable, except for -PCRE_CONFIG_MATCH_LIMIT and PCRE_CONFIG_MATCH_LIMIT_RECURSION, when it must -point to an unsigned long integer. The available codes are: +PCRE_CONFIG_MATCH_LIMIT, PCRE_CONFIG_MATCH_LIMIT_RECURSION, and +PCRE_CONFIG_PARENS_LIMIT, when it must point to an unsigned long integer, +and for PCRE_CONFIG_JITTARGET, when it must point to a const char*. +The available codes are: .sp PCRE_CONFIG_JIT Availability of just-in-time compiler support (1=yes 0=no) diff --git a/pcre/doc/pcre_fullinfo.3 b/pcre/doc/pcre_fullinfo.3 index 01e2e928740..c9b2c656da5 100644 --- a/pcre/doc/pcre_fullinfo.3 +++ b/pcre/doc/pcre_fullinfo.3 @@ -1,4 +1,4 @@ -.TH PCRE_FULLINFO 3 "24 June 2012" "PCRE 8.30" +.TH PCRE_FULLINFO 3 "21 April 2014" "PCRE 8.36" .SH NAME PCRE - Perl-compatible regular expressions .SH SYNOPSIS @@ -43,6 +43,10 @@ The following information is available: PCRE_INFO_JITSIZE Size of JIT compiled code PCRE_INFO_LASTLITERAL Literal last data unit required PCRE_INFO_MINLENGTH Lower bound length of matching strings + PCRE_INFO_MATCHEMPTY Return 1 if the pattern can match an empty string, + 0 otherwise + PCRE_INFO_MATCHLIMIT Match limit if set, otherwise PCRE_RROR_UNSET + PCRE_INFO_MAXLOOKBEHIND Length (in characters) of the longest lookbehind assertion PCRE_INFO_NAMECOUNT Number of named subpatterns PCRE_INFO_NAMEENTRYSIZE Size of name table entry PCRE_INFO_NAMETABLE Pointer to name table @@ -58,6 +62,7 @@ The following information is available: 2 if the first character is at the start of the data string or after a newline, and 0 otherwise + PCRE_INFO_RECURSIONLIMIT Recursion limit if set, otherwise PCRE_ERROR_UNSET PCRE_INFO_REQUIREDCHAR Literal last data unit required PCRE_INFO_REQUIREDCHARFLAGS Returns 1 if the last data character is set (which can then be retrieved using PCRE_INFO_REQUIREDCHAR); 0 otherwise @@ -65,14 +70,18 @@ The following information is available: The \fIwhere\fP argument must point to an integer variable, except for the following \fIwhat\fP values: .sp - PCRE_INFO_DEFAULT_TABLES const unsigned char * - PCRE_INFO_FIRSTTABLE const unsigned char * + PCRE_INFO_DEFAULT_TABLES const uint8_t * + PCRE_INFO_FIRSTCHARACTER uint32_t + PCRE_INFO_FIRSTTABLE const uint8_t * + PCRE_INFO_JITSIZE size_t + PCRE_INFO_MATCHLIMIT uint32_t PCRE_INFO_NAMETABLE PCRE_SPTR16 (16-bit library) PCRE_INFO_NAMETABLE PCRE_SPTR32 (32-bit library) PCRE_INFO_NAMETABLE const unsigned char * (8-bit library) PCRE_INFO_OPTIONS unsigned long int PCRE_INFO_SIZE size_t - PCRE_INFO_FIRSTCHARACTER uint32_t + PCRE_INFO_STUDYSIZE size_t + PCRE_INFO_RECURSIONLIMIT uint32_t PCRE_INFO_REQUIREDCHAR uint32_t .sp The yield of the function is zero on success or: @@ -81,6 +90,7 @@ The yield of the function is zero on success or: the argument \fIwhere\fP was NULL PCRE_ERROR_BADMAGIC the "magic number" was not found PCRE_ERROR_BADOPTION the value of \fIwhat\fP was invalid + PCRE_ERROR_UNSET the option was not set .P There is a complete description of the PCRE native API in the .\" HREF diff --git a/pcre/doc/pcrepattern.3 b/pcre/doc/pcrepattern.3 index f1c45cda5d2..d0c6eeb7ddf 100644 --- a/pcre/doc/pcrepattern.3 +++ b/pcre/doc/pcrepattern.3 @@ -708,6 +708,7 @@ Armenian, Avestan, Balinese, Bamum, +Bassa_Vah, Batak, Bengali, Bopomofo, @@ -717,6 +718,7 @@ Buginese, Buhid, Canadian_Aboriginal, Carian, +Caucasian_Albanian, Chakma, Cham, Cherokee, @@ -727,11 +729,14 @@ Cypriot, Cyrillic, Deseret, Devanagari, +Duployan, Egyptian_Hieroglyphs, +Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, +Grantha, Greek, Gujarati, Gurmukhi, @@ -751,40 +756,56 @@ Katakana, Kayah_Li, Kharoshthi, Khmer, +Khojki, +Khudawadi, Lao, Latin, Lepcha, Limbu, +Linear_A, Linear_B, Lisu, Lycian, Lydian, +Mahajani, Malayalam, Mandaic, +Manichaean, Meetei_Mayek, +Mende_Kikakui, Meroitic_Cursive, Meroitic_Hieroglyphs, Miao, +Modi, Mongolian, +Mro, Myanmar, +Nabataean, New_Tai_Lue, Nko, Ogham, +Ol_Chiki, Old_Italic, +Old_North_Arabian, +Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, -Ol_Chiki, Oriya, Osmanya, +Pahawh_Hmong, +Palmyrene, +Pau_Cin_Hau, Phags_Pa, Phoenician, +Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Shavian, +Siddham, Sinhala, Sora_Sompeng, Sundanese, @@ -802,8 +823,10 @@ Thaana, Thai, Tibetan, Tifinagh, +Tirhuta, Ugaritic, Vai, +Warang_Citi, Yi. .P Each character has exactly one Unicode general category property, specified by diff --git a/pcre/doc/pcresyntax.3 b/pcre/doc/pcresyntax.3 index fd878da4f99..0850369f7aa 100644 --- a/pcre/doc/pcresyntax.3 +++ b/pcre/doc/pcresyntax.3 @@ -139,6 +139,7 @@ Armenian, Avestan, Balinese, Bamum, +Bassa_Vah, Batak, Bengali, Bopomofo, @@ -148,6 +149,7 @@ Buginese, Buhid, Canadian_Aboriginal, Carian, +Caucasian_Albanian, Chakma, Cham, Cherokee, @@ -158,11 +160,14 @@ Cypriot, Cyrillic, Deseret, Devanagari, +Duployan, Egyptian_Hieroglyphs, +Elbasan, Ethiopic, Georgian, Glagolitic, Gothic, +Grantha, Greek, Gujarati, Gurmukhi, @@ -182,40 +187,56 @@ Katakana, Kayah_Li, Kharoshthi, Khmer, +Khojki, +Khudawadi, Lao, Latin, Lepcha, Limbu, +Linear_A, Linear_B, Lisu, Lycian, Lydian, +Mahajani, Malayalam, Mandaic, +Manichaean, Meetei_Mayek, +Mende_Kikakui, Meroitic_Cursive, Meroitic_Hieroglyphs, Miao, +Modi, Mongolian, +Mro, Myanmar, +Nabataean, New_Tai_Lue, Nko, Ogham, +Ol_Chiki, Old_Italic, +Old_North_Arabian, +Old_Permic, Old_Persian, Old_South_Arabian, Old_Turkic, -Ol_Chiki, Oriya, Osmanya, +Pahawh_Hmong, +Palmyrene, +Pau_Cin_Hau, Phags_Pa, Phoenician, +Psalter_Pahlavi, Rejang, Runic, Samaritan, Saurashtra, Sharada, Shavian, +Siddham, Sinhala, Sora_Sompeng, Sundanese, @@ -233,8 +254,10 @@ Thaana, Thai, Tibetan, Tifinagh, +Tirhuta, Ugaritic, Vai, +Warang_Citi, Yi. . . diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c index 8a5b7233479..efc0b21fd14 100644 --- a/pcre/pcre_compile.c +++ b/pcre/pcre_compile.c @@ -47,8 +47,8 @@ supporting internal functions that are not used by other modules. */ #endif #define NLBLOCK cd /* Block containing newline information */ -#define PSSTART start_pattern /* Field containing processed string start */ -#define PSEND end_pattern /* Field containing processed string end */ +#define PSSTART start_pattern /* Field containing pattern start */ +#define PSEND end_pattern /* Field containing pattern end */ #include "pcre_internal.h" @@ -549,6 +549,7 @@ static const char error_texts[] = "group name must start with a non-digit\0" /* 85 */ "parentheses are too deeply nested (stack check)\0" + "digits missing in \\x{} or \\o{}\0" ; /* Table to identify digits and hex digits. This is used when compiling @@ -1259,6 +1260,7 @@ else case CHAR_o: if (ptr[1] != CHAR_LEFT_CURLY_BRACKET) *errorcodeptr = ERR81; else + if (ptr[2] == CHAR_RIGHT_CURLY_BRACKET) *errorcodeptr = ERR86; else { ptr += 2; c = 0; @@ -1328,6 +1330,11 @@ else if (ptr[1] == CHAR_LEFT_CURLY_BRACKET) { ptr += 2; + if (*ptr == CHAR_RIGHT_CURLY_BRACKET) + { + *errorcodeptr = ERR86; + break; + } c = 0; overflow = FALSE; while (MAX_255(*ptr) && (digitab[*ptr] & ctype_xdigit) != 0) @@ -1583,29 +1590,29 @@ read_repeat_counts(const pcre_uchar *p, int *minp, int *maxp, int *errorcodeptr) int min = 0; int max = -1; -/* Read the minimum value and do a paranoid check: a negative value indicates -an integer overflow. */ - -while (IS_DIGIT(*p)) min = min * 10 + (int)(*p++ - CHAR_0); -if (min < 0 || min > 65535) +while (IS_DIGIT(*p)) { - *errorcodeptr = ERR5; - return p; + min = min * 10 + (int)(*p++ - CHAR_0); + if (min > 65535) + { + *errorcodeptr = ERR5; + return p; + } } -/* Read the maximum value if there is one, and again do a paranoid on its size. -Also, max must not be less than min. */ - if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else { if (*(++p) != CHAR_RIGHT_CURLY_BRACKET) { max = 0; - while(IS_DIGIT(*p)) max = max * 10 + (int)(*p++ - CHAR_0); - if (max < 0 || max > 65535) + while(IS_DIGIT(*p)) { - *errorcodeptr = ERR5; - return p; + max = max * 10 + (int)(*p++ - CHAR_0); + if (max > 65535) + { + *errorcodeptr = ERR5; + return p; + } } if (max < min) { @@ -1615,9 +1622,6 @@ if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else } } -/* Fill in the required variables, and pass back the pointer to the terminating -'}'. */ - *minp = min; *maxp = max; return p; @@ -2370,6 +2374,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE); if (c == OP_RECURSE) { const pcre_uchar *scode = cd->start_code + GET(code, 1); + const pcre_uchar *endgroup = scode; BOOL empty_branch; /* Test for forward reference or uncompleted reference. This is disabled @@ -2384,20 +2389,16 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE); if (GET(scode, 1) == 0) return TRUE; /* Unclosed */ } - /* If we are scanning a completed pattern, there are no forward references - and all groups are complete. We need to detect whether this is a recursive - call, as otherwise there will be an infinite loop. If it is a recursion, - just skip over it. Simple recursions are easily detected. For mutual - recursions we keep a chain on the stack. */ + /* If the reference is to a completed group, we need to detect whether this + is a recursive call, as otherwise there will be an infinite loop. If it is + a recursion, just skip over it. Simple recursions are easily detected. For + mutual recursions we keep a chain on the stack. */ + do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); + if (code >= scode && code <= endgroup) continue; /* Simple recursion */ else { recurse_check *r = recurses; - const pcre_uchar *endgroup = scode; - - do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); - if (code >= scode && code <= endgroup) continue; /* Simple recursion */ - for (r = recurses; r != NULL; r = r->prev) if (r->group == scode) break; if (r != NULL) continue; /* Mutual recursion */ @@ -3038,7 +3039,7 @@ switch(c) end += 1 + 2 * IMM2_SIZE; break; } - list[2] = end - code; + list[2] = (pcre_uint32)(end - code); return end; } return NULL; /* Opcode not accepted */ @@ -3079,6 +3080,7 @@ const pcre_uint8 *class_bitset; const pcre_uint8 *set1, *set2, *set_end; pcre_uint32 chr; BOOL accepted, invert_bits; +BOOL entered_a_group = FALSE; /* Note: the base_list[1] contains whether the current opcode has greedy (represented by a non-zero value) quantifier. This is a different from @@ -3132,8 +3134,10 @@ for(;;) case OP_ONCE: case OP_ONCE_NC: /* Atomic sub-patterns and assertions can always auto-possessify their - last iterator. */ - return TRUE; + last iterator. However, if the group was entered as a result of checking + a previous iterator, this is not possible. */ + + return !entered_a_group; } code += PRIV(OP_lengths)[c]; @@ -3152,6 +3156,8 @@ for(;;) code = next_code + 1 + LINK_SIZE; next_code += GET(next_code, 1); } + + entered_a_group = TRUE; continue; case OP_BRAZERO: @@ -3171,6 +3177,9 @@ for(;;) code += PRIV(OP_lengths)[c]; continue; + + default: + break; } /* Check for a supported opcode, and load its properties. */ @@ -3409,8 +3418,7 @@ for(;;) rightop >= FIRST_AUTOTAB_OP && rightop <= LAST_AUTOTAB_RIGHT_OP && autoposstab[leftop - FIRST_AUTOTAB_OP][rightop - FIRST_AUTOTAB_OP]; - if (!accepted) - return FALSE; + if (!accepted) return FALSE; if (list[1] == 0) return TRUE; /* Might be an empty repeat. */ @@ -4683,7 +4691,8 @@ for (;; ptr++) previous = NULL; if ((options & PCRE_MULTILINE) != 0) { - if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE; + if (firstcharflags == REQ_UNSET) + zerofirstcharflags = firstcharflags = REQ_NONE; *code++ = OP_CIRCM; } else *code++ = OP_CIRC; @@ -4863,7 +4872,7 @@ for (;; ptr++) if (lengthptr != NULL && class_uchardata > class_uchardata_base) { xclass = TRUE; - *lengthptr += class_uchardata - class_uchardata_base; + *lengthptr += (int)(class_uchardata - class_uchardata_base); class_uchardata = class_uchardata_base; } #endif @@ -5313,7 +5322,7 @@ for (;; ptr++) whatever repeat count may follow. In the case of reqchar, save the previous value for reinstating. */ - if (class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET) + if (!inescq && class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET) { ptr++; zeroreqchar = reqchar; @@ -6008,8 +6017,8 @@ for (;; ptr++) while (cd->hwm > cd->start_workspace + cd->workspace_size - WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm)) { - int save_offset = save_hwm - cd->start_workspace; - int this_offset = this_hwm - cd->start_workspace; + size_t save_offset = save_hwm - cd->start_workspace; + size_t this_offset = this_hwm - cd->start_workspace; *errorcodeptr = expand_workspace(cd); if (*errorcodeptr != 0) goto FAILED; save_hwm = (pcre_uchar *)cd->start_workspace + save_offset; @@ -6090,8 +6099,8 @@ for (;; ptr++) while (cd->hwm > cd->start_workspace + cd->workspace_size - WORK_SIZE_SAFETY_MARGIN - (this_hwm - save_hwm)) { - int save_offset = save_hwm - cd->start_workspace; - int this_offset = this_hwm - cd->start_workspace; + size_t save_offset = save_hwm - cd->start_workspace; + size_t this_offset = this_hwm - cd->start_workspace; *errorcodeptr = expand_workspace(cd); if (*errorcodeptr != 0) goto FAILED; save_hwm = (pcre_uchar *)cd->start_workspace + save_offset; @@ -6689,7 +6698,8 @@ for (;; ptr++) ptr++; } namelen = (int)(ptr - name); - if (lengthptr != NULL) *lengthptr += IMM2_SIZE; + if (lengthptr != NULL && (options & PCRE_DUPNAMES) != 0) + *lengthptr += IMM2_SIZE; } /* Check the terminator */ @@ -6750,9 +6760,11 @@ for (;; ptr++) for (; i < cd->names_found; i++) { slot += cd->name_entry_size; - if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) != 0) break; + if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) != 0 || + (slot+IMM2_SIZE)[namelen] != 0) break; count++; } + if (count > 1) { PUT2(code, 2+LINK_SIZE, offset); @@ -7101,6 +7113,12 @@ for (;; ptr++) /* Count named back references. */ if (!is_recurse) cd->namedrefcount++; + + /* If duplicate names are permitted, we have to allow for a named + reference to a duplicated name (this cannot be determined until the + second pass). This needs an extra 16-bit data item. */ + + if ((options & PCRE_DUPNAMES) != 0) *lengthptr += IMM2_SIZE; } /* In the real compile, search the name table. We check the name @@ -7147,6 +7165,8 @@ for (;; ptr++) for (i++; i < cd->names_found; i++) { if (STRCMP_UC_UC(slot + IMM2_SIZE, cslot + IMM2_SIZE) != 0) break; + + count++; cslot += cd->name_entry_size; } @@ -8244,12 +8264,16 @@ for (;;) /* If it was a capturing subpattern, check to see if it contained any recursive back references. If so, we must wrap it in atomic brackets. - In any event, remove the block from the chain. */ + Because we are moving code along, we must ensure that any pending recursive + references are updated. In any event, remove the block from the chain. */ if (capnumber > 0) { if (cd->open_caps->flag) { + *code = OP_END; + adjust_recurse(start_bracket, 1 + LINK_SIZE, + (options & PCRE_UTF8) != 0, cd, cd->hwm); memmove(start_bracket + 1 + LINK_SIZE, start_bracket, IN_UCHARS(code - start_bracket)); *start_bracket = OP_ONCE; @@ -9254,11 +9278,18 @@ subpattern. */ if (errorcode == 0 && re->top_backref > re->top_bracket) errorcode = ERR15; -/* Unless disabled, check whether single character iterators can be -auto-possessified. The function overwrites the appropriate opcode values. */ +/* Unless disabled, check whether any single character iterators can be +auto-possessified. The function overwrites the appropriate opcode values, so +the type of the pointer must be cast. NOTE: the intermediate variable "temp" is +used in this code because at least one compiler gives a warning about loss of +"const" attribute if the cast (pcre_uchar *)codestart is used directly in the +function call. */ if ((options & PCRE_NO_AUTO_POSSESS) == 0) - auto_possessify((pcre_uchar *)codestart, utf, cd); + { + pcre_uchar *temp = (pcre_uchar *)codestart; + auto_possessify(temp, utf, cd); + } /* If there were any lookbehind assertions that contained OP_RECURSE (recursions or subroutine calls), a flag is set for them to be checked here, diff --git a/pcre/pcre_dfa_exec.c b/pcre/pcre_dfa_exec.c index fb0c7e805dc..87f4aef9ab1 100644 --- a/pcre/pcre_dfa_exec.c +++ b/pcre/pcre_dfa_exec.c @@ -3242,7 +3242,7 @@ md->callout_data = NULL; if (extra_data != NULL) { - unsigned int flags = extra_data->flags; + unsigned long int flags = extra_data->flags; if ((flags & PCRE_EXTRA_STUDY_DATA) != 0) study = (const pcre_study_data *)extra_data->study_data; if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0) return PCRE_ERROR_DFA_UMLIMIT; diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c index 5dec99234a9..654eb9e2762 100644 --- a/pcre/pcre_exec.c +++ b/pcre/pcre_exec.c @@ -1167,11 +1167,16 @@ for (;;) if (rrc == MATCH_KETRPOS) { offset_top = md->end_offset_top; - eptr = md->end_match_ptr; ecode = md->start_code + code_offset; save_capture_last = md->capture_last; matched_once = TRUE; mstart = md->start_match_ptr; /* In case \K changed it */ + if (eptr == md->end_match_ptr) /* Matched an empty string */ + { + do ecode += GET(ecode, 1); while (*ecode == OP_ALT); + break; + } + eptr = md->end_match_ptr; continue; } @@ -1241,10 +1246,15 @@ for (;;) if (rrc == MATCH_KETRPOS) { offset_top = md->end_offset_top; - eptr = md->end_match_ptr; ecode = md->start_code + code_offset; matched_once = TRUE; mstart = md->start_match_ptr; /* In case \K reset it */ + if (eptr == md->end_match_ptr) /* Matched an empty string */ + { + do ecode += GET(ecode, 1); while (*ecode == OP_ALT); + break; + } + eptr = md->end_match_ptr; continue; } @@ -1979,6 +1989,19 @@ for (;;) } } + /* OP_KETRPOS is a possessive repeating ket. Remember the current position, + and return the MATCH_KETRPOS. This makes it possible to do the repeats one + at a time from the outer level, thus saving stack. This must precede the + empty string test - in this case that test is done at the outer level. */ + + if (*ecode == OP_KETRPOS) + { + md->start_match_ptr = mstart; /* In case \K reset it */ + md->end_match_ptr = eptr; + md->end_offset_top = offset_top; + RRETURN(MATCH_KETRPOS); + } + /* For an ordinary non-repeating ket, just continue at this level. This also happens for a repeating ket if no characters were matched in the group. This is the forcible breaking of infinite loops as implemented in @@ -2001,18 +2024,6 @@ for (;;) break; } - /* OP_KETRPOS is a possessive repeating ket. Remember the current position, - and return the MATCH_KETRPOS. This makes it possible to do the repeats one - at a time from the outer level, thus saving stack. */ - - if (*ecode == OP_KETRPOS) - { - md->start_match_ptr = mstart; /* In case \K reset it */ - md->end_match_ptr = eptr; - md->end_offset_top = offset_top; - RRETURN(MATCH_KETRPOS); - } - /* The normal repeating kets try the rest of the pattern or restart from the preceding bracket, in the appropriate order. In the second case, we can use tail recursion to avoid using another stack frame, unless we have an @@ -5681,54 +5692,25 @@ for (;;) switch(ctype) { case OP_ANY: - if (max < INT_MAX) + for (i = min; i < max; i++) { - for (i = min; i < max; i++) + if (eptr >= md->end_subject) { - if (eptr >= md->end_subject) - { - SCHECK_PARTIAL(); - break; - } - if (IS_NEWLINE(eptr)) break; - if (md->partial != 0 && /* Take care with CRLF partial */ - eptr + 1 >= md->end_subject && - NLBLOCK->nltype == NLTYPE_FIXED && - NLBLOCK->nllen == 2 && - UCHAR21(eptr) == NLBLOCK->nl[0]) - { - md->hitend = TRUE; - if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); - } - eptr++; - ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++); + SCHECK_PARTIAL(); + break; } - } - - /* Handle unlimited UTF-8 repeat */ - - else - { - for (i = min; i < max; i++) + if (IS_NEWLINE(eptr)) break; + if (md->partial != 0 && /* Take care with CRLF partial */ + eptr + 1 >= md->end_subject && + NLBLOCK->nltype == NLTYPE_FIXED && + NLBLOCK->nllen == 2 && + UCHAR21(eptr) == NLBLOCK->nl[0]) { - if (eptr >= md->end_subject) - { - SCHECK_PARTIAL(); - break; - } - if (IS_NEWLINE(eptr)) break; - if (md->partial != 0 && /* Take care with CRLF partial */ - eptr + 1 >= md->end_subject && - NLBLOCK->nltype == NLTYPE_FIXED && - NLBLOCK->nllen == 2 && - UCHAR21(eptr) == NLBLOCK->nl[0]) - { - md->hitend = TRUE; - if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); - } - eptr++; - ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++); + md->hitend = TRUE; + if (md->partial > 1) RRETURN(PCRE_ERROR_PARTIAL); } + eptr++; + ACROSSCHAR(eptr < md->end_subject, *eptr, eptr++); } break; @@ -6519,7 +6501,7 @@ tables = re->tables; if (extra_data != NULL) { - register unsigned int flags = extra_data->flags; + unsigned long int flags = extra_data->flags; if ((flags & PCRE_EXTRA_STUDY_DATA) != 0) study = (const pcre_study_data *)extra_data->study_data; if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0) diff --git a/pcre/pcre_internal.h b/pcre/pcre_internal.h index 6e915a0e453..02d3ab17c5d 100644 --- a/pcre/pcre_internal.h +++ b/pcre/pcre_internal.h @@ -2281,7 +2281,7 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59, ERR60, ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70, ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, - ERR80, ERR81, ERR82, ERR83, ERR84, ERR85, ERRCOUNT }; + ERR80, ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERRCOUNT }; /* JIT compiling modes. The function list is indexed by them. */ diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c index e67071ef791..256e3a45b13 100644 --- a/pcre/pcre_jit_compile.c +++ b/pcre/pcre_jit_compile.c @@ -200,7 +200,7 @@ typedef struct stub_list { typedef struct label_addr_list { struct sljit_label *label; - sljit_uw *addr; + sljit_uw *update_addr; struct label_addr_list *next; } label_addr_list; @@ -475,16 +475,16 @@ typedef struct compare_context { /* Used for accessing the elements of the stack. */ #define STACK(i) ((-(i) - 1) * (int)sizeof(sljit_sw)) -#define TMP1 SLJIT_SCRATCH_REG1 -#define TMP2 SLJIT_SCRATCH_REG3 -#define TMP3 SLJIT_TEMPORARY_EREG2 -#define STR_PTR SLJIT_SAVED_REG1 -#define STR_END SLJIT_SAVED_REG2 -#define STACK_TOP SLJIT_SCRATCH_REG2 -#define STACK_LIMIT SLJIT_SAVED_REG3 -#define ARGUMENTS SLJIT_SAVED_EREG1 -#define COUNT_MATCH SLJIT_SAVED_EREG2 -#define RETURN_ADDR SLJIT_TEMPORARY_EREG1 +#define TMP1 SLJIT_R0 +#define TMP2 SLJIT_R2 +#define TMP3 SLJIT_R3 +#define STR_PTR SLJIT_S0 +#define STR_END SLJIT_S1 +#define STACK_TOP SLJIT_R1 +#define STACK_LIMIT SLJIT_S2 +#define COUNT_MATCH SLJIT_S3 +#define ARGUMENTS SLJIT_S4 +#define RETURN_ADDR SLJIT_R4 /* Local space layout. */ /* These two locals can be used by the current opcode. */ @@ -1441,7 +1441,7 @@ while (cc < ccend) SLJIT_ASSERT(common->has_set_som); if (!setsom_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0)); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1457,7 +1457,7 @@ while (cc < ccend) SLJIT_ASSERT(common->mark_ptr != 0); if (!setmark_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1470,7 +1470,7 @@ while (cc < ccend) case OP_RECURSE: if (common->has_set_som && !setsom_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0)); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1479,7 +1479,7 @@ while (cc < ccend) } if (common->mark_ptr != 0 && !setmark_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1488,7 +1488,7 @@ while (cc < ccend) } if (common->capture_last_ptr != 0 && !capture_last_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1504,7 +1504,7 @@ while (cc < ccend) case OP_SCBRAPOS: if (common->capture_last_ptr != 0 && !capture_last_found) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); @@ -1514,8 +1514,8 @@ while (cc < ccend) offset = (GET2(cc, 1 + LINK_SIZE)) << 1; OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset)); stackpos += (int)sizeof(sljit_sw); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0); stackpos += (int)sizeof(sljit_sw); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0); @@ -1895,7 +1895,7 @@ do OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP1, 0); stackptr += sizeof(sljit_sw); } - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), srcw[count]); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), srcw[count]); tmp1empty = FALSE; tmp1next = FALSE; } @@ -1906,7 +1906,7 @@ do OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackptr, TMP2, 0); stackptr += sizeof(sljit_sw); } - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), srcw[count]); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), srcw[count]); tmp2empty = FALSE; tmp1next = TRUE; } @@ -1916,7 +1916,7 @@ do if (tmp1next) { SLJIT_ASSERT(!tmp1empty); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), srcw[count], TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), srcw[count], TMP1, 0); tmp1empty = stackptr >= stacktop; if (!tmp1empty) { @@ -1928,7 +1928,7 @@ do else { SLJIT_ASSERT(!tmp2empty); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), srcw[count], TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), srcw[count], TMP2, 0); tmp2empty = stackptr >= stacktop; if (!tmp2empty) { @@ -2070,7 +2070,7 @@ while (list_item) common->stubs = NULL; } -static void add_label_addr(compiler_common *common) +static void add_label_addr(compiler_common *common, sljit_uw *update_addr) { DEFINE_COMPILER; label_addr_list *label_addr; @@ -2079,10 +2079,9 @@ label_addr = sljit_alloc_memory(compiler, sizeof(label_addr_list)); if (label_addr == NULL) return; label_addr->label = LABEL(); -label_addr->addr = common->read_only_data_ptr; +label_addr->update_addr = update_addr; label_addr->next = common->label_addrs; common->label_addrs = label_addr; -common->read_only_data_ptr++; } static SLJIT_INLINE void count_match(compiler_common *common) @@ -2103,8 +2102,8 @@ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw)); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 12345); OP1(SLJIT_MOV, TMP3, 0, TMP1, 0); OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, TMP1, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, TMP1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0); #endif add_stub(common, CMP(SLJIT_C_GREATER, STACK_TOP, 0, STACK_LIMIT, 0)); } @@ -2124,19 +2123,19 @@ int i; /* At this point we can freely use all temporary registers. */ SLJIT_ASSERT(length > 1); /* TMP1 returns with begin - 1. */ -OP2(SLJIT_SUB, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, IN_UCHARS(1)); +OP2(SLJIT_SUB, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_S0), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, IN_UCHARS(1)); if (length < 8) { for (i = 1; i < length; i++) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(i), SLJIT_SCRATCH_REG1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(i), SLJIT_R0, 0); } else { - GET_LOCAL_BASE(SLJIT_SCRATCH_REG2, 0, OVECTOR_START); - OP1(SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, length - 1); + GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START); + OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1); loop = LABEL(); - OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(sljit_sw), SLJIT_SCRATCH_REG1, 0); - OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 1); + OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw), SLJIT_R0, 0); + OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, loop); } } @@ -2150,11 +2149,11 @@ int i; SLJIT_ASSERT(length > 1); /* OVECTOR(1) contains the "string begin - 1" constant. */ if (length > 2) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)); if (length < 8) { for (i = 2; i < length; i++) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(i), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(i), TMP1, 0); } else { @@ -2168,11 +2167,11 @@ else OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0); if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0); if (common->control_head_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack)); -OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_ptr); +OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, base)); } @@ -2206,44 +2205,44 @@ struct sljit_label *loop; struct sljit_jump *early_quit; /* At this point we can freely use all registers. */ -OP1(SLJIT_MOV, SLJIT_SAVED_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1), STR_PTR, 0); +OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(1), STR_PTR, 0); -OP1(SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, ARGUMENTS, 0); +OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0); if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr); -OP1(SLJIT_MOV_SI, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), SLJIT_OFFSETOF(jit_arguments, offset_count)); + OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); +OP1(SLJIT_MOV_SI, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offset_count)); if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_SCRATCH_REG3, 0); -OP2(SLJIT_SUB, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int)); -OP1(SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), SLJIT_OFFSETOF(jit_arguments, begin)); -GET_LOCAL_BASE(SLJIT_SAVED_REG1, 0, OVECTOR_START); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0); +OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, offsets), SLJIT_IMM, sizeof(int)); +OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin)); +GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START); /* Unlikely, but possible */ -early_quit = CMP(SLJIT_C_EQUAL, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 0); +early_quit = CMP(SLJIT_C_EQUAL, SLJIT_R1, 0, SLJIT_IMM, 0); loop = LABEL(); -OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, SLJIT_MEM1(SLJIT_SAVED_REG1), 0, SLJIT_SCRATCH_REG1, 0); -OP2(SLJIT_ADD, SLJIT_SAVED_REG1, 0, SLJIT_SAVED_REG1, 0, SLJIT_IMM, sizeof(sljit_sw)); +OP2(SLJIT_SUB, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 0, SLJIT_R0, 0); +OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw)); /* Copy the integer value to the output buffer */ #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32 -OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, UCHAR_SHIFT); +OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT); #endif -OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_SCRATCH_REG3), sizeof(int), SLJIT_SAVED_REG2, 0); -OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1); +OP1(SLJIT_MOVU_SI, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0); +OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, loop); JUMPHERE(early_quit); /* Calculate the return value, which is the maximum ovector value. */ if (topbracket > 1) { - GET_LOCAL_BASE(SLJIT_SCRATCH_REG1, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw)); - OP1(SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, topbracket + 1); + GET_LOCAL_BASE(SLJIT_R0, 0, OVECTOR_START + topbracket * 2 * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, topbracket + 1); - /* OVECTOR(0) is never equal to SLJIT_SAVED_REG3. */ + /* OVECTOR(0) is never equal to SLJIT_S2. */ loop = LABEL(); - OP1(SLJIT_MOVU, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG1), -(2 * (sljit_sw)sizeof(sljit_sw))); - OP2(SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, SLJIT_SCRATCH_REG2, 0, SLJIT_IMM, 1); - CMPTO(SLJIT_C_EQUAL, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG3, 0, loop); - OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_SCRATCH_REG2, 0); + OP1(SLJIT_MOVU, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), -(2 * (sljit_sw)sizeof(sljit_sw))); + OP2(SLJIT_SUB, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1); + CMPTO(SLJIT_C_EQUAL, SLJIT_R2, 0, SLJIT_S2, 0, loop); + OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_R1, 0); } else OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1); @@ -2254,39 +2253,39 @@ static SLJIT_INLINE void return_with_partial_match(compiler_common *common, stru DEFINE_COMPILER; struct sljit_jump *jump; -SLJIT_COMPILE_ASSERT(STR_END == SLJIT_SAVED_REG2, str_end_must_be_saved_reg2); +SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S1, str_end_must_be_saved_reg2); SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0 && (common->mode == JIT_PARTIAL_SOFT_COMPILE ? common->hit_start != 0 : common->hit_start == 0)); -OP1(SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, ARGUMENTS, 0); +OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_PARTIAL); -OP1(SLJIT_MOV_SI, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG2), SLJIT_OFFSETOF(jit_arguments, real_offset_count)); -CMPTO(SLJIT_C_SIG_LESS, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 2, quit); +OP1(SLJIT_MOV_SI, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, real_offset_count)); +CMPTO(SLJIT_C_SIG_LESS, SLJIT_R2, 0, SLJIT_IMM, 2, quit); /* Store match begin and end. */ -OP1(SLJIT_MOV, SLJIT_SAVED_REG1, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG2), SLJIT_OFFSETOF(jit_arguments, begin)); -OP1(SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, SLJIT_MEM1(SLJIT_SCRATCH_REG2), SLJIT_OFFSETOF(jit_arguments, offsets)); +OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, begin)); +OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, offsets)); -jump = CMP(SLJIT_C_SIG_LESS, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, 3); -OP2(SLJIT_SUB, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_ptr : (common->hit_start + (int)sizeof(sljit_sw)), SLJIT_SAVED_REG1, 0); +jump = CMP(SLJIT_C_SIG_LESS, SLJIT_R2, 0, SLJIT_IMM, 3); +OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_ptr : (common->hit_start + (int)sizeof(sljit_sw)), SLJIT_S0, 0); #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32 -OP2(SLJIT_ASHR, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, UCHAR_SHIFT); +OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT); #endif -OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 2 * sizeof(int), SLJIT_SCRATCH_REG3, 0); +OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), 2 * sizeof(int), SLJIT_R2, 0); JUMPHERE(jump); -OP1(SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start); -OP2(SLJIT_SUB, SLJIT_SAVED_REG2, 0, STR_END, 0, SLJIT_SAVED_REG1, 0); +OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == JIT_PARTIAL_HARD_COMPILE ? common->start_used_ptr : common->hit_start); +OP2(SLJIT_SUB, SLJIT_S1, 0, STR_END, 0, SLJIT_S0, 0); #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32 -OP2(SLJIT_ASHR, SLJIT_SAVED_REG2, 0, SLJIT_SAVED_REG2, 0, SLJIT_IMM, UCHAR_SHIFT); +OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT); #endif -OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_SCRATCH_REG2), sizeof(int), SLJIT_SAVED_REG2, 0); +OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), sizeof(int), SLJIT_S1, 0); -OP2(SLJIT_SUB, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_SAVED_REG1, 0); +OP2(SLJIT_SUB, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_S0, 0); #if defined COMPILE_PCRE16 || defined COMPILE_PCRE32 -OP2(SLJIT_ASHR, SLJIT_SCRATCH_REG3, 0, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, UCHAR_SHIFT); +OP2(SLJIT_ASHR, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, UCHAR_SHIFT); #endif -OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_SCRATCH_REG2), 0, SLJIT_SCRATCH_REG3, 0); +OP1(SLJIT_MOV_SI, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R2, 0); JUMPTO(SLJIT_JUMP, quit); } @@ -2300,17 +2299,17 @@ struct sljit_jump *jump; if (common->mode == JIT_PARTIAL_SOFT_COMPILE) { /* The value of -1 must be kept for start_used_ptr! */ - OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, SLJIT_IMM, 1); + OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, 1); /* Jumps if start_used_ptr < STR_PTR, or start_used_ptr == -1. Although overwriting is not necessary if start_used_ptr == STR_PTR, it does not hurt as well. */ jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); JUMPHERE(jump); } else if (common->mode == JIT_PARTIAL_HARD_COMPILE) { - jump = CMP(SLJIT_C_LESS_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); + jump = CMP(SLJIT_C_LESS_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); JUMPHERE(jump); } } @@ -2446,12 +2445,12 @@ if (common->mode == JIT_COMPILE) return; if (!force) - jump = CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); + jump = CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); else if (common->mode == JIT_PARTIAL_SOFT_COMPILE) - jump = CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, SLJIT_IMM, -1); + jump = CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1); if (common->mode == JIT_PARTIAL_SOFT_COMPILE) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); else { if (common->partialmatchlabel != NULL) @@ -2479,13 +2478,13 @@ if (common->mode == JIT_COMPILE) jump = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0); if (common->mode == JIT_PARTIAL_SOFT_COMPILE) { - add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0); + add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); add_jump(compiler, end_reached, JUMP(SLJIT_JUMP)); } else { - add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0)); + add_jump(compiler, end_reached, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); if (common->partialmatchlabel != NULL) JUMPTO(SLJIT_JUMP, common->partialmatchlabel); else @@ -2507,10 +2506,10 @@ if (common->mode == JIT_COMPILE) /* Partial matching mode. */ jump = CMP(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0); -add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0)); +add_jump(compiler, backtracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); if (common->mode == JIT_PARTIAL_SOFT_COMPILE) { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); } else @@ -3066,19 +3065,19 @@ if (firstline) CMPTO(SLJIT_C_NOT_EQUAL, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff, mainloop); CMPTO(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, common->newline & 0xff, mainloop); JUMPHERE(end); - OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); } else { end = CMP(SLJIT_C_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); mainloop = LABEL(); /* Continual stores does not cause data dependency. */ - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0); read_char_range(common, common->nlmin, common->nlmax, TRUE); check_newlinechar(common, common->nltype, &newline, TRUE); CMPTO(SLJIT_C_LESS, STR_PTR, 0, STR_END, 0, mainloop); JUMPHERE(end); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->first_line_end, STR_PTR, 0); set_jumps(newline, LABEL()); } @@ -3681,7 +3680,7 @@ max -= 1; if (firstline) { SLJIT_ASSERT(common->first_line_end != 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); quit = CMP(SLJIT_C_LESS_EQUAL, STR_END, 0, TMP1, 0); @@ -3752,7 +3751,7 @@ JUMPHERE(quit); if (firstline) { if (range_right >= 0) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); if (range_right >= 0) { @@ -3781,7 +3780,7 @@ if (firstline) { SLJIT_ASSERT(common->first_line_end != 0); OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); } start = LABEL(); @@ -3841,7 +3840,7 @@ if (firstline) { SLJIT_ASSERT(common->first_line_end != 0); OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); } if (common->nltype == NLTYPE_FIXED && common->newline > 255) @@ -3931,7 +3930,7 @@ if (firstline) { SLJIT_ASSERT(common->first_line_end != 0); OP1(SLJIT_MOV, RETURN_ADDR, 0, STR_END, 0); - OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); } start = LABEL(); @@ -4005,7 +4004,7 @@ struct sljit_jump *notfound; pcre_uint32 oc, bit; SLJIT_ASSERT(common->req_char_ptr != 0); -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr); +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr); OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, REQ_BYTE_MAX); toolong = CMP(SLJIT_C_LESS, TMP1, 0, STR_END, 0); alreadyfound = CMP(SLJIT_C_LESS, STR_PTR, 0, TMP2, 0); @@ -4050,7 +4049,7 @@ JUMPTO(SLJIT_JUMP, loop); JUMPHERE(found); if (foundoc) JUMPHERE(foundoc); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr, TMP1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, TMP1, 0); JUMPHERE(alreadyfound); JUMPHERE(toolong); return notfound; @@ -4102,11 +4101,11 @@ struct sljit_jump *jump; SLJIT_COMPILE_ASSERT(ctype_word == 0x10, ctype_word_must_be_16); -sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); +sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0); /* Get type of the previous char, and put it to LOCALS1. */ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, SLJIT_IMM, 0); skipread = CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP1, 0); skip_char_back(common); check_start_used_ptr(common); @@ -4126,7 +4125,7 @@ if (common->use_ucp) OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd); OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL); JUMPHERE(jump); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0); } else #endif @@ -4142,7 +4141,7 @@ else OP1(SLJIT_MOV_UB, TMP1, 0, SLJIT_MEM1(TMP1), common->ctypes); OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 4 /* ctype_word */); OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0); #ifndef COMPILE_PCRE8 JUMPHERE(jump); #elif defined SUPPORT_UTF @@ -4196,8 +4195,8 @@ else } set_jumps(skipread_list, LABEL()); -OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1); -sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); +OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1); +sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0); } static BOOL check_class_ranges(compiler_common *common, const pcre_uint8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks) @@ -4455,7 +4454,7 @@ struct sljit_label *label; sljit_emit_fast_enter(compiler, RETURN_ADDR, 0); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); OP1(SLJIT_MOV, TMP3, 0, CHAR1, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR2, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR2, 0); OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1)); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); @@ -4469,7 +4468,7 @@ JUMPTO(SLJIT_C_NOT_ZERO, label); JUMPHERE(jump); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); OP1(SLJIT_MOV, CHAR1, 0, TMP3, 0); -OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); +OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); sljit_emit_fast_return(compiler, RETURN_ADDR, 0); } @@ -4485,8 +4484,8 @@ sljit_emit_fast_enter(compiler, RETURN_ADDR, 0); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); OP1(SLJIT_MOV, TMP3, 0, LCC_TABLE, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, CHAR1, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, CHAR2, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, CHAR1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, CHAR2, 0); OP1(SLJIT_MOV, LCC_TABLE, 0, SLJIT_IMM, common->lcc); OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(1)); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); @@ -4513,8 +4512,8 @@ JUMPTO(SLJIT_C_NOT_ZERO, label); JUMPHERE(jump); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); OP1(SLJIT_MOV, LCC_TABLE, 0, TMP3, 0); -OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); -OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1); +OP1(SLJIT_MOV, CHAR1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); +OP1(SLJIT_MOV, CHAR2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1); sljit_emit_fast_return(compiler, RETURN_ADDR, 0); } @@ -5419,7 +5418,7 @@ switch(type) add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL)); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, gbprop)); /* Optimize register allocation: use a real register. */ - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0); OP1(SLJIT_MOV_UB, STACK_TOP, 0, SLJIT_MEM2(TMP1, TMP2), 3); label = LABEL(); @@ -5439,7 +5438,7 @@ switch(type) OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0); JUMPHERE(jump[0]); - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); if (common->mode == JIT_PARTIAL_HARD_COMPILE) { @@ -5505,12 +5504,12 @@ switch(type) } else { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, STR_PTR, 0); read_char_range(common, common->nlmin, common->nlmax, TRUE); add_jump(compiler, backtracks, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, STR_END, 0)); add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL)); add_jump(compiler, backtracks, JUMP(SLJIT_C_ZERO)); - OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1); + OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1); } JUMPHERE(jump[2]); JUMPHERE(jump[3]); @@ -5914,21 +5913,21 @@ jump_list *found = NULL; SLJIT_ASSERT(*cc == OP_DNREF || *cc == OP_DNREFI); -OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)); +OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)); count--; while (count-- > 0) { offset = GET2(slot, 0) << 1; GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset)); - add_jump(compiler, &found, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0)); + add_jump(compiler, &found, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0)); slot += common->name_entry_size; } offset = GET2(slot, 0) << 1; GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset)); if (backtracks != NULL && !common->jscript_compat) - add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0)); + add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0)); set_jumps(found, LABEL()); } @@ -5945,10 +5944,10 @@ struct sljit_jump *nopartial; if (ref) { offset = GET2(cc, 1) << 1; - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); /* OVECTOR(1) contains the "string begin - 1" constant. */ if (withchecks && !common->jscript_compat) - add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1))); + add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1))); } else OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0); @@ -5956,9 +5955,9 @@ else #if defined SUPPORT_UTF && defined SUPPORT_UCP if (common->utf && *cc == OP_REFI) { - SLJIT_ASSERT(TMP1 == SLJIT_SCRATCH_REG1 && STACK_TOP == SLJIT_SCRATCH_REG2 && TMP2 == SLJIT_SCRATCH_REG3); + SLJIT_ASSERT(TMP1 == SLJIT_R0 && STACK_TOP == SLJIT_R1 && TMP2 == SLJIT_R2); if (ref) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); else OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw)); @@ -5966,11 +5965,11 @@ if (common->utf && *cc == OP_REFI) jump = CMP(SLJIT_C_EQUAL, TMP1, 0, TMP2, 0); /* Needed to save important temporary registers. */ - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0); - OP1(SLJIT_MOV, SLJIT_SCRATCH_REG2, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SCRATCH_REG2), SLJIT_OFFSETOF(jit_arguments, uchar_ptr), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, uchar_ptr), STR_PTR, 0); sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_utf_caselesscmp)); - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); if (common->mode == JIT_COMPILE) add_jump(compiler, backtracks, CMP(SLJIT_C_LESS_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 1)); else @@ -5987,7 +5986,7 @@ else #endif /* SUPPORT_UTF && SUPPORT_UCP */ { if (ref) - OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0); + OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0); else OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0); @@ -6090,7 +6089,7 @@ if (!minimize) { allocate_stack(common, 2); if (ref) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0); /* Temporary release of STR_PTR. */ @@ -6098,12 +6097,12 @@ if (!minimize) /* Handles both invalid and empty cases. Since the minimum repeat, is zero the invalid case is basically the same as an empty case. */ if (ref) - zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); else { compile_dnref_search(common, ccbegin, NULL); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, TMP2, 0); zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw)); } /* Restore if not zero length. */ @@ -6113,35 +6112,35 @@ if (!minimize) { allocate_stack(common, 1); if (ref) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0); if (ref) { - add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1))); - zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1))); + zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); } else { compile_dnref_search(common, ccbegin, &backtrack->topbacktracks); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, TMP2, 0); zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw)); } } if (min > 1 || max > 1) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, SLJIT_IMM, 0); label = LABEL(); if (!ref) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1); compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE); if (min > 1 || max > 1) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0); if (min > 1) CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min, label); if (max > 1) @@ -6171,7 +6170,7 @@ if (!minimize) allocate_stack(common, ref ? 2 : 3); if (ref) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0); if (type != OP_CRMINSTAR) OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0); @@ -6181,7 +6180,7 @@ if (min == 0) /* Handles both invalid and empty cases. Since the minimum repeat, is zero the invalid case is basically the same as an empty case. */ if (ref) - zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); else { compile_dnref_search(common, ccbegin, NULL); @@ -6197,8 +6196,8 @@ else { if (ref) { - add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1))); - zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1))); + zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); } else { @@ -6283,15 +6282,15 @@ if (entry == NULL) if (common->has_set_som && common->mark_ptr != 0) { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); allocate_stack(common, 2); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0); } else if (common->has_set_som || common->mark_ptr != 0) { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr); allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); } @@ -6365,14 +6364,14 @@ PUSH_BACKTRACK(sizeof(backtrack_common), cc, NULL); allocate_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw)); -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr); +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); SLJIT_ASSERT(common->capture_last_ptr != 0); OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(callout_number), SLJIT_IMM, cc[1]); OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(capture_last), TMP2, 0); /* These pointer sized fields temporarly stores internal variables. */ -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(offset_vector), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(subject), TMP2, 0); @@ -6383,12 +6382,12 @@ OP1(SLJIT_MOV_SI, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(next_item_length), S OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_ptr != 0) ? TMP2 : SLJIT_IMM, 0); /* Needed to save important temporary registers. */ -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0); -OP2(SLJIT_SUB, SLJIT_SCRATCH_REG2, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE); -GET_LOCAL_BASE(SLJIT_SCRATCH_REG3, 0, OVECTOR_START); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0); +OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE); +GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START); sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout)); OP1(SLJIT_MOV_SI, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0); -OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); +OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw)); /* Check return value. */ @@ -6462,14 +6461,14 @@ if (framesize < 0) { extrasize = needs_control_head ? 2 : 1; if (framesize == no_frame) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0); allocate_stack(common, extrasize); if (needs_control_head) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); if (needs_control_head) { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0); } } @@ -6477,17 +6476,17 @@ else { extrasize = needs_control_head ? 3 : 2; allocate_stack(common, framesize + extrasize); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0); if (needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); if (needs_control_head) { OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP1, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); } else OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0); @@ -6542,26 +6541,26 @@ while (1) if (framesize < 0) { if (framesize == no_frame) - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); else free_stack(common, extrasize); if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0); } else { if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional) { /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */ - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw)); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw)); if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0); } else { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw)); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); } } @@ -6579,7 +6578,7 @@ while (1) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw)); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + extrasize - 1) * sizeof(sljit_sw)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0); } OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0); @@ -6587,7 +6586,7 @@ while (1) else if (framesize >= 0) { /* For OP_BRA and OP_BRAMINZERO. */ - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw)); } } add_jump(compiler, found, JUMP(SLJIT_JUMP)); @@ -6631,10 +6630,10 @@ if (common->positive_assert_quit != NULL) set_jumps(common->positive_assert_quit, LABEL()); SLJIT_ASSERT(framesize != no_stack); if (framesize < 0) - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw)); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw)); else { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw)); } @@ -6642,7 +6641,7 @@ if (common->positive_assert_quit != NULL) } if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(1)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(1)); if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) { @@ -6673,7 +6672,7 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) } else free_stack(common, framesize + extrasize); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0); } jump = JUMP(SLJIT_JUMP); if (bra != OP_BRAZERO) @@ -6703,13 +6702,13 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) if (bra == OP_BRA) { /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */ - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw)); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw)); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 2) * sizeof(sljit_sw)); } else { /* We don't need to keep the STR_PTR, only the previous private_data_ptr. */ - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw)); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw)); if (extrasize == 2) { OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); @@ -6735,9 +6734,9 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK) JUMPHERE(brajump); if (framesize >= 0) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw)); } set_jumps(backtrack->common.topbacktracks, LABEL()); } @@ -6769,7 +6768,7 @@ else } else free_stack(common, framesize + extrasize); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0); } if (bra == OP_BRAZERO) @@ -6810,7 +6809,7 @@ int stacksize; if (framesize < 0) { if (framesize == no_frame) - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); else { stacksize = needs_control_head ? 1 : 0; @@ -6828,13 +6827,13 @@ if (framesize < 0) else if (ket == OP_KETRMIN) { /* Move the STR_PTR to the private_data_ptr. */ - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0); } } else { stacksize = (ket != OP_KET || has_alternatives) ? 2 : 1; - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw)); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw)); if (needs_control_head) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 0); @@ -6845,7 +6844,7 @@ else } } if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0); } static SLJIT_INLINE int match_capture_common(compiler_common *common, int stacksize, int offset, int private_data_ptr) @@ -6854,20 +6853,20 @@ DEFINE_COMPILER; if (common->capture_last_ptr != 0) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, offset >> 1); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), TMP1, 0); stacksize++; } if (common->optimized_cbracket[offset >> 1] == 0) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), TMP1, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize + 1), TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); stacksize += 2; } return stacksize; @@ -7066,12 +7065,12 @@ if (bra == OP_BRAMINZERO) if (opcode != OP_ONCE || BACKTRACK_AS(bracket_backtrack)->u.framesize < 0) { /* When we come from outside, private_data_ptr contains the previous STR_PTR. */ - braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); } else { /* Except when the whole stack frame must be saved. */ - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); braminzero = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw)); } JUMPHERE(skip); @@ -7087,7 +7086,7 @@ if (bra == OP_BRAMINZERO) if (repeat_type != 0) { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, repeat_count); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, repeat_count); if (repeat_type == OP_EXACT) rmax_label = LABEL(); } @@ -7108,7 +7107,7 @@ if (opcode == OP_ONCE) stacksize = 0; if (needs_control_head) { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); stacksize++; } @@ -7119,12 +7118,12 @@ if (opcode == OP_ONCE) { stacksize += 2; if (!needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); } else { if (BACKTRACK_AS(bracket_backtrack)->u.framesize == no_frame) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0); if (ket == OP_KETRMAX || has_alternatives) stacksize++; } @@ -7142,10 +7141,10 @@ if (opcode == OP_ONCE) if (ket == OP_KETRMIN) { if (needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), STR_PTR, 0); if (BACKTRACK_AS(bracket_backtrack)->u.framesize == no_frame) - OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw)); + OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize + 1), TMP2, 0); } else if (ket == OP_KETRMAX || has_alternatives) @@ -7162,20 +7161,20 @@ if (opcode == OP_ONCE) if (needs_control_head) OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw)); stacksize = needs_control_head ? 1 : 0; if (ket != OP_KET || has_alternatives) { OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0); stacksize++; OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), TMP1, 0); } else { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), TMP1, 0); } init_frame(common, ccbegin, NULL, BACKTRACK_AS(bracket_backtrack)->u.framesize + stacksize, stacksize + 1, FALSE); @@ -7188,26 +7187,26 @@ else if (opcode == OP_CBRA || opcode == OP_SCBRA) { SLJIT_ASSERT(private_data_ptr == OVECTOR(offset)); allocate_stack(common, 2); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr + sizeof(sljit_sw)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr + sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0); } else { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); allocate_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); } } else if (opcode == OP_SBRA || opcode == OP_SCOND) { /* Saving the previous value. */ - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); allocate_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); } else if (has_alternatives) @@ -7224,7 +7223,7 @@ if (opcode == OP_COND || opcode == OP_SCOND) { SLJIT_ASSERT(has_alternatives); add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), - CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(matchingpath, 1) << 1), SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1))); + CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(matchingpath, 1) << 1), SLJIT_MEM1(SLJIT_SP), OVECTOR(1))); matchingpath += 1 + IMM2_SIZE; } else if (*matchingpath == OP_DNCREF) @@ -7234,13 +7233,13 @@ if (opcode == OP_COND || opcode == OP_SCOND) i = GET2(matchingpath, 1 + IMM2_SIZE); slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size; OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)); - OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(slot, 0) << 1), TMP1, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)); + OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0); slot += common->name_entry_size; i--; while (i-- > 0) { - OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(slot, 0) << 1), TMP1, 0); + OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0); OP2(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, STR_PTR, 0); slot += common->name_entry_size; } @@ -7328,7 +7327,7 @@ stacksize = 0; if (repeat_type == OP_MINUPTO) { /* We need to preserve the counter. TMP2 will be used below. */ - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), repeat_ptr); stacksize++; } if (ket != OP_KET || bra != OP_BRA) @@ -7378,7 +7377,7 @@ if (has_alternatives) if (offset != 0 && common->optimized_cbracket[offset >> 1] != 0) { SLJIT_ASSERT(private_data_ptr == OVECTOR(offset + 0)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); } if (ket == OP_KETRMAX) @@ -7387,7 +7386,7 @@ if (ket == OP_KETRMAX) { if (has_alternatives) BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL(); - OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1); + OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, rmax_label); /* Drop STR_PTR for greedy plus quantifier. */ if (opcode != OP_ONCE) @@ -7400,7 +7399,7 @@ if (ket == OP_KETRMAX) /* Checking zero-length iteration. */ if (opcode != OP_ONCE) { - CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STR_PTR, 0, rmax_label); + CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STR_PTR, 0, rmax_label); /* Drop STR_PTR for greedy plus quantifier. */ if (bra != OP_BRAZERO) free_stack(common, 1); @@ -7416,13 +7415,14 @@ if (ket == OP_KETRMAX) if (repeat_type == OP_EXACT) { - OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1); + count_match(common); + OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, rmax_label); } else if (repeat_type == OP_UPTO) { /* We need to preserve the counter. */ - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), repeat_ptr); allocate_stack(common, 1); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); } @@ -7442,7 +7442,7 @@ if (bra == OP_BRAMINZERO) framesize is < 0, OP_ONCE will do the release itself. */ if (opcode == OP_ONCE && BACKTRACK_AS(bracket_backtrack)->u.framesize >= 0) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); } else if (ket == OP_KETRMIN && opcode != OP_ONCE) @@ -7537,20 +7537,20 @@ if (framesize < 0) BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize; allocate_stack(common, stacksize); if (framesize == no_frame) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0); stack = 0; if (offset != 0) { stack = 2; - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0); if (common->capture_last_ptr != 0) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), TMP2, 0); if (needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); if (common->capture_last_ptr != 0) { OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP1, 0); @@ -7560,7 +7560,7 @@ if (framesize < 0) else { if (needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0); stack = 1; } @@ -7587,10 +7587,10 @@ else BACKTRACK_AS(bracketpos_backtrack)->stacksize = stacksize; allocate_stack(common, stacksize); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (needs_control_head) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); - OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); + OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1)); stack = 0; if (!zero) @@ -7614,7 +7614,7 @@ else } if (offset != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0); loop = LABEL(); while (*cc != OP_KETRPOS) @@ -7630,16 +7630,16 @@ while (*cc != OP_KETRPOS) if (framesize < 0) { if (framesize == no_frame) - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (offset != 0) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0); if (common->capture_last_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, offset >> 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); } else { @@ -7658,17 +7658,17 @@ while (*cc != OP_KETRPOS) { if (offset != 0) { - OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw)); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr, STR_PTR, 0); + OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0); if (common->capture_last_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, offset >> 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, offset >> 1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); } else { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw)); if (opcode == OP_SBRAPOS) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw)); @@ -7688,7 +7688,7 @@ while (*cc != OP_KETRPOS) } if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(stack)); JUMPTO(SLJIT_JUMP, loop); flush_stubs(common); @@ -7701,7 +7701,7 @@ while (*cc != OP_KETRPOS) if (framesize < 0) { if (offset != 0) - OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr); + OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr); else OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); } @@ -7711,12 +7711,12 @@ while (*cc != OP_KETRPOS) { /* Last alternative. */ if (*cc == OP_KETRPOS) - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); - OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), cbraprivptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); + OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr); } else { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw)); } } @@ -7853,7 +7853,7 @@ jump_list *nomatch = NULL; struct sljit_jump *jump = NULL; struct sljit_label *label; int private_data_ptr = PRIVATE_DATA(cc); -int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG); +int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_SP); int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr; int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_sw); int tmp_base, tmp_offset; @@ -7896,7 +7896,7 @@ switch(type) case OP_XCLASS: case OP_NOTPROP: case OP_PROP: - tmp_base = SLJIT_MEM1(SLJIT_LOCALS_REG); + tmp_base = SLJIT_MEM1(SLJIT_SP); tmp_offset = POSSESSIVE0; break; } @@ -7923,19 +7923,19 @@ switch(opcode) } if (opcode == OP_UPTO || opcode == OP_CRRANGE) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, SLJIT_IMM, 0); label = LABEL(); compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks); if (opcode == OP_UPTO || opcode == OP_CRRANGE) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1); if (opcode == OP_CRRANGE && min > 0) CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min, label); if (opcode == OP_UPTO || (opcode == OP_CRRANGE && max > 0)) jump = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, max); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0); } /* We cannot use TMP3 because of this allocate_stack. */ @@ -8026,7 +8026,7 @@ switch(opcode) if (opcode == OP_POSPLUS) compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks); if (opcode == OP_POSUPTO) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, max); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_IMM, max); OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); label = LABEL(); compile_char1_matchingpath(common, type, cc, &nomatch); @@ -8035,7 +8035,7 @@ switch(opcode) JUMPTO(SLJIT_JUMP, label); else { - OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, 1); + OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, label); } set_jumps(nomatch, LABEL()); @@ -8061,7 +8061,7 @@ switch(opcode) if (max != 0) { SLJIT_ASSERT(max - min > 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, max - min); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_IMM, max - min); } OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); label = LABEL(); @@ -8071,7 +8071,7 @@ switch(opcode) JUMPTO(SLJIT_JUMP, label); else { - OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, 1); + OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, SLJIT_IMM, 1); JUMPTO(SLJIT_C_NOT_ZERO, label); } set_jumps(nomatch, LABEL()); @@ -8111,9 +8111,9 @@ if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be } if (common->accept_label == NULL) - add_jump(compiler, &common->accept, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0))); + add_jump(compiler, &common->accept, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0))); else - CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), common->accept_label); + CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label); OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, notempty)); add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_NOT_EQUAL, TMP2, 0, SLJIT_IMM, 0)); @@ -8142,11 +8142,11 @@ if (common->currententry != NULL) return cc + 1 + IMM2_SIZE; if (!optimized_cbracket) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR_PRIV(offset)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR_PRIV(offset)); offset <<= 1; -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); if (!optimized_cbracket) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); return cc + 1 + IMM2_SIZE; } @@ -8173,7 +8173,7 @@ if (opcode == OP_PRUNE_ARG || opcode == OP_THEN_ARG) { OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); } @@ -8198,12 +8198,12 @@ BACKTRACK_AS(then_trap_backtrack)->framesize = get_framesize(common, cc, ccend, size = BACKTRACK_AS(then_trap_backtrack)->framesize; size = 3 + (size < 0 ? 0 : size); -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); allocate_stack(common, size); if (size > 3) - OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw)); + OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw)); else - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 1), SLJIT_IMM, BACKTRACK_AS(then_trap_backtrack)->start); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 2), SLJIT_IMM, type_then_trap); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 3), TMP2, 0); @@ -8270,9 +8270,9 @@ while (cc < ccend) case OP_SET_SOM: PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); allocate_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), STR_PTR, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0); cc++; break; @@ -8460,17 +8460,17 @@ while (cc < ccend) case OP_MARK: PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc); SLJIT_ASSERT(common->mark_ptr != 0); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); allocate_stack(common, common->has_skip_arg ? 5 : 1); OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); if (common->has_skip_arg) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, type_mark); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(3), STR_PTR, 0); @@ -8548,7 +8548,7 @@ struct sljit_label *label = NULL; struct sljit_jump *jump = NULL; jump_list *jumplist = NULL; int private_data_ptr = PRIVATE_DATA(cc); -int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LOCALS_REG); +int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_SP); int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr; int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_sw); @@ -8721,14 +8721,14 @@ if (common->has_set_som && common->mark_ptr != 0) OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); free_stack(common, 2); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0); } else if (common->has_set_som || common->mark_ptr != 0) { OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->has_set_som ? (int)(OVECTOR(0)) : common->mark_ptr, TMP2, 0); } } @@ -8780,9 +8780,9 @@ if (bra == OP_BRAZERO) if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_sw)); set_jumps(current->topbacktracks, LABEL()); } @@ -8812,6 +8812,7 @@ pcre_uchar *ccprev; pcre_uchar bra = OP_BRA; pcre_uchar ket; assert_backtrack *assert; +sljit_uw *next_update_addr = NULL; BOOL has_alternatives; BOOL needs_control_head = FALSE; struct sljit_jump *brazero = NULL; @@ -8869,9 +8870,9 @@ if (ket != OP_KET && repeat_type != 0) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); if (repeat_type == OP_UPTO) - OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, TMP1, 0, SLJIT_IMM, 1); + OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), repeat_ptr, TMP1, 0, SLJIT_IMM, 1); else - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), repeat_ptr, TMP1, 0); } if (ket == OP_KETRMAX) @@ -8900,10 +8901,10 @@ else if (ket == OP_KETRMIN) { /* Checking zero-length iteration. */ if (opcode != OP_ONCE || CURRENT_AS(bracket_backtrack)->u.framesize < 0) - CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, CURRENT_AS(bracket_backtrack)->recursive_matchingpath); + CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, CURRENT_AS(bracket_backtrack)->recursive_matchingpath); else { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw), CURRENT_AS(bracket_backtrack)->recursive_matchingpath); } /* Drop STR_PTR for non-greedy plus quantifier. */ @@ -8915,7 +8916,7 @@ else if (ket == OP_KETRMIN) } rmin_label = LABEL(); if (repeat_type != 0) - OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1); + OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1); } else if (bra == OP_BRAZERO) { @@ -8925,7 +8926,7 @@ else if (bra == OP_BRAZERO) } else if (repeat_type == OP_EXACT) { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1); exact_label = LABEL(); } @@ -8936,19 +8937,19 @@ if (offset != 0) SLJIT_ASSERT(common->optimized_cbracket[offset >> 1] == 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(2)); free_stack(common, 3); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0); } else if (common->optimized_cbracket[offset >> 1] == 0) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); free_stack(common, 2); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP2, 0); } } @@ -8956,7 +8957,7 @@ if (SLJIT_UNLIKELY(opcode == OP_ONCE)) { if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); } once = JUMP(SLJIT_JUMP); @@ -8981,8 +8982,10 @@ else if (has_alternatives) if (alt_max > 4) { /* Table jump if alt_max is greater than 4. */ - sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)common->read_only_data_ptr); - add_label_addr(common); + next_update_addr = common->read_only_data_ptr; + common->read_only_data_ptr += alt_max; + sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr); + add_label_addr(common, next_update_addr++); } else { @@ -9005,9 +9008,9 @@ if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND)) assert = CURRENT_AS(bracket_backtrack)->u.assert; if (assert->framesize >= 0 && (ccbegin[1 + LINK_SIZE] == OP_ASSERT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK)) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw)); } cond = JUMP(SLJIT_JUMP); set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL()); @@ -9040,7 +9043,7 @@ if (has_alternatives) if (opcode != OP_ONCE) { if (private_data_ptr != 0) - OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr); + OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); else OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); } @@ -9061,7 +9064,7 @@ if (has_alternatives) if (repeat_type == OP_MINUPTO) { /* We need to preserve the counter. TMP2 will be used below. */ - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), repeat_ptr); stacksize++; } if (ket != OP_KET || bra != OP_BRA) @@ -9106,7 +9109,7 @@ if (has_alternatives) { /* If ket is not OP_KETRMAX, this code path is executed after the jump to alternative_matchingpath. */ SLJIT_ASSERT(private_data_ptr == OVECTOR(offset + 0)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0); } JUMPTO(SLJIT_JUMP, CURRENT_AS(bracket_backtrack)->alternative_matchingpath); @@ -9114,7 +9117,7 @@ if (has_alternatives) if (opcode != OP_ONCE) { if (alt_max > 4) - add_label_addr(common); + add_label_addr(common, next_update_addr++); else { if (alt_count != 2 * sizeof(sljit_uw)) @@ -9146,9 +9149,9 @@ if (has_alternatives) assert = CURRENT_AS(bracket_backtrack)->u.assert; if ((ccbegin[1 + LINK_SIZE] == OP_ASSERT_NOT || ccbegin[1 + LINK_SIZE] == OP_ASSERTBACK_NOT) && assert->framesize >= 0) { - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw)); } JUMPHERE(cond); } @@ -9166,19 +9169,19 @@ if (offset != 0) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); free_stack(common, 2); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP2, 0); } else { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0); } } else if (opcode == OP_SBRA || opcode == OP_SCOND) { - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(0)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); } else if (opcode == OP_ONCE) @@ -9201,20 +9204,20 @@ else if (opcode == OP_ONCE) JUMPHERE(once); /* Restore previous private_data_ptr */ if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_sw)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_sw)); else if (ket == OP_KETRMIN) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); /* See the comment below. */ free_stack(common, 2); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), private_data_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0); } } if (repeat_type == OP_EXACT) { - OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, SLJIT_IMM, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), repeat_ptr, TMP1, 0); + OP2(SLJIT_ADD, TMP1, 0, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), repeat_ptr, TMP1, 0); CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, repeat_count, exact_label); } else if (ket == OP_KETRMAX) @@ -9268,19 +9271,19 @@ if (CURRENT_AS(bracketpos_backtrack)->framesize < 0) offset = (GET2(current->cc, 1 + LINK_SIZE)) << 1; OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset), TMP1, 0); if (common->capture_last_ptr != 0) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(2)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP2, 0); if (common->capture_last_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, TMP1, 0); } set_jumps(current->topbacktracks, LABEL()); free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize); return; } -OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->private_data_ptr); +OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr); add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL)); if (current->topbacktracks) @@ -9291,7 +9294,7 @@ if (current->topbacktracks) free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize); JUMPHERE(jump); } -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_sw)); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_sw)); } static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current) @@ -9331,7 +9334,7 @@ if (opcode == OP_THEN || opcode == OP_THEN_ARG) { SLJIT_ASSERT(common->control_head_ptr != 0); - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, type_then_trap); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, common->then_trap->start); jump = JUMP(SLJIT_JUMP); @@ -9363,11 +9366,11 @@ if (common->local_exit) if (opcode == OP_SKIP_ARG) { SLJIT_ASSERT(common->control_head_ptr != 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, STACK_TOP, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, (sljit_sw)(current->cc + 2)); sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_search_mark)); - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); OP1(SLJIT_MOV, STR_PTR, 0, TMP1, 0); add_jump(compiler, &common->reset_match, CMP(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, -1)); @@ -9408,7 +9411,7 @@ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 3); JUMPHERE(jump); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, TMP1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP1, 0); } static void compile_backtrackingpath(compiler_common *common, struct backtrack_common *current) @@ -9425,7 +9428,7 @@ while (current) case OP_SET_SOM: OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), TMP1, 0); break; case OP_STAR: @@ -9554,9 +9557,9 @@ while (current) if (common->has_skip_arg) OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, common->has_skip_arg ? 5 : 1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP1, 0); if (common->has_skip_arg) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0); break; case OP_THEN: @@ -9630,8 +9633,8 @@ allocate_stack(common, private_data_size + framesize + alternativesize); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0); copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head); if (needs_control_head) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_IMM, 0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head_ptr, STACK_TOP, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0); if (needs_frame) init_frame(common, cc, NULL, framesize + alternativesize - 1, alternativesize, TRUE); @@ -9678,7 +9681,7 @@ jump = JUMP(SLJIT_JUMP); if (common->quit != NULL) { set_jumps(common->quit, LABEL()); - OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head_ptr); + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); if (needs_frame) { OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw)); @@ -9691,7 +9694,7 @@ if (common->quit != NULL) } set_jumps(common->accept, LABEL()); -OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head_ptr); +OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); if (needs_frame) { OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw)); @@ -9709,15 +9712,15 @@ if (needs_control_head) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 2 * sizeof(sljit_sw)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head_ptr, TMP1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP1, 0); OP1(SLJIT_MOV, TMP1, 0, TMP3, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0); } else { OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw)); OP1(SLJIT_MOV, TMP1, 0, TMP3, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->recursive_head_ptr, TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP2, 0); } sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0); } @@ -9972,29 +9975,29 @@ if (!compiler) common->compiler = compiler; /* Main pcre_jit_exec entry. */ -sljit_emit_enter(compiler, 1, 5, 5, private_data_size); +sljit_emit_enter(compiler, 0, 1, 5, 5, 0, 0, private_data_size); /* Register init. */ reset_ovector(common, (re->top_bracket + 1) * 2); if (common->req_char_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr, SLJIT_SCRATCH_REG1, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->req_char_ptr, SLJIT_R0, 0); -OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_SAVED_REG1, 0); -OP1(SLJIT_MOV, TMP1, 0, SLJIT_SAVED_REG1, 0); +OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_S0, 0); +OP1(SLJIT_MOV, TMP1, 0, SLJIT_S0, 0); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, end)); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack)); OP1(SLJIT_MOV_UI, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, limit_match)); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, base)); OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(struct sljit_stack, limit)); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LIMIT_MATCH, TMP1, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH, TMP1, 0); if (mode == JIT_PARTIAL_SOFT_COMPILE) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, -1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1); if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->mark_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0); if (common->control_head_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->control_head_ptr, SLJIT_IMM, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); /* Main part of the matching */ if ((re->options & PCRE_ANCHORED) == 0) @@ -10036,16 +10039,16 @@ if (common->req_char_ptr != 0) reqbyte_notfound = search_requested_char(common, (pcre_uchar)re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0); /* Store the current STR_PTR in OVECTOR(0). */ -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0), STR_PTR, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), STR_PTR, 0); /* Copy the limit of allowed recursions. */ -OP1(SLJIT_MOV, COUNT_MATCH, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LIMIT_MATCH); +OP1(SLJIT_MOV, COUNT_MATCH, 0, SLJIT_MEM1(SLJIT_SP), LIMIT_MATCH); if (common->capture_last_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->capture_last_ptr, SLJIT_IMM, -1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr, SLJIT_IMM, -1); if (common->needs_start_ptr) { SLJIT_ASSERT(common->start_ptr != OVECTOR(0)); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_ptr, STR_PTR, 0); } else SLJIT_ASSERT(common->start_ptr == OVECTOR(0)); @@ -10053,13 +10056,13 @@ else /* Copy the beginning of the string. */ if (mode == JIT_PARTIAL_SOFT_COMPILE) { - jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, -1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start + sizeof(sljit_sw), STR_PTR, 0); + jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start + sizeof(sljit_sw), STR_PTR, 0); JUMPHERE(jump); } else if (mode == JIT_PARTIAL_HARD_COMPILE) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); compile_matchingpath(common, common->start, ccend, &rootbacktrack); if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) @@ -10074,7 +10077,7 @@ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) if (common->might_be_empty) { - empty_match = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(0)); + empty_match = CMP(SLJIT_C_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)); empty_match_found_label = LABEL(); } @@ -10119,10 +10122,10 @@ reset_match_label = LABEL(); if (mode == JIT_PARTIAL_SOFT_COMPILE) { /* Update hit_start only in the first time. */ - jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_used_ptr, SLJIT_IMM, -1); - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, TMP1, 0); + jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, TMP1, 0); JUMPHERE(jump); } @@ -10130,10 +10133,10 @@ if (mode == JIT_PARTIAL_SOFT_COMPILE) if ((re->options & PCRE_ANCHORED) == 0 && (re->options & PCRE_FIRSTLINE) != 0) { SLJIT_ASSERT(common->first_line_end != 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->first_line_end); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->first_line_end); } -OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), common->start_ptr); +OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); if ((re->options & PCRE_ANCHORED) == 0) { @@ -10157,7 +10160,7 @@ if (reqbyte_notfound != NULL) JUMPHERE(reqbyte_notfound); if (mode == JIT_PARTIAL_SOFT_COMPILE) - CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), common->hit_start, SLJIT_IMM, -1, common->partialmatchlabel); + CMPTO(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, -1, common->partialmatchlabel); OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE_ERROR_NOMATCH); JUMPTO(SLJIT_JUMP, common->quit_label); @@ -10203,8 +10206,8 @@ common->quit_label = quit_label; /* This is a (really) rare case. */ set_jumps(common->stackalloc, LABEL()); /* RETURN_ADDR is not a saved register. */ -sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, TMP2, 0); +sljit_emit_fast_enter(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0); OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack)); OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_TOP, 0); @@ -10216,8 +10219,8 @@ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack)); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top)); OP1(SLJIT_MOV, STACK_LIMIT, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit)); -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1); -sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0); +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1); +sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0); /* Allocation failed. */ JUMPHERE(jump); @@ -10309,7 +10312,7 @@ executable_size = sljit_get_generated_code_size(compiler); label_addr = common->label_addrs; while (label_addr != NULL) { - *label_addr->addr = sljit_get_label_addr(label_addr->label); + *label_addr->update_addr = sljit_get_label_addr(label_addr->label); label_addr = label_addr->next; } sljit_free_compiler(compiler); diff --git a/pcre/pcre_scanner_unittest.cc b/pcre/pcre_scanner_unittest.cc index 7de8d2e8d9a..c00312c4f63 100644 --- a/pcre/pcre_scanner_unittest.cc +++ b/pcre/pcre_scanner_unittest.cc @@ -149,6 +149,8 @@ static void TestBigComment() { // small stack size int main(int argc, char** argv) { + (void)argc; + (void)argv; TestScanner(); TestBigComment(); diff --git a/pcre/pcre_stringpiece.h.in b/pcre/pcre_stringpiece.h.in index 369c10f31b7..eb25826b453 100644 --- a/pcre/pcre_stringpiece.h.in +++ b/pcre/pcre_stringpiece.h.in @@ -174,6 +174,7 @@ template<> struct __type_traits { #endif // allow StringPiece to be logged -std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece); +PCRECPP_EXP_DECL std::ostream& operator<<(std::ostream& o, + const pcrecpp::StringPiece& piece); #endif /* _PCRE_STRINGPIECE_H */ diff --git a/pcre/pcre_stringpiece_unittest.cc b/pcre/pcre_stringpiece_unittest.cc index c58e028cefe..1c4759da3b0 100644 --- a/pcre/pcre_stringpiece_unittest.cc +++ b/pcre/pcre_stringpiece_unittest.cc @@ -142,6 +142,8 @@ static void CheckComparisonOperators() { } int main(int argc, char** argv) { + (void)argc; + (void)argv; CheckComparisonOperators(); CheckSTLComparator(); diff --git a/pcre/pcre_study.c b/pcre/pcre_study.c index ab9510e20ec..f19d9fbb902 100644 --- a/pcre/pcre_study.c +++ b/pcre/pcre_study.c @@ -863,7 +863,6 @@ do case OP_NOTUPTOI: case OP_NOT_HSPACE: case OP_NOT_VSPACE: - case OP_PROP: case OP_PRUNE: case OP_PRUNE_ARG: case OP_RECURSE: @@ -881,6 +880,31 @@ do case OP_THEN_ARG: return SSB_FAIL; + /* A "real" property test implies no starting bits, but the fake property + PT_CLIST identifies a list of characters. These lists are short, as they + are used for characters with more than one "other case", so there is no + point in recognizing them for OP_NOTPROP. */ + + case OP_PROP: + if (tcode[1] != PT_CLIST) return SSB_FAIL; + { + const pcre_uint32 *p = PRIV(ucd_caseless_sets) + tcode[2]; + while ((c = *p++) < NOTACHAR) + { +#if defined SUPPORT_UTF && defined COMPILE_PCRE8 + if (utf) + { + pcre_uchar buff[6]; + (void)PRIV(ord2utf)(c, buff); + c = buff[0]; + } +#endif + if (c > 0xff) SET_BIT(0xff); else SET_BIT(c); + } + } + try_next = FALSE; + break; + /* We can ignore word boundary tests. */ case OP_WORD_BOUNDARY: @@ -1106,24 +1130,17 @@ do try_next = FALSE; break; - /* The cbit_space table has vertical tab as whitespace; we have to - ensure it is set as not whitespace. Luckily, the code value is the same - (0x0b) in ASCII and EBCDIC, so we can just adjust the appropriate bit. */ + /* The cbit_space table has vertical tab as whitespace; we no longer + have to play fancy tricks because Perl added VT to its whitespace at + release 5.18. PCRE added it at release 8.34. */ case OP_NOT_WHITESPACE: set_nottype_bits(start_bits, cbit_space, table_limit, cd); - start_bits[1] |= 0x08; try_next = FALSE; break; - /* The cbit_space table has vertical tab as whitespace; we have to not - set it from the table. Luckily, the code value is the same (0x0b) in - ASCII and EBCDIC, so we can just adjust the appropriate bit. */ - case OP_WHITESPACE: - c = start_bits[1]; /* Save in case it was already set */ set_type_bits(start_bits, cbit_space, table_limit, cd); - start_bits[1] = (start_bits[1] & ~0x08) | c; try_next = FALSE; break; diff --git a/pcre/pcre_tables.c b/pcre/pcre_tables.c index f38ab52cbb8..4960af57c4d 100644 --- a/pcre/pcre_tables.c +++ b/pcre/pcre_tables.c @@ -213,6 +213,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Avestan0 STR_A STR_v STR_e STR_s STR_t STR_a STR_n "\0" #define STRING_Balinese0 STR_B STR_a STR_l STR_i STR_n STR_e STR_s STR_e "\0" #define STRING_Bamum0 STR_B STR_a STR_m STR_u STR_m "\0" +#define STRING_Bassa_Vah0 STR_B STR_a STR_s STR_s STR_a STR_UNDERSCORE STR_V STR_a STR_h "\0" #define STRING_Batak0 STR_B STR_a STR_t STR_a STR_k "\0" #define STRING_Bengali0 STR_B STR_e STR_n STR_g STR_a STR_l STR_i "\0" #define STRING_Bopomofo0 STR_B STR_o STR_p STR_o STR_m STR_o STR_f STR_o "\0" @@ -223,6 +224,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_C0 STR_C "\0" #define STRING_Canadian_Aboriginal0 STR_C STR_a STR_n STR_a STR_d STR_i STR_a STR_n STR_UNDERSCORE STR_A STR_b STR_o STR_r STR_i STR_g STR_i STR_n STR_a STR_l "\0" #define STRING_Carian0 STR_C STR_a STR_r STR_i STR_a STR_n "\0" +#define STRING_Caucasian_Albanian0 STR_C STR_a STR_u STR_c STR_a STR_s STR_i STR_a STR_n STR_UNDERSCORE STR_A STR_l STR_b STR_a STR_n STR_i STR_a STR_n "\0" #define STRING_Cc0 STR_C STR_c "\0" #define STRING_Cf0 STR_C STR_f "\0" #define STRING_Chakma0 STR_C STR_h STR_a STR_k STR_m STR_a "\0" @@ -238,11 +240,14 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Cyrillic0 STR_C STR_y STR_r STR_i STR_l STR_l STR_i STR_c "\0" #define STRING_Deseret0 STR_D STR_e STR_s STR_e STR_r STR_e STR_t "\0" #define STRING_Devanagari0 STR_D STR_e STR_v STR_a STR_n STR_a STR_g STR_a STR_r STR_i "\0" +#define STRING_Duployan0 STR_D STR_u STR_p STR_l STR_o STR_y STR_a STR_n "\0" #define STRING_Egyptian_Hieroglyphs0 STR_E STR_g STR_y STR_p STR_t STR_i STR_a STR_n STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0" +#define STRING_Elbasan0 STR_E STR_l STR_b STR_a STR_s STR_a STR_n "\0" #define STRING_Ethiopic0 STR_E STR_t STR_h STR_i STR_o STR_p STR_i STR_c "\0" #define STRING_Georgian0 STR_G STR_e STR_o STR_r STR_g STR_i STR_a STR_n "\0" #define STRING_Glagolitic0 STR_G STR_l STR_a STR_g STR_o STR_l STR_i STR_t STR_i STR_c "\0" #define STRING_Gothic0 STR_G STR_o STR_t STR_h STR_i STR_c "\0" +#define STRING_Grantha0 STR_G STR_r STR_a STR_n STR_t STR_h STR_a "\0" #define STRING_Greek0 STR_G STR_r STR_e STR_e STR_k "\0" #define STRING_Gujarati0 STR_G STR_u STR_j STR_a STR_r STR_a STR_t STR_i "\0" #define STRING_Gurmukhi0 STR_G STR_u STR_r STR_m STR_u STR_k STR_h STR_i "\0" @@ -262,12 +267,15 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Kayah_Li0 STR_K STR_a STR_y STR_a STR_h STR_UNDERSCORE STR_L STR_i "\0" #define STRING_Kharoshthi0 STR_K STR_h STR_a STR_r STR_o STR_s STR_h STR_t STR_h STR_i "\0" #define STRING_Khmer0 STR_K STR_h STR_m STR_e STR_r "\0" +#define STRING_Khojki0 STR_K STR_h STR_o STR_j STR_k STR_i "\0" +#define STRING_Khudawadi0 STR_K STR_h STR_u STR_d STR_a STR_w STR_a STR_d STR_i "\0" #define STRING_L0 STR_L "\0" #define STRING_L_AMPERSAND0 STR_L STR_AMPERSAND "\0" #define STRING_Lao0 STR_L STR_a STR_o "\0" #define STRING_Latin0 STR_L STR_a STR_t STR_i STR_n "\0" #define STRING_Lepcha0 STR_L STR_e STR_p STR_c STR_h STR_a "\0" #define STRING_Limbu0 STR_L STR_i STR_m STR_b STR_u "\0" +#define STRING_Linear_A0 STR_L STR_i STR_n STR_e STR_a STR_r STR_UNDERSCORE STR_A "\0" #define STRING_Linear_B0 STR_L STR_i STR_n STR_e STR_a STR_r STR_UNDERSCORE STR_B "\0" #define STRING_Lisu0 STR_L STR_i STR_s STR_u "\0" #define STRING_Ll0 STR_L STR_l "\0" @@ -278,18 +286,24 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Lycian0 STR_L STR_y STR_c STR_i STR_a STR_n "\0" #define STRING_Lydian0 STR_L STR_y STR_d STR_i STR_a STR_n "\0" #define STRING_M0 STR_M "\0" +#define STRING_Mahajani0 STR_M STR_a STR_h STR_a STR_j STR_a STR_n STR_i "\0" #define STRING_Malayalam0 STR_M STR_a STR_l STR_a STR_y STR_a STR_l STR_a STR_m "\0" #define STRING_Mandaic0 STR_M STR_a STR_n STR_d STR_a STR_i STR_c "\0" +#define STRING_Manichaean0 STR_M STR_a STR_n STR_i STR_c STR_h STR_a STR_e STR_a STR_n "\0" #define STRING_Mc0 STR_M STR_c "\0" #define STRING_Me0 STR_M STR_e "\0" #define STRING_Meetei_Mayek0 STR_M STR_e STR_e STR_t STR_e STR_i STR_UNDERSCORE STR_M STR_a STR_y STR_e STR_k "\0" +#define STRING_Mende_Kikakui0 STR_M STR_e STR_n STR_d STR_e STR_UNDERSCORE STR_K STR_i STR_k STR_a STR_k STR_u STR_i "\0" #define STRING_Meroitic_Cursive0 STR_M STR_e STR_r STR_o STR_i STR_t STR_i STR_c STR_UNDERSCORE STR_C STR_u STR_r STR_s STR_i STR_v STR_e "\0" #define STRING_Meroitic_Hieroglyphs0 STR_M STR_e STR_r STR_o STR_i STR_t STR_i STR_c STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0" #define STRING_Miao0 STR_M STR_i STR_a STR_o "\0" #define STRING_Mn0 STR_M STR_n "\0" +#define STRING_Modi0 STR_M STR_o STR_d STR_i "\0" #define STRING_Mongolian0 STR_M STR_o STR_n STR_g STR_o STR_l STR_i STR_a STR_n "\0" +#define STRING_Mro0 STR_M STR_r STR_o "\0" #define STRING_Myanmar0 STR_M STR_y STR_a STR_n STR_m STR_a STR_r "\0" #define STRING_N0 STR_N "\0" +#define STRING_Nabataean0 STR_N STR_a STR_b STR_a STR_t STR_a STR_e STR_a STR_n "\0" #define STRING_Nd0 STR_N STR_d "\0" #define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0" #define STRING_Nko0 STR_N STR_k STR_o "\0" @@ -298,12 +312,17 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0" #define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0" #define STRING_Old_Italic0 STR_O STR_l STR_d STR_UNDERSCORE STR_I STR_t STR_a STR_l STR_i STR_c "\0" +#define STRING_Old_North_Arabian0 STR_O STR_l STR_d STR_UNDERSCORE STR_N STR_o STR_r STR_t STR_h STR_UNDERSCORE STR_A STR_r STR_a STR_b STR_i STR_a STR_n "\0" +#define STRING_Old_Permic0 STR_O STR_l STR_d STR_UNDERSCORE STR_P STR_e STR_r STR_m STR_i STR_c "\0" #define STRING_Old_Persian0 STR_O STR_l STR_d STR_UNDERSCORE STR_P STR_e STR_r STR_s STR_i STR_a STR_n "\0" #define STRING_Old_South_Arabian0 STR_O STR_l STR_d STR_UNDERSCORE STR_S STR_o STR_u STR_t STR_h STR_UNDERSCORE STR_A STR_r STR_a STR_b STR_i STR_a STR_n "\0" #define STRING_Old_Turkic0 STR_O STR_l STR_d STR_UNDERSCORE STR_T STR_u STR_r STR_k STR_i STR_c "\0" #define STRING_Oriya0 STR_O STR_r STR_i STR_y STR_a "\0" #define STRING_Osmanya0 STR_O STR_s STR_m STR_a STR_n STR_y STR_a "\0" #define STRING_P0 STR_P "\0" +#define STRING_Pahawh_Hmong0 STR_P STR_a STR_h STR_a STR_w STR_h STR_UNDERSCORE STR_H STR_m STR_o STR_n STR_g "\0" +#define STRING_Palmyrene0 STR_P STR_a STR_l STR_m STR_y STR_r STR_e STR_n STR_e "\0" +#define STRING_Pau_Cin_Hau0 STR_P STR_a STR_u STR_UNDERSCORE STR_C STR_i STR_n STR_UNDERSCORE STR_H STR_a STR_u "\0" #define STRING_Pc0 STR_P STR_c "\0" #define STRING_Pd0 STR_P STR_d "\0" #define STRING_Pe0 STR_P STR_e "\0" @@ -313,6 +332,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Pi0 STR_P STR_i "\0" #define STRING_Po0 STR_P STR_o "\0" #define STRING_Ps0 STR_P STR_s "\0" +#define STRING_Psalter_Pahlavi0 STR_P STR_s STR_a STR_l STR_t STR_e STR_r STR_UNDERSCORE STR_P STR_a STR_h STR_l STR_a STR_v STR_i "\0" #define STRING_Rejang0 STR_R STR_e STR_j STR_a STR_n STR_g "\0" #define STRING_Runic0 STR_R STR_u STR_n STR_i STR_c "\0" #define STRING_S0 STR_S "\0" @@ -321,6 +341,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Sc0 STR_S STR_c "\0" #define STRING_Sharada0 STR_S STR_h STR_a STR_r STR_a STR_d STR_a "\0" #define STRING_Shavian0 STR_S STR_h STR_a STR_v STR_i STR_a STR_n "\0" +#define STRING_Siddham0 STR_S STR_i STR_d STR_d STR_h STR_a STR_m "\0" #define STRING_Sinhala0 STR_S STR_i STR_n STR_h STR_a STR_l STR_a "\0" #define STRING_Sk0 STR_S STR_k "\0" #define STRING_Sm0 STR_S STR_m "\0" @@ -341,8 +362,10 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Thai0 STR_T STR_h STR_a STR_i "\0" #define STRING_Tibetan0 STR_T STR_i STR_b STR_e STR_t STR_a STR_n "\0" #define STRING_Tifinagh0 STR_T STR_i STR_f STR_i STR_n STR_a STR_g STR_h "\0" +#define STRING_Tirhuta0 STR_T STR_i STR_r STR_h STR_u STR_t STR_a "\0" #define STRING_Ugaritic0 STR_U STR_g STR_a STR_r STR_i STR_t STR_i STR_c "\0" #define STRING_Vai0 STR_V STR_a STR_i "\0" +#define STRING_Warang_Citi0 STR_W STR_a STR_r STR_a STR_n STR_g STR_UNDERSCORE STR_C STR_i STR_t STR_i "\0" #define STRING_Xan0 STR_X STR_a STR_n "\0" #define STRING_Xps0 STR_X STR_p STR_s "\0" #define STRING_Xsp0 STR_X STR_s STR_p "\0" @@ -361,6 +384,7 @@ const char PRIV(utt_names)[] = STRING_Avestan0 STRING_Balinese0 STRING_Bamum0 + STRING_Bassa_Vah0 STRING_Batak0 STRING_Bengali0 STRING_Bopomofo0 @@ -371,6 +395,7 @@ const char PRIV(utt_names)[] = STRING_C0 STRING_Canadian_Aboriginal0 STRING_Carian0 + STRING_Caucasian_Albanian0 STRING_Cc0 STRING_Cf0 STRING_Chakma0 @@ -386,11 +411,14 @@ const char PRIV(utt_names)[] = STRING_Cyrillic0 STRING_Deseret0 STRING_Devanagari0 + STRING_Duployan0 STRING_Egyptian_Hieroglyphs0 + STRING_Elbasan0 STRING_Ethiopic0 STRING_Georgian0 STRING_Glagolitic0 STRING_Gothic0 + STRING_Grantha0 STRING_Greek0 STRING_Gujarati0 STRING_Gurmukhi0 @@ -410,12 +438,15 @@ const char PRIV(utt_names)[] = STRING_Kayah_Li0 STRING_Kharoshthi0 STRING_Khmer0 + STRING_Khojki0 + STRING_Khudawadi0 STRING_L0 STRING_L_AMPERSAND0 STRING_Lao0 STRING_Latin0 STRING_Lepcha0 STRING_Limbu0 + STRING_Linear_A0 STRING_Linear_B0 STRING_Lisu0 STRING_Ll0 @@ -426,18 +457,24 @@ const char PRIV(utt_names)[] = STRING_Lycian0 STRING_Lydian0 STRING_M0 + STRING_Mahajani0 STRING_Malayalam0 STRING_Mandaic0 + STRING_Manichaean0 STRING_Mc0 STRING_Me0 STRING_Meetei_Mayek0 + STRING_Mende_Kikakui0 STRING_Meroitic_Cursive0 STRING_Meroitic_Hieroglyphs0 STRING_Miao0 STRING_Mn0 + STRING_Modi0 STRING_Mongolian0 + STRING_Mro0 STRING_Myanmar0 STRING_N0 + STRING_Nabataean0 STRING_Nd0 STRING_New_Tai_Lue0 STRING_Nko0 @@ -446,12 +483,17 @@ const char PRIV(utt_names)[] = STRING_Ogham0 STRING_Ol_Chiki0 STRING_Old_Italic0 + STRING_Old_North_Arabian0 + STRING_Old_Permic0 STRING_Old_Persian0 STRING_Old_South_Arabian0 STRING_Old_Turkic0 STRING_Oriya0 STRING_Osmanya0 STRING_P0 + STRING_Pahawh_Hmong0 + STRING_Palmyrene0 + STRING_Pau_Cin_Hau0 STRING_Pc0 STRING_Pd0 STRING_Pe0 @@ -461,6 +503,7 @@ const char PRIV(utt_names)[] = STRING_Pi0 STRING_Po0 STRING_Ps0 + STRING_Psalter_Pahlavi0 STRING_Rejang0 STRING_Runic0 STRING_S0 @@ -469,6 +512,7 @@ const char PRIV(utt_names)[] = STRING_Sc0 STRING_Sharada0 STRING_Shavian0 + STRING_Siddham0 STRING_Sinhala0 STRING_Sk0 STRING_Sm0 @@ -489,8 +533,10 @@ const char PRIV(utt_names)[] = STRING_Thai0 STRING_Tibetan0 STRING_Tifinagh0 + STRING_Tirhuta0 STRING_Ugaritic0 STRING_Vai0 + STRING_Warang_Citi0 STRING_Xan0 STRING_Xps0 STRING_Xsp0 @@ -509,146 +555,169 @@ const ucp_type_table PRIV(utt)[] = { { 20, PT_SC, ucp_Avestan }, { 28, PT_SC, ucp_Balinese }, { 37, PT_SC, ucp_Bamum }, - { 43, PT_SC, ucp_Batak }, - { 49, PT_SC, ucp_Bengali }, - { 57, PT_SC, ucp_Bopomofo }, - { 66, PT_SC, ucp_Brahmi }, - { 73, PT_SC, ucp_Braille }, - { 81, PT_SC, ucp_Buginese }, - { 90, PT_SC, ucp_Buhid }, - { 96, PT_GC, ucp_C }, - { 98, PT_SC, ucp_Canadian_Aboriginal }, - { 118, PT_SC, ucp_Carian }, - { 125, PT_PC, ucp_Cc }, - { 128, PT_PC, ucp_Cf }, - { 131, PT_SC, ucp_Chakma }, - { 138, PT_SC, ucp_Cham }, - { 143, PT_SC, ucp_Cherokee }, - { 152, PT_PC, ucp_Cn }, - { 155, PT_PC, ucp_Co }, - { 158, PT_SC, ucp_Common }, - { 165, PT_SC, ucp_Coptic }, - { 172, PT_PC, ucp_Cs }, - { 175, PT_SC, ucp_Cuneiform }, - { 185, PT_SC, ucp_Cypriot }, - { 193, PT_SC, ucp_Cyrillic }, - { 202, PT_SC, ucp_Deseret }, - { 210, PT_SC, ucp_Devanagari }, - { 221, PT_SC, ucp_Egyptian_Hieroglyphs }, - { 242, PT_SC, ucp_Ethiopic }, - { 251, PT_SC, ucp_Georgian }, - { 260, PT_SC, ucp_Glagolitic }, - { 271, PT_SC, ucp_Gothic }, - { 278, PT_SC, ucp_Greek }, - { 284, PT_SC, ucp_Gujarati }, - { 293, PT_SC, ucp_Gurmukhi }, - { 302, PT_SC, ucp_Han }, - { 306, PT_SC, ucp_Hangul }, - { 313, PT_SC, ucp_Hanunoo }, - { 321, PT_SC, ucp_Hebrew }, - { 328, PT_SC, ucp_Hiragana }, - { 337, PT_SC, ucp_Imperial_Aramaic }, - { 354, PT_SC, ucp_Inherited }, - { 364, PT_SC, ucp_Inscriptional_Pahlavi }, - { 386, PT_SC, ucp_Inscriptional_Parthian }, - { 409, PT_SC, ucp_Javanese }, - { 418, PT_SC, ucp_Kaithi }, - { 425, PT_SC, ucp_Kannada }, - { 433, PT_SC, ucp_Katakana }, - { 442, PT_SC, ucp_Kayah_Li }, - { 451, PT_SC, ucp_Kharoshthi }, - { 462, PT_SC, ucp_Khmer }, - { 468, PT_GC, ucp_L }, - { 470, PT_LAMP, 0 }, - { 473, PT_SC, ucp_Lao }, - { 477, PT_SC, ucp_Latin }, - { 483, PT_SC, ucp_Lepcha }, - { 490, PT_SC, ucp_Limbu }, - { 496, PT_SC, ucp_Linear_B }, - { 505, PT_SC, ucp_Lisu }, - { 510, PT_PC, ucp_Ll }, - { 513, PT_PC, ucp_Lm }, - { 516, PT_PC, ucp_Lo }, - { 519, PT_PC, ucp_Lt }, - { 522, PT_PC, ucp_Lu }, - { 525, PT_SC, ucp_Lycian }, - { 532, PT_SC, ucp_Lydian }, - { 539, PT_GC, ucp_M }, - { 541, PT_SC, ucp_Malayalam }, - { 551, PT_SC, ucp_Mandaic }, - { 559, PT_PC, ucp_Mc }, - { 562, PT_PC, ucp_Me }, - { 565, PT_SC, ucp_Meetei_Mayek }, - { 578, PT_SC, ucp_Meroitic_Cursive }, - { 595, PT_SC, ucp_Meroitic_Hieroglyphs }, - { 616, PT_SC, ucp_Miao }, - { 621, PT_PC, ucp_Mn }, - { 624, PT_SC, ucp_Mongolian }, - { 634, PT_SC, ucp_Myanmar }, - { 642, PT_GC, ucp_N }, - { 644, PT_PC, ucp_Nd }, - { 647, PT_SC, ucp_New_Tai_Lue }, - { 659, PT_SC, ucp_Nko }, - { 663, PT_PC, ucp_Nl }, - { 666, PT_PC, ucp_No }, - { 669, PT_SC, ucp_Ogham }, - { 675, PT_SC, ucp_Ol_Chiki }, - { 684, PT_SC, ucp_Old_Italic }, - { 695, PT_SC, ucp_Old_Persian }, - { 707, PT_SC, ucp_Old_South_Arabian }, - { 725, PT_SC, ucp_Old_Turkic }, - { 736, PT_SC, ucp_Oriya }, - { 742, PT_SC, ucp_Osmanya }, - { 750, PT_GC, ucp_P }, - { 752, PT_PC, ucp_Pc }, - { 755, PT_PC, ucp_Pd }, - { 758, PT_PC, ucp_Pe }, - { 761, PT_PC, ucp_Pf }, - { 764, PT_SC, ucp_Phags_Pa }, - { 773, PT_SC, ucp_Phoenician }, - { 784, PT_PC, ucp_Pi }, - { 787, PT_PC, ucp_Po }, - { 790, PT_PC, ucp_Ps }, - { 793, PT_SC, ucp_Rejang }, - { 800, PT_SC, ucp_Runic }, - { 806, PT_GC, ucp_S }, - { 808, PT_SC, ucp_Samaritan }, - { 818, PT_SC, ucp_Saurashtra }, - { 829, PT_PC, ucp_Sc }, - { 832, PT_SC, ucp_Sharada }, - { 840, PT_SC, ucp_Shavian }, - { 848, PT_SC, ucp_Sinhala }, - { 856, PT_PC, ucp_Sk }, - { 859, PT_PC, ucp_Sm }, - { 862, PT_PC, ucp_So }, - { 865, PT_SC, ucp_Sora_Sompeng }, - { 878, PT_SC, ucp_Sundanese }, - { 888, PT_SC, ucp_Syloti_Nagri }, - { 901, PT_SC, ucp_Syriac }, - { 908, PT_SC, ucp_Tagalog }, - { 916, PT_SC, ucp_Tagbanwa }, - { 925, PT_SC, ucp_Tai_Le }, - { 932, PT_SC, ucp_Tai_Tham }, - { 941, PT_SC, ucp_Tai_Viet }, - { 950, PT_SC, ucp_Takri }, - { 956, PT_SC, ucp_Tamil }, - { 962, PT_SC, ucp_Telugu }, - { 969, PT_SC, ucp_Thaana }, - { 976, PT_SC, ucp_Thai }, - { 981, PT_SC, ucp_Tibetan }, - { 989, PT_SC, ucp_Tifinagh }, - { 998, PT_SC, ucp_Ugaritic }, - { 1007, PT_SC, ucp_Vai }, - { 1011, PT_ALNUM, 0 }, - { 1015, PT_PXSPACE, 0 }, - { 1019, PT_SPACE, 0 }, - { 1023, PT_UCNC, 0 }, - { 1027, PT_WORD, 0 }, - { 1031, PT_SC, ucp_Yi }, - { 1034, PT_GC, ucp_Z }, - { 1036, PT_PC, ucp_Zl }, - { 1039, PT_PC, ucp_Zp }, - { 1042, PT_PC, ucp_Zs } + { 43, PT_SC, ucp_Bassa_Vah }, + { 53, PT_SC, ucp_Batak }, + { 59, PT_SC, ucp_Bengali }, + { 67, PT_SC, ucp_Bopomofo }, + { 76, PT_SC, ucp_Brahmi }, + { 83, PT_SC, ucp_Braille }, + { 91, PT_SC, ucp_Buginese }, + { 100, PT_SC, ucp_Buhid }, + { 106, PT_GC, ucp_C }, + { 108, PT_SC, ucp_Canadian_Aboriginal }, + { 128, PT_SC, ucp_Carian }, + { 135, PT_SC, ucp_Caucasian_Albanian }, + { 154, PT_PC, ucp_Cc }, + { 157, PT_PC, ucp_Cf }, + { 160, PT_SC, ucp_Chakma }, + { 167, PT_SC, ucp_Cham }, + { 172, PT_SC, ucp_Cherokee }, + { 181, PT_PC, ucp_Cn }, + { 184, PT_PC, ucp_Co }, + { 187, PT_SC, ucp_Common }, + { 194, PT_SC, ucp_Coptic }, + { 201, PT_PC, ucp_Cs }, + { 204, PT_SC, ucp_Cuneiform }, + { 214, PT_SC, ucp_Cypriot }, + { 222, PT_SC, ucp_Cyrillic }, + { 231, PT_SC, ucp_Deseret }, + { 239, PT_SC, ucp_Devanagari }, + { 250, PT_SC, ucp_Duployan }, + { 259, PT_SC, ucp_Egyptian_Hieroglyphs }, + { 280, PT_SC, ucp_Elbasan }, + { 288, PT_SC, ucp_Ethiopic }, + { 297, PT_SC, ucp_Georgian }, + { 306, PT_SC, ucp_Glagolitic }, + { 317, PT_SC, ucp_Gothic }, + { 324, PT_SC, ucp_Grantha }, + { 332, PT_SC, ucp_Greek }, + { 338, PT_SC, ucp_Gujarati }, + { 347, PT_SC, ucp_Gurmukhi }, + { 356, PT_SC, ucp_Han }, + { 360, PT_SC, ucp_Hangul }, + { 367, PT_SC, ucp_Hanunoo }, + { 375, PT_SC, ucp_Hebrew }, + { 382, PT_SC, ucp_Hiragana }, + { 391, PT_SC, ucp_Imperial_Aramaic }, + { 408, PT_SC, ucp_Inherited }, + { 418, PT_SC, ucp_Inscriptional_Pahlavi }, + { 440, PT_SC, ucp_Inscriptional_Parthian }, + { 463, PT_SC, ucp_Javanese }, + { 472, PT_SC, ucp_Kaithi }, + { 479, PT_SC, ucp_Kannada }, + { 487, PT_SC, ucp_Katakana }, + { 496, PT_SC, ucp_Kayah_Li }, + { 505, PT_SC, ucp_Kharoshthi }, + { 516, PT_SC, ucp_Khmer }, + { 522, PT_SC, ucp_Khojki }, + { 529, PT_SC, ucp_Khudawadi }, + { 539, PT_GC, ucp_L }, + { 541, PT_LAMP, 0 }, + { 544, PT_SC, ucp_Lao }, + { 548, PT_SC, ucp_Latin }, + { 554, PT_SC, ucp_Lepcha }, + { 561, PT_SC, ucp_Limbu }, + { 567, PT_SC, ucp_Linear_A }, + { 576, PT_SC, ucp_Linear_B }, + { 585, PT_SC, ucp_Lisu }, + { 590, PT_PC, ucp_Ll }, + { 593, PT_PC, ucp_Lm }, + { 596, PT_PC, ucp_Lo }, + { 599, PT_PC, ucp_Lt }, + { 602, PT_PC, ucp_Lu }, + { 605, PT_SC, ucp_Lycian }, + { 612, PT_SC, ucp_Lydian }, + { 619, PT_GC, ucp_M }, + { 621, PT_SC, ucp_Mahajani }, + { 630, PT_SC, ucp_Malayalam }, + { 640, PT_SC, ucp_Mandaic }, + { 648, PT_SC, ucp_Manichaean }, + { 659, PT_PC, ucp_Mc }, + { 662, PT_PC, ucp_Me }, + { 665, PT_SC, ucp_Meetei_Mayek }, + { 678, PT_SC, ucp_Mende_Kikakui }, + { 692, PT_SC, ucp_Meroitic_Cursive }, + { 709, PT_SC, ucp_Meroitic_Hieroglyphs }, + { 730, PT_SC, ucp_Miao }, + { 735, PT_PC, ucp_Mn }, + { 738, PT_SC, ucp_Modi }, + { 743, PT_SC, ucp_Mongolian }, + { 753, PT_SC, ucp_Mro }, + { 757, PT_SC, ucp_Myanmar }, + { 765, PT_GC, ucp_N }, + { 767, PT_SC, ucp_Nabataean }, + { 777, PT_PC, ucp_Nd }, + { 780, PT_SC, ucp_New_Tai_Lue }, + { 792, PT_SC, ucp_Nko }, + { 796, PT_PC, ucp_Nl }, + { 799, PT_PC, ucp_No }, + { 802, PT_SC, ucp_Ogham }, + { 808, PT_SC, ucp_Ol_Chiki }, + { 817, PT_SC, ucp_Old_Italic }, + { 828, PT_SC, ucp_Old_North_Arabian }, + { 846, PT_SC, ucp_Old_Permic }, + { 857, PT_SC, ucp_Old_Persian }, + { 869, PT_SC, ucp_Old_South_Arabian }, + { 887, PT_SC, ucp_Old_Turkic }, + { 898, PT_SC, ucp_Oriya }, + { 904, PT_SC, ucp_Osmanya }, + { 912, PT_GC, ucp_P }, + { 914, PT_SC, ucp_Pahawh_Hmong }, + { 927, PT_SC, ucp_Palmyrene }, + { 937, PT_SC, ucp_Pau_Cin_Hau }, + { 949, PT_PC, ucp_Pc }, + { 952, PT_PC, ucp_Pd }, + { 955, PT_PC, ucp_Pe }, + { 958, PT_PC, ucp_Pf }, + { 961, PT_SC, ucp_Phags_Pa }, + { 970, PT_SC, ucp_Phoenician }, + { 981, PT_PC, ucp_Pi }, + { 984, PT_PC, ucp_Po }, + { 987, PT_PC, ucp_Ps }, + { 990, PT_SC, ucp_Psalter_Pahlavi }, + { 1006, PT_SC, ucp_Rejang }, + { 1013, PT_SC, ucp_Runic }, + { 1019, PT_GC, ucp_S }, + { 1021, PT_SC, ucp_Samaritan }, + { 1031, PT_SC, ucp_Saurashtra }, + { 1042, PT_PC, ucp_Sc }, + { 1045, PT_SC, ucp_Sharada }, + { 1053, PT_SC, ucp_Shavian }, + { 1061, PT_SC, ucp_Siddham }, + { 1069, PT_SC, ucp_Sinhala }, + { 1077, PT_PC, ucp_Sk }, + { 1080, PT_PC, ucp_Sm }, + { 1083, PT_PC, ucp_So }, + { 1086, PT_SC, ucp_Sora_Sompeng }, + { 1099, PT_SC, ucp_Sundanese }, + { 1109, PT_SC, ucp_Syloti_Nagri }, + { 1122, PT_SC, ucp_Syriac }, + { 1129, PT_SC, ucp_Tagalog }, + { 1137, PT_SC, ucp_Tagbanwa }, + { 1146, PT_SC, ucp_Tai_Le }, + { 1153, PT_SC, ucp_Tai_Tham }, + { 1162, PT_SC, ucp_Tai_Viet }, + { 1171, PT_SC, ucp_Takri }, + { 1177, PT_SC, ucp_Tamil }, + { 1183, PT_SC, ucp_Telugu }, + { 1190, PT_SC, ucp_Thaana }, + { 1197, PT_SC, ucp_Thai }, + { 1202, PT_SC, ucp_Tibetan }, + { 1210, PT_SC, ucp_Tifinagh }, + { 1219, PT_SC, ucp_Tirhuta }, + { 1227, PT_SC, ucp_Ugaritic }, + { 1236, PT_SC, ucp_Vai }, + { 1240, PT_SC, ucp_Warang_Citi }, + { 1252, PT_ALNUM, 0 }, + { 1256, PT_PXSPACE, 0 }, + { 1260, PT_SPACE, 0 }, + { 1264, PT_UCNC, 0 }, + { 1268, PT_WORD, 0 }, + { 1272, PT_SC, ucp_Yi }, + { 1275, PT_GC, ucp_Z }, + { 1277, PT_PC, ucp_Zl }, + { 1280, PT_PC, ucp_Zp }, + { 1283, PT_PC, ucp_Zs } }; const int PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table); diff --git a/pcre/pcre_ucd.c b/pcre/pcre_ucd.c index 46ea70c44cc..69c4fd42c34 100644 --- a/pcre/pcre_ucd.c +++ b/pcre/pcre_ucd.c @@ -20,7 +20,7 @@ needed. */ /* Unicode character database. */ /* This file was autogenerated by the MultiStage2.py script. */ -/* Total size: 65688 bytes, block size: 128. */ +/* Total size: 72576 bytes, block size: 128. */ /* The tables herein are needed only when UCP support is built into PCRE. This module should not be referenced otherwise, so @@ -79,7 +79,7 @@ const pcre_uint32 PRIV(ucd_caseless_sets)[] = { #ifndef PCRE_INCLUDED -const ucd_record PRIV(ucd_records)[] = { /* 5016 bytes, record size 8 */ +const ucd_record PRIV(ucd_records)[] = { /* 5760 bytes, record size 8 */ { 9, 0, 2, 0, 0, }, /* 0 */ { 9, 0, 1, 0, 0, }, /* 1 */ { 9, 0, 0, 0, 0, }, /* 2 */ @@ -166,547 +166,640 @@ const ucd_record PRIV(ucd_records)[] = { /* 5016 bytes, record size 8 */ { 33, 5, 12, 0, -205, }, /* 83 */ { 33, 5, 12, 0, -202, }, /* 84 */ { 33, 5, 12, 0, -203, }, /* 85 */ - { 33, 5, 12, 0, -207, }, /* 86 */ - { 33, 5, 12, 0, 42280, }, /* 87 */ - { 33, 5, 12, 0, 42308, }, /* 88 */ - { 33, 5, 12, 0, -209, }, /* 89 */ - { 33, 5, 12, 0, -211, }, /* 90 */ - { 33, 5, 12, 0, 10743, }, /* 91 */ - { 33, 5, 12, 0, 10749, }, /* 92 */ - { 33, 5, 12, 0, -213, }, /* 93 */ - { 33, 5, 12, 0, -214, }, /* 94 */ - { 33, 5, 12, 0, 10727, }, /* 95 */ - { 33, 5, 12, 0, -218, }, /* 96 */ - { 33, 5, 12, 0, -69, }, /* 97 */ - { 33, 5, 12, 0, -217, }, /* 98 */ - { 33, 5, 12, 0, -71, }, /* 99 */ - { 33, 5, 12, 0, -219, }, /* 100 */ - { 33, 6, 12, 0, 0, }, /* 101 */ - { 9, 6, 12, 0, 0, }, /* 102 */ - { 3, 24, 12, 0, 0, }, /* 103 */ - { 27, 12, 3, 0, 0, }, /* 104 */ - { 27, 12, 3, 21, 116, }, /* 105 */ - { 19, 9, 12, 0, 1, }, /* 106 */ - { 19, 5, 12, 0, -1, }, /* 107 */ - { 19, 24, 12, 0, 0, }, /* 108 */ - { 9, 2, 12, 0, 0, }, /* 109 */ - { 19, 6, 12, 0, 0, }, /* 110 */ - { 19, 5, 12, 0, 130, }, /* 111 */ - { 19, 9, 12, 0, 38, }, /* 112 */ - { 19, 9, 12, 0, 37, }, /* 113 */ - { 19, 9, 12, 0, 64, }, /* 114 */ - { 19, 9, 12, 0, 63, }, /* 115 */ - { 19, 5, 12, 0, 0, }, /* 116 */ - { 19, 9, 12, 0, 32, }, /* 117 */ - { 19, 9, 12, 34, 32, }, /* 118 */ - { 19, 9, 12, 59, 32, }, /* 119 */ - { 19, 9, 12, 38, 32, }, /* 120 */ - { 19, 9, 12, 21, 32, }, /* 121 */ - { 19, 9, 12, 51, 32, }, /* 122 */ - { 19, 9, 12, 26, 32, }, /* 123 */ - { 19, 9, 12, 47, 32, }, /* 124 */ - { 19, 9, 12, 55, 32, }, /* 125 */ - { 19, 9, 12, 30, 32, }, /* 126 */ - { 19, 9, 12, 43, 32, }, /* 127 */ - { 19, 9, 12, 67, 32, }, /* 128 */ - { 19, 5, 12, 0, -38, }, /* 129 */ - { 19, 5, 12, 0, -37, }, /* 130 */ - { 19, 5, 12, 0, -32, }, /* 131 */ - { 19, 5, 12, 34, -32, }, /* 132 */ - { 19, 5, 12, 59, -32, }, /* 133 */ - { 19, 5, 12, 38, -32, }, /* 134 */ - { 19, 5, 12, 21, -116, }, /* 135 */ - { 19, 5, 12, 51, -32, }, /* 136 */ - { 19, 5, 12, 26, -775, }, /* 137 */ - { 19, 5, 12, 47, -32, }, /* 138 */ - { 19, 5, 12, 55, -32, }, /* 139 */ - { 19, 5, 12, 30, 1, }, /* 140 */ - { 19, 5, 12, 30, -32, }, /* 141 */ - { 19, 5, 12, 43, -32, }, /* 142 */ - { 19, 5, 12, 67, -32, }, /* 143 */ - { 19, 5, 12, 0, -64, }, /* 144 */ - { 19, 5, 12, 0, -63, }, /* 145 */ - { 19, 9, 12, 0, 8, }, /* 146 */ - { 19, 5, 12, 34, -30, }, /* 147 */ - { 19, 5, 12, 38, -25, }, /* 148 */ - { 19, 9, 12, 0, 0, }, /* 149 */ - { 19, 5, 12, 43, -15, }, /* 150 */ - { 19, 5, 12, 47, -22, }, /* 151 */ - { 19, 5, 12, 0, -8, }, /* 152 */ - { 10, 9, 12, 0, 1, }, /* 153 */ - { 10, 5, 12, 0, -1, }, /* 154 */ - { 19, 5, 12, 51, -54, }, /* 155 */ - { 19, 5, 12, 55, -48, }, /* 156 */ - { 19, 5, 12, 0, 7, }, /* 157 */ - { 19, 9, 12, 38, -60, }, /* 158 */ - { 19, 5, 12, 59, -64, }, /* 159 */ - { 19, 25, 12, 0, 0, }, /* 160 */ - { 19, 9, 12, 0, -7, }, /* 161 */ - { 19, 9, 12, 0, -130, }, /* 162 */ - { 12, 9, 12, 0, 80, }, /* 163 */ - { 12, 9, 12, 0, 32, }, /* 164 */ - { 12, 5, 12, 0, -32, }, /* 165 */ - { 12, 5, 12, 0, -80, }, /* 166 */ - { 12, 9, 12, 0, 1, }, /* 167 */ - { 12, 5, 12, 0, -1, }, /* 168 */ - { 12, 26, 12, 0, 0, }, /* 169 */ - { 12, 12, 3, 0, 0, }, /* 170 */ - { 12, 11, 3, 0, 0, }, /* 171 */ - { 12, 9, 12, 0, 15, }, /* 172 */ - { 12, 5, 12, 0, -15, }, /* 173 */ - { 1, 9, 12, 0, 48, }, /* 174 */ - { 1, 6, 12, 0, 0, }, /* 175 */ - { 1, 21, 12, 0, 0, }, /* 176 */ - { 1, 5, 12, 0, -48, }, /* 177 */ - { 1, 5, 12, 0, 0, }, /* 178 */ - { 1, 17, 12, 0, 0, }, /* 179 */ - { 1, 23, 12, 0, 0, }, /* 180 */ - { 25, 12, 3, 0, 0, }, /* 181 */ - { 25, 17, 12, 0, 0, }, /* 182 */ - { 25, 21, 12, 0, 0, }, /* 183 */ - { 25, 7, 12, 0, 0, }, /* 184 */ - { 0, 1, 2, 0, 0, }, /* 185 */ - { 0, 25, 12, 0, 0, }, /* 186 */ - { 0, 21, 12, 0, 0, }, /* 187 */ - { 0, 23, 12, 0, 0, }, /* 188 */ - { 0, 26, 12, 0, 0, }, /* 189 */ - { 0, 12, 3, 0, 0, }, /* 190 */ - { 0, 7, 12, 0, 0, }, /* 191 */ - { 0, 6, 12, 0, 0, }, /* 192 */ - { 0, 13, 12, 0, 0, }, /* 193 */ - { 49, 21, 12, 0, 0, }, /* 194 */ - { 49, 1, 2, 0, 0, }, /* 195 */ - { 49, 7, 12, 0, 0, }, /* 196 */ - { 49, 12, 3, 0, 0, }, /* 197 */ - { 55, 7, 12, 0, 0, }, /* 198 */ - { 55, 12, 3, 0, 0, }, /* 199 */ - { 63, 13, 12, 0, 0, }, /* 200 */ - { 63, 7, 12, 0, 0, }, /* 201 */ - { 63, 12, 3, 0, 0, }, /* 202 */ - { 63, 6, 12, 0, 0, }, /* 203 */ - { 63, 26, 12, 0, 0, }, /* 204 */ - { 63, 21, 12, 0, 0, }, /* 205 */ - { 89, 7, 12, 0, 0, }, /* 206 */ - { 89, 12, 3, 0, 0, }, /* 207 */ - { 89, 6, 12, 0, 0, }, /* 208 */ - { 89, 21, 12, 0, 0, }, /* 209 */ - { 94, 7, 12, 0, 0, }, /* 210 */ - { 94, 12, 3, 0, 0, }, /* 211 */ - { 94, 21, 12, 0, 0, }, /* 212 */ - { 14, 12, 3, 0, 0, }, /* 213 */ - { 14, 10, 5, 0, 0, }, /* 214 */ - { 14, 7, 12, 0, 0, }, /* 215 */ - { 14, 13, 12, 0, 0, }, /* 216 */ - { 14, 21, 12, 0, 0, }, /* 217 */ - { 14, 6, 12, 0, 0, }, /* 218 */ - { 2, 12, 3, 0, 0, }, /* 219 */ - { 2, 10, 5, 0, 0, }, /* 220 */ - { 2, 7, 12, 0, 0, }, /* 221 */ - { 2, 10, 3, 0, 0, }, /* 222 */ - { 2, 13, 12, 0, 0, }, /* 223 */ - { 2, 23, 12, 0, 0, }, /* 224 */ - { 2, 15, 12, 0, 0, }, /* 225 */ - { 2, 26, 12, 0, 0, }, /* 226 */ - { 21, 12, 3, 0, 0, }, /* 227 */ - { 21, 10, 5, 0, 0, }, /* 228 */ - { 21, 7, 12, 0, 0, }, /* 229 */ - { 21, 13, 12, 0, 0, }, /* 230 */ - { 20, 12, 3, 0, 0, }, /* 231 */ - { 20, 10, 5, 0, 0, }, /* 232 */ - { 20, 7, 12, 0, 0, }, /* 233 */ - { 20, 13, 12, 0, 0, }, /* 234 */ - { 20, 21, 12, 0, 0, }, /* 235 */ - { 20, 23, 12, 0, 0, }, /* 236 */ - { 43, 12, 3, 0, 0, }, /* 237 */ - { 43, 10, 5, 0, 0, }, /* 238 */ - { 43, 7, 12, 0, 0, }, /* 239 */ - { 43, 10, 3, 0, 0, }, /* 240 */ - { 43, 13, 12, 0, 0, }, /* 241 */ - { 43, 26, 12, 0, 0, }, /* 242 */ - { 43, 15, 12, 0, 0, }, /* 243 */ - { 53, 12, 3, 0, 0, }, /* 244 */ - { 53, 7, 12, 0, 0, }, /* 245 */ - { 53, 10, 3, 0, 0, }, /* 246 */ - { 53, 10, 5, 0, 0, }, /* 247 */ - { 53, 13, 12, 0, 0, }, /* 248 */ - { 53, 15, 12, 0, 0, }, /* 249 */ - { 53, 26, 12, 0, 0, }, /* 250 */ - { 53, 23, 12, 0, 0, }, /* 251 */ - { 54, 10, 5, 0, 0, }, /* 252 */ - { 54, 7, 12, 0, 0, }, /* 253 */ - { 54, 12, 3, 0, 0, }, /* 254 */ - { 54, 13, 12, 0, 0, }, /* 255 */ - { 54, 15, 12, 0, 0, }, /* 256 */ - { 54, 26, 12, 0, 0, }, /* 257 */ - { 28, 10, 5, 0, 0, }, /* 258 */ - { 28, 7, 12, 0, 0, }, /* 259 */ - { 28, 12, 3, 0, 0, }, /* 260 */ - { 28, 10, 3, 0, 0, }, /* 261 */ - { 28, 13, 12, 0, 0, }, /* 262 */ - { 36, 10, 5, 0, 0, }, /* 263 */ - { 36, 7, 12, 0, 0, }, /* 264 */ - { 36, 10, 3, 0, 0, }, /* 265 */ - { 36, 12, 3, 0, 0, }, /* 266 */ - { 36, 13, 12, 0, 0, }, /* 267 */ - { 36, 15, 12, 0, 0, }, /* 268 */ - { 36, 26, 12, 0, 0, }, /* 269 */ - { 47, 10, 5, 0, 0, }, /* 270 */ - { 47, 7, 12, 0, 0, }, /* 271 */ - { 47, 12, 3, 0, 0, }, /* 272 */ - { 47, 10, 3, 0, 0, }, /* 273 */ - { 47, 21, 12, 0, 0, }, /* 274 */ - { 56, 7, 12, 0, 0, }, /* 275 */ - { 56, 12, 3, 0, 0, }, /* 276 */ - { 56, 7, 5, 0, 0, }, /* 277 */ - { 56, 6, 12, 0, 0, }, /* 278 */ - { 56, 21, 12, 0, 0, }, /* 279 */ - { 56, 13, 12, 0, 0, }, /* 280 */ - { 32, 7, 12, 0, 0, }, /* 281 */ - { 32, 12, 3, 0, 0, }, /* 282 */ - { 32, 7, 5, 0, 0, }, /* 283 */ - { 32, 6, 12, 0, 0, }, /* 284 */ - { 32, 13, 12, 0, 0, }, /* 285 */ - { 57, 7, 12, 0, 0, }, /* 286 */ - { 57, 26, 12, 0, 0, }, /* 287 */ - { 57, 21, 12, 0, 0, }, /* 288 */ - { 57, 12, 3, 0, 0, }, /* 289 */ - { 57, 13, 12, 0, 0, }, /* 290 */ - { 57, 15, 12, 0, 0, }, /* 291 */ - { 57, 22, 12, 0, 0, }, /* 292 */ - { 57, 18, 12, 0, 0, }, /* 293 */ - { 57, 10, 5, 0, 0, }, /* 294 */ - { 38, 7, 12, 0, 0, }, /* 295 */ - { 38, 10, 12, 0, 0, }, /* 296 */ - { 38, 12, 3, 0, 0, }, /* 297 */ - { 38, 10, 5, 0, 0, }, /* 298 */ - { 38, 13, 12, 0, 0, }, /* 299 */ - { 38, 21, 12, 0, 0, }, /* 300 */ - { 38, 26, 12, 0, 0, }, /* 301 */ - { 16, 9, 12, 0, 7264, }, /* 302 */ - { 16, 7, 12, 0, 0, }, /* 303 */ - { 16, 6, 12, 0, 0, }, /* 304 */ - { 23, 7, 6, 0, 0, }, /* 305 */ - { 23, 7, 7, 0, 0, }, /* 306 */ - { 23, 7, 8, 0, 0, }, /* 307 */ - { 15, 7, 12, 0, 0, }, /* 308 */ - { 15, 12, 3, 0, 0, }, /* 309 */ - { 15, 21, 12, 0, 0, }, /* 310 */ - { 15, 15, 12, 0, 0, }, /* 311 */ - { 15, 26, 12, 0, 0, }, /* 312 */ - { 8, 7, 12, 0, 0, }, /* 313 */ - { 7, 17, 12, 0, 0, }, /* 314 */ - { 7, 7, 12, 0, 0, }, /* 315 */ - { 7, 21, 12, 0, 0, }, /* 316 */ - { 40, 29, 12, 0, 0, }, /* 317 */ - { 40, 7, 12, 0, 0, }, /* 318 */ - { 40, 22, 12, 0, 0, }, /* 319 */ - { 40, 18, 12, 0, 0, }, /* 320 */ - { 45, 7, 12, 0, 0, }, /* 321 */ - { 45, 14, 12, 0, 0, }, /* 322 */ - { 50, 7, 12, 0, 0, }, /* 323 */ - { 50, 12, 3, 0, 0, }, /* 324 */ - { 24, 7, 12, 0, 0, }, /* 325 */ - { 24, 12, 3, 0, 0, }, /* 326 */ - { 6, 7, 12, 0, 0, }, /* 327 */ - { 6, 12, 3, 0, 0, }, /* 328 */ - { 51, 7, 12, 0, 0, }, /* 329 */ - { 51, 12, 3, 0, 0, }, /* 330 */ - { 31, 7, 12, 0, 0, }, /* 331 */ - { 31, 12, 3, 0, 0, }, /* 332 */ - { 31, 10, 5, 0, 0, }, /* 333 */ - { 31, 21, 12, 0, 0, }, /* 334 */ - { 31, 6, 12, 0, 0, }, /* 335 */ - { 31, 23, 12, 0, 0, }, /* 336 */ - { 31, 13, 12, 0, 0, }, /* 337 */ - { 31, 15, 12, 0, 0, }, /* 338 */ - { 37, 21, 12, 0, 0, }, /* 339 */ - { 37, 17, 12, 0, 0, }, /* 340 */ - { 37, 12, 3, 0, 0, }, /* 341 */ - { 37, 1, 2, 0, 0, }, /* 342 */ - { 37, 13, 12, 0, 0, }, /* 343 */ - { 37, 7, 12, 0, 0, }, /* 344 */ - { 37, 6, 12, 0, 0, }, /* 345 */ - { 34, 7, 12, 0, 0, }, /* 346 */ - { 34, 12, 3, 0, 0, }, /* 347 */ - { 34, 10, 5, 0, 0, }, /* 348 */ - { 34, 26, 12, 0, 0, }, /* 349 */ - { 34, 21, 12, 0, 0, }, /* 350 */ - { 34, 13, 12, 0, 0, }, /* 351 */ - { 52, 7, 12, 0, 0, }, /* 352 */ - { 39, 7, 12, 0, 0, }, /* 353 */ - { 39, 10, 12, 0, 0, }, /* 354 */ - { 39, 10, 5, 0, 0, }, /* 355 */ - { 39, 13, 12, 0, 0, }, /* 356 */ - { 39, 15, 12, 0, 0, }, /* 357 */ - { 39, 26, 12, 0, 0, }, /* 358 */ - { 31, 26, 12, 0, 0, }, /* 359 */ - { 5, 7, 12, 0, 0, }, /* 360 */ - { 5, 12, 3, 0, 0, }, /* 361 */ - { 5, 10, 5, 0, 0, }, /* 362 */ - { 5, 21, 12, 0, 0, }, /* 363 */ - { 90, 7, 12, 0, 0, }, /* 364 */ - { 90, 10, 5, 0, 0, }, /* 365 */ - { 90, 12, 3, 0, 0, }, /* 366 */ - { 90, 10, 12, 0, 0, }, /* 367 */ - { 90, 13, 12, 0, 0, }, /* 368 */ - { 90, 21, 12, 0, 0, }, /* 369 */ - { 90, 6, 12, 0, 0, }, /* 370 */ - { 61, 12, 3, 0, 0, }, /* 371 */ - { 61, 10, 5, 0, 0, }, /* 372 */ - { 61, 7, 12, 0, 0, }, /* 373 */ - { 61, 13, 12, 0, 0, }, /* 374 */ - { 61, 21, 12, 0, 0, }, /* 375 */ - { 61, 26, 12, 0, 0, }, /* 376 */ - { 75, 12, 3, 0, 0, }, /* 377 */ - { 75, 10, 5, 0, 0, }, /* 378 */ - { 75, 7, 12, 0, 0, }, /* 379 */ - { 75, 13, 12, 0, 0, }, /* 380 */ - { 92, 7, 12, 0, 0, }, /* 381 */ - { 92, 12, 3, 0, 0, }, /* 382 */ - { 92, 10, 5, 0, 0, }, /* 383 */ - { 92, 21, 12, 0, 0, }, /* 384 */ - { 69, 7, 12, 0, 0, }, /* 385 */ - { 69, 10, 5, 0, 0, }, /* 386 */ - { 69, 12, 3, 0, 0, }, /* 387 */ - { 69, 21, 12, 0, 0, }, /* 388 */ - { 69, 13, 12, 0, 0, }, /* 389 */ - { 72, 13, 12, 0, 0, }, /* 390 */ - { 72, 7, 12, 0, 0, }, /* 391 */ - { 72, 6, 12, 0, 0, }, /* 392 */ - { 72, 21, 12, 0, 0, }, /* 393 */ - { 75, 21, 12, 0, 0, }, /* 394 */ - { 9, 10, 5, 0, 0, }, /* 395 */ - { 9, 7, 12, 0, 0, }, /* 396 */ - { 12, 5, 12, 0, 0, }, /* 397 */ - { 12, 6, 12, 0, 0, }, /* 398 */ - { 33, 5, 12, 0, 35332, }, /* 399 */ - { 33, 5, 12, 0, 3814, }, /* 400 */ - { 33, 9, 12, 63, 1, }, /* 401 */ - { 33, 5, 12, 63, -1, }, /* 402 */ - { 33, 5, 12, 63, -58, }, /* 403 */ - { 33, 9, 12, 0, -7615, }, /* 404 */ - { 19, 5, 12, 0, 8, }, /* 405 */ - { 19, 9, 12, 0, -8, }, /* 406 */ - { 19, 5, 12, 0, 74, }, /* 407 */ - { 19, 5, 12, 0, 86, }, /* 408 */ - { 19, 5, 12, 0, 100, }, /* 409 */ - { 19, 5, 12, 0, 128, }, /* 410 */ - { 19, 5, 12, 0, 112, }, /* 411 */ - { 19, 5, 12, 0, 126, }, /* 412 */ - { 19, 8, 12, 0, -8, }, /* 413 */ - { 19, 5, 12, 0, 9, }, /* 414 */ - { 19, 9, 12, 0, -74, }, /* 415 */ - { 19, 8, 12, 0, -9, }, /* 416 */ - { 19, 5, 12, 21, -7173, }, /* 417 */ - { 19, 9, 12, 0, -86, }, /* 418 */ - { 19, 9, 12, 0, -100, }, /* 419 */ - { 19, 9, 12, 0, -112, }, /* 420 */ - { 19, 9, 12, 0, -128, }, /* 421 */ - { 19, 9, 12, 0, -126, }, /* 422 */ - { 27, 1, 3, 0, 0, }, /* 423 */ - { 9, 27, 2, 0, 0, }, /* 424 */ - { 9, 28, 2, 0, 0, }, /* 425 */ - { 9, 2, 2, 0, 0, }, /* 426 */ - { 27, 11, 3, 0, 0, }, /* 427 */ - { 9, 9, 12, 0, 0, }, /* 428 */ - { 9, 5, 12, 0, 0, }, /* 429 */ - { 19, 9, 12, 67, -7517, }, /* 430 */ - { 33, 9, 12, 71, -8383, }, /* 431 */ - { 33, 9, 12, 75, -8262, }, /* 432 */ - { 33, 9, 12, 0, 28, }, /* 433 */ - { 33, 5, 12, 0, -28, }, /* 434 */ - { 33, 14, 12, 0, 16, }, /* 435 */ - { 33, 14, 12, 0, -16, }, /* 436 */ - { 33, 14, 12, 0, 0, }, /* 437 */ - { 9, 26, 12, 0, 26, }, /* 438 */ - { 9, 26, 12, 0, -26, }, /* 439 */ - { 4, 26, 12, 0, 0, }, /* 440 */ - { 17, 9, 12, 0, 48, }, /* 441 */ - { 17, 5, 12, 0, -48, }, /* 442 */ - { 33, 9, 12, 0, -10743, }, /* 443 */ - { 33, 9, 12, 0, -3814, }, /* 444 */ - { 33, 9, 12, 0, -10727, }, /* 445 */ - { 33, 5, 12, 0, -10795, }, /* 446 */ - { 33, 5, 12, 0, -10792, }, /* 447 */ - { 33, 9, 12, 0, -10780, }, /* 448 */ - { 33, 9, 12, 0, -10749, }, /* 449 */ - { 33, 9, 12, 0, -10783, }, /* 450 */ - { 33, 9, 12, 0, -10782, }, /* 451 */ - { 33, 9, 12, 0, -10815, }, /* 452 */ - { 10, 5, 12, 0, 0, }, /* 453 */ - { 10, 26, 12, 0, 0, }, /* 454 */ - { 10, 12, 3, 0, 0, }, /* 455 */ - { 10, 21, 12, 0, 0, }, /* 456 */ - { 10, 15, 12, 0, 0, }, /* 457 */ - { 16, 5, 12, 0, -7264, }, /* 458 */ - { 58, 7, 12, 0, 0, }, /* 459 */ - { 58, 6, 12, 0, 0, }, /* 460 */ - { 58, 21, 12, 0, 0, }, /* 461 */ - { 58, 12, 3, 0, 0, }, /* 462 */ - { 22, 26, 12, 0, 0, }, /* 463 */ - { 22, 6, 12, 0, 0, }, /* 464 */ - { 22, 14, 12, 0, 0, }, /* 465 */ - { 23, 10, 3, 0, 0, }, /* 466 */ - { 26, 7, 12, 0, 0, }, /* 467 */ - { 26, 6, 12, 0, 0, }, /* 468 */ - { 29, 7, 12, 0, 0, }, /* 469 */ - { 29, 6, 12, 0, 0, }, /* 470 */ - { 3, 7, 12, 0, 0, }, /* 471 */ - { 23, 7, 12, 0, 0, }, /* 472 */ - { 23, 26, 12, 0, 0, }, /* 473 */ - { 29, 26, 12, 0, 0, }, /* 474 */ - { 22, 7, 12, 0, 0, }, /* 475 */ - { 60, 7, 12, 0, 0, }, /* 476 */ - { 60, 6, 12, 0, 0, }, /* 477 */ - { 60, 26, 12, 0, 0, }, /* 478 */ - { 85, 7, 12, 0, 0, }, /* 479 */ - { 85, 6, 12, 0, 0, }, /* 480 */ - { 85, 21, 12, 0, 0, }, /* 481 */ - { 76, 7, 12, 0, 0, }, /* 482 */ - { 76, 6, 12, 0, 0, }, /* 483 */ - { 76, 21, 12, 0, 0, }, /* 484 */ - { 76, 13, 12, 0, 0, }, /* 485 */ - { 12, 7, 12, 0, 0, }, /* 486 */ - { 12, 21, 12, 0, 0, }, /* 487 */ - { 78, 7, 12, 0, 0, }, /* 488 */ - { 78, 14, 12, 0, 0, }, /* 489 */ - { 78, 12, 3, 0, 0, }, /* 490 */ - { 78, 21, 12, 0, 0, }, /* 491 */ - { 33, 9, 12, 0, -35332, }, /* 492 */ - { 33, 9, 12, 0, -42280, }, /* 493 */ - { 33, 9, 12, 0, -42308, }, /* 494 */ - { 48, 7, 12, 0, 0, }, /* 495 */ - { 48, 12, 3, 0, 0, }, /* 496 */ - { 48, 10, 5, 0, 0, }, /* 497 */ - { 48, 26, 12, 0, 0, }, /* 498 */ - { 64, 7, 12, 0, 0, }, /* 499 */ - { 64, 21, 12, 0, 0, }, /* 500 */ - { 74, 10, 5, 0, 0, }, /* 501 */ - { 74, 7, 12, 0, 0, }, /* 502 */ - { 74, 12, 3, 0, 0, }, /* 503 */ - { 74, 21, 12, 0, 0, }, /* 504 */ - { 74, 13, 12, 0, 0, }, /* 505 */ - { 68, 13, 12, 0, 0, }, /* 506 */ - { 68, 7, 12, 0, 0, }, /* 507 */ - { 68, 12, 3, 0, 0, }, /* 508 */ - { 68, 21, 12, 0, 0, }, /* 509 */ - { 73, 7, 12, 0, 0, }, /* 510 */ - { 73, 12, 3, 0, 0, }, /* 511 */ - { 73, 10, 5, 0, 0, }, /* 512 */ - { 73, 21, 12, 0, 0, }, /* 513 */ - { 83, 12, 3, 0, 0, }, /* 514 */ - { 83, 10, 5, 0, 0, }, /* 515 */ - { 83, 7, 12, 0, 0, }, /* 516 */ - { 83, 21, 12, 0, 0, }, /* 517 */ - { 83, 13, 12, 0, 0, }, /* 518 */ - { 67, 7, 12, 0, 0, }, /* 519 */ - { 67, 12, 3, 0, 0, }, /* 520 */ - { 67, 10, 5, 0, 0, }, /* 521 */ - { 67, 13, 12, 0, 0, }, /* 522 */ - { 67, 21, 12, 0, 0, }, /* 523 */ - { 38, 6, 12, 0, 0, }, /* 524 */ - { 91, 7, 12, 0, 0, }, /* 525 */ - { 91, 12, 3, 0, 0, }, /* 526 */ - { 91, 6, 12, 0, 0, }, /* 527 */ - { 91, 21, 12, 0, 0, }, /* 528 */ - { 86, 7, 12, 0, 0, }, /* 529 */ - { 86, 10, 5, 0, 0, }, /* 530 */ - { 86, 12, 3, 0, 0, }, /* 531 */ - { 86, 21, 12, 0, 0, }, /* 532 */ - { 86, 6, 12, 0, 0, }, /* 533 */ - { 86, 13, 12, 0, 0, }, /* 534 */ - { 23, 7, 9, 0, 0, }, /* 535 */ - { 23, 7, 10, 0, 0, }, /* 536 */ - { 9, 4, 2, 0, 0, }, /* 537 */ - { 9, 3, 12, 0, 0, }, /* 538 */ - { 25, 25, 12, 0, 0, }, /* 539 */ - { 0, 24, 12, 0, 0, }, /* 540 */ - { 9, 6, 3, 0, 0, }, /* 541 */ - { 35, 7, 12, 0, 0, }, /* 542 */ - { 19, 14, 12, 0, 0, }, /* 543 */ - { 19, 15, 12, 0, 0, }, /* 544 */ - { 19, 26, 12, 0, 0, }, /* 545 */ - { 70, 7, 12, 0, 0, }, /* 546 */ - { 66, 7, 12, 0, 0, }, /* 547 */ - { 41, 7, 12, 0, 0, }, /* 548 */ - { 41, 15, 12, 0, 0, }, /* 549 */ - { 18, 7, 12, 0, 0, }, /* 550 */ - { 18, 14, 12, 0, 0, }, /* 551 */ - { 59, 7, 12, 0, 0, }, /* 552 */ - { 59, 21, 12, 0, 0, }, /* 553 */ - { 42, 7, 12, 0, 0, }, /* 554 */ - { 42, 21, 12, 0, 0, }, /* 555 */ - { 42, 14, 12, 0, 0, }, /* 556 */ - { 13, 9, 12, 0, 40, }, /* 557 */ - { 13, 5, 12, 0, -40, }, /* 558 */ - { 46, 7, 12, 0, 0, }, /* 559 */ - { 44, 7, 12, 0, 0, }, /* 560 */ - { 44, 13, 12, 0, 0, }, /* 561 */ - { 11, 7, 12, 0, 0, }, /* 562 */ - { 80, 7, 12, 0, 0, }, /* 563 */ - { 80, 21, 12, 0, 0, }, /* 564 */ - { 80, 15, 12, 0, 0, }, /* 565 */ - { 65, 7, 12, 0, 0, }, /* 566 */ - { 65, 15, 12, 0, 0, }, /* 567 */ - { 65, 21, 12, 0, 0, }, /* 568 */ - { 71, 7, 12, 0, 0, }, /* 569 */ - { 71, 21, 12, 0, 0, }, /* 570 */ - { 97, 7, 12, 0, 0, }, /* 571 */ - { 96, 7, 12, 0, 0, }, /* 572 */ - { 30, 7, 12, 0, 0, }, /* 573 */ - { 30, 12, 3, 0, 0, }, /* 574 */ - { 30, 15, 12, 0, 0, }, /* 575 */ - { 30, 21, 12, 0, 0, }, /* 576 */ - { 87, 7, 12, 0, 0, }, /* 577 */ - { 87, 15, 12, 0, 0, }, /* 578 */ - { 87, 21, 12, 0, 0, }, /* 579 */ - { 77, 7, 12, 0, 0, }, /* 580 */ - { 77, 21, 12, 0, 0, }, /* 581 */ - { 82, 7, 12, 0, 0, }, /* 582 */ - { 82, 15, 12, 0, 0, }, /* 583 */ - { 81, 7, 12, 0, 0, }, /* 584 */ - { 81, 15, 12, 0, 0, }, /* 585 */ - { 88, 7, 12, 0, 0, }, /* 586 */ - { 0, 15, 12, 0, 0, }, /* 587 */ - { 93, 10, 5, 0, 0, }, /* 588 */ - { 93, 12, 3, 0, 0, }, /* 589 */ - { 93, 7, 12, 0, 0, }, /* 590 */ - { 93, 21, 12, 0, 0, }, /* 591 */ - { 93, 15, 12, 0, 0, }, /* 592 */ - { 93, 13, 12, 0, 0, }, /* 593 */ - { 84, 12, 3, 0, 0, }, /* 594 */ - { 84, 10, 5, 0, 0, }, /* 595 */ - { 84, 7, 12, 0, 0, }, /* 596 */ - { 84, 21, 12, 0, 0, }, /* 597 */ - { 84, 1, 2, 0, 0, }, /* 598 */ - { 100, 7, 12, 0, 0, }, /* 599 */ - { 100, 13, 12, 0, 0, }, /* 600 */ - { 95, 12, 3, 0, 0, }, /* 601 */ - { 95, 7, 12, 0, 0, }, /* 602 */ - { 95, 10, 5, 0, 0, }, /* 603 */ - { 95, 13, 12, 0, 0, }, /* 604 */ - { 95, 21, 12, 0, 0, }, /* 605 */ - { 99, 12, 3, 0, 0, }, /* 606 */ - { 99, 10, 5, 0, 0, }, /* 607 */ - { 99, 7, 12, 0, 0, }, /* 608 */ - { 99, 21, 12, 0, 0, }, /* 609 */ - { 99, 13, 12, 0, 0, }, /* 610 */ - { 101, 7, 12, 0, 0, }, /* 611 */ - { 101, 12, 3, 0, 0, }, /* 612 */ - { 101, 10, 5, 0, 0, }, /* 613 */ - { 101, 13, 12, 0, 0, }, /* 614 */ - { 62, 7, 12, 0, 0, }, /* 615 */ - { 62, 14, 12, 0, 0, }, /* 616 */ - { 62, 21, 12, 0, 0, }, /* 617 */ - { 79, 7, 12, 0, 0, }, /* 618 */ - { 98, 7, 12, 0, 0, }, /* 619 */ - { 98, 10, 5, 0, 0, }, /* 620 */ - { 98, 12, 3, 0, 0, }, /* 621 */ - { 98, 6, 12, 0, 0, }, /* 622 */ - { 9, 10, 3, 0, 0, }, /* 623 */ - { 19, 12, 3, 0, 0, }, /* 624 */ - { 9, 26, 11, 0, 0, }, /* 625 */ - { 26, 26, 12, 0, 0, }, /* 626 */ + { 33, 5, 12, 0, 42319, }, /* 86 */ + { 33, 5, 12, 0, 42315, }, /* 87 */ + { 33, 5, 12, 0, -207, }, /* 88 */ + { 33, 5, 12, 0, 42280, }, /* 89 */ + { 33, 5, 12, 0, 42308, }, /* 90 */ + { 33, 5, 12, 0, -209, }, /* 91 */ + { 33, 5, 12, 0, -211, }, /* 92 */ + { 33, 5, 12, 0, 10743, }, /* 93 */ + { 33, 5, 12, 0, 42305, }, /* 94 */ + { 33, 5, 12, 0, 10749, }, /* 95 */ + { 33, 5, 12, 0, -213, }, /* 96 */ + { 33, 5, 12, 0, -214, }, /* 97 */ + { 33, 5, 12, 0, 10727, }, /* 98 */ + { 33, 5, 12, 0, -218, }, /* 99 */ + { 33, 5, 12, 0, 42282, }, /* 100 */ + { 33, 5, 12, 0, -69, }, /* 101 */ + { 33, 5, 12, 0, -217, }, /* 102 */ + { 33, 5, 12, 0, -71, }, /* 103 */ + { 33, 5, 12, 0, -219, }, /* 104 */ + { 33, 5, 12, 0, 42258, }, /* 105 */ + { 33, 6, 12, 0, 0, }, /* 106 */ + { 9, 6, 12, 0, 0, }, /* 107 */ + { 3, 24, 12, 0, 0, }, /* 108 */ + { 27, 12, 3, 0, 0, }, /* 109 */ + { 27, 12, 3, 21, 116, }, /* 110 */ + { 19, 9, 12, 0, 1, }, /* 111 */ + { 19, 5, 12, 0, -1, }, /* 112 */ + { 19, 24, 12, 0, 0, }, /* 113 */ + { 9, 2, 12, 0, 0, }, /* 114 */ + { 19, 6, 12, 0, 0, }, /* 115 */ + { 19, 5, 12, 0, 130, }, /* 116 */ + { 19, 9, 12, 0, 116, }, /* 117 */ + { 19, 9, 12, 0, 38, }, /* 118 */ + { 19, 9, 12, 0, 37, }, /* 119 */ + { 19, 9, 12, 0, 64, }, /* 120 */ + { 19, 9, 12, 0, 63, }, /* 121 */ + { 19, 5, 12, 0, 0, }, /* 122 */ + { 19, 9, 12, 0, 32, }, /* 123 */ + { 19, 9, 12, 34, 32, }, /* 124 */ + { 19, 9, 12, 59, 32, }, /* 125 */ + { 19, 9, 12, 38, 32, }, /* 126 */ + { 19, 9, 12, 21, 32, }, /* 127 */ + { 19, 9, 12, 51, 32, }, /* 128 */ + { 19, 9, 12, 26, 32, }, /* 129 */ + { 19, 9, 12, 47, 32, }, /* 130 */ + { 19, 9, 12, 55, 32, }, /* 131 */ + { 19, 9, 12, 30, 32, }, /* 132 */ + { 19, 9, 12, 43, 32, }, /* 133 */ + { 19, 9, 12, 67, 32, }, /* 134 */ + { 19, 5, 12, 0, -38, }, /* 135 */ + { 19, 5, 12, 0, -37, }, /* 136 */ + { 19, 5, 12, 0, -32, }, /* 137 */ + { 19, 5, 12, 34, -32, }, /* 138 */ + { 19, 5, 12, 59, -32, }, /* 139 */ + { 19, 5, 12, 38, -32, }, /* 140 */ + { 19, 5, 12, 21, -116, }, /* 141 */ + { 19, 5, 12, 51, -32, }, /* 142 */ + { 19, 5, 12, 26, -775, }, /* 143 */ + { 19, 5, 12, 47, -32, }, /* 144 */ + { 19, 5, 12, 55, -32, }, /* 145 */ + { 19, 5, 12, 30, 1, }, /* 146 */ + { 19, 5, 12, 30, -32, }, /* 147 */ + { 19, 5, 12, 43, -32, }, /* 148 */ + { 19, 5, 12, 67, -32, }, /* 149 */ + { 19, 5, 12, 0, -64, }, /* 150 */ + { 19, 5, 12, 0, -63, }, /* 151 */ + { 19, 9, 12, 0, 8, }, /* 152 */ + { 19, 5, 12, 34, -30, }, /* 153 */ + { 19, 5, 12, 38, -25, }, /* 154 */ + { 19, 9, 12, 0, 0, }, /* 155 */ + { 19, 5, 12, 43, -15, }, /* 156 */ + { 19, 5, 12, 47, -22, }, /* 157 */ + { 19, 5, 12, 0, -8, }, /* 158 */ + { 10, 9, 12, 0, 1, }, /* 159 */ + { 10, 5, 12, 0, -1, }, /* 160 */ + { 19, 5, 12, 51, -54, }, /* 161 */ + { 19, 5, 12, 55, -48, }, /* 162 */ + { 19, 5, 12, 0, 7, }, /* 163 */ + { 19, 5, 12, 0, -116, }, /* 164 */ + { 19, 9, 12, 38, -60, }, /* 165 */ + { 19, 5, 12, 59, -64, }, /* 166 */ + { 19, 25, 12, 0, 0, }, /* 167 */ + { 19, 9, 12, 0, -7, }, /* 168 */ + { 19, 9, 12, 0, -130, }, /* 169 */ + { 12, 9, 12, 0, 80, }, /* 170 */ + { 12, 9, 12, 0, 32, }, /* 171 */ + { 12, 5, 12, 0, -32, }, /* 172 */ + { 12, 5, 12, 0, -80, }, /* 173 */ + { 12, 9, 12, 0, 1, }, /* 174 */ + { 12, 5, 12, 0, -1, }, /* 175 */ + { 12, 26, 12, 0, 0, }, /* 176 */ + { 12, 12, 3, 0, 0, }, /* 177 */ + { 12, 11, 3, 0, 0, }, /* 178 */ + { 12, 9, 12, 0, 15, }, /* 179 */ + { 12, 5, 12, 0, -15, }, /* 180 */ + { 1, 9, 12, 0, 48, }, /* 181 */ + { 1, 6, 12, 0, 0, }, /* 182 */ + { 1, 21, 12, 0, 0, }, /* 183 */ + { 1, 5, 12, 0, -48, }, /* 184 */ + { 1, 5, 12, 0, 0, }, /* 185 */ + { 1, 17, 12, 0, 0, }, /* 186 */ + { 1, 26, 12, 0, 0, }, /* 187 */ + { 1, 23, 12, 0, 0, }, /* 188 */ + { 25, 12, 3, 0, 0, }, /* 189 */ + { 25, 17, 12, 0, 0, }, /* 190 */ + { 25, 21, 12, 0, 0, }, /* 191 */ + { 25, 7, 12, 0, 0, }, /* 192 */ + { 0, 1, 2, 0, 0, }, /* 193 */ + { 0, 25, 12, 0, 0, }, /* 194 */ + { 0, 21, 12, 0, 0, }, /* 195 */ + { 0, 23, 12, 0, 0, }, /* 196 */ + { 0, 26, 12, 0, 0, }, /* 197 */ + { 0, 12, 3, 0, 0, }, /* 198 */ + { 0, 7, 12, 0, 0, }, /* 199 */ + { 0, 6, 12, 0, 0, }, /* 200 */ + { 0, 13, 12, 0, 0, }, /* 201 */ + { 49, 21, 12, 0, 0, }, /* 202 */ + { 49, 1, 2, 0, 0, }, /* 203 */ + { 49, 7, 12, 0, 0, }, /* 204 */ + { 49, 12, 3, 0, 0, }, /* 205 */ + { 55, 7, 12, 0, 0, }, /* 206 */ + { 55, 12, 3, 0, 0, }, /* 207 */ + { 63, 13, 12, 0, 0, }, /* 208 */ + { 63, 7, 12, 0, 0, }, /* 209 */ + { 63, 12, 3, 0, 0, }, /* 210 */ + { 63, 6, 12, 0, 0, }, /* 211 */ + { 63, 26, 12, 0, 0, }, /* 212 */ + { 63, 21, 12, 0, 0, }, /* 213 */ + { 89, 7, 12, 0, 0, }, /* 214 */ + { 89, 12, 3, 0, 0, }, /* 215 */ + { 89, 6, 12, 0, 0, }, /* 216 */ + { 89, 21, 12, 0, 0, }, /* 217 */ + { 94, 7, 12, 0, 0, }, /* 218 */ + { 94, 12, 3, 0, 0, }, /* 219 */ + { 94, 21, 12, 0, 0, }, /* 220 */ + { 14, 12, 3, 0, 0, }, /* 221 */ + { 14, 10, 5, 0, 0, }, /* 222 */ + { 14, 7, 12, 0, 0, }, /* 223 */ + { 14, 13, 12, 0, 0, }, /* 224 */ + { 14, 21, 12, 0, 0, }, /* 225 */ + { 14, 6, 12, 0, 0, }, /* 226 */ + { 2, 7, 12, 0, 0, }, /* 227 */ + { 2, 12, 3, 0, 0, }, /* 228 */ + { 2, 10, 5, 0, 0, }, /* 229 */ + { 2, 10, 3, 0, 0, }, /* 230 */ + { 2, 13, 12, 0, 0, }, /* 231 */ + { 2, 23, 12, 0, 0, }, /* 232 */ + { 2, 15, 12, 0, 0, }, /* 233 */ + { 2, 26, 12, 0, 0, }, /* 234 */ + { 21, 12, 3, 0, 0, }, /* 235 */ + { 21, 10, 5, 0, 0, }, /* 236 */ + { 21, 7, 12, 0, 0, }, /* 237 */ + { 21, 13, 12, 0, 0, }, /* 238 */ + { 20, 12, 3, 0, 0, }, /* 239 */ + { 20, 10, 5, 0, 0, }, /* 240 */ + { 20, 7, 12, 0, 0, }, /* 241 */ + { 20, 13, 12, 0, 0, }, /* 242 */ + { 20, 21, 12, 0, 0, }, /* 243 */ + { 20, 23, 12, 0, 0, }, /* 244 */ + { 43, 12, 3, 0, 0, }, /* 245 */ + { 43, 10, 5, 0, 0, }, /* 246 */ + { 43, 7, 12, 0, 0, }, /* 247 */ + { 43, 10, 3, 0, 0, }, /* 248 */ + { 43, 13, 12, 0, 0, }, /* 249 */ + { 43, 26, 12, 0, 0, }, /* 250 */ + { 43, 15, 12, 0, 0, }, /* 251 */ + { 53, 12, 3, 0, 0, }, /* 252 */ + { 53, 7, 12, 0, 0, }, /* 253 */ + { 53, 10, 3, 0, 0, }, /* 254 */ + { 53, 10, 5, 0, 0, }, /* 255 */ + { 53, 13, 12, 0, 0, }, /* 256 */ + { 53, 15, 12, 0, 0, }, /* 257 */ + { 53, 26, 12, 0, 0, }, /* 258 */ + { 53, 23, 12, 0, 0, }, /* 259 */ + { 54, 12, 3, 0, 0, }, /* 260 */ + { 54, 10, 5, 0, 0, }, /* 261 */ + { 54, 7, 12, 0, 0, }, /* 262 */ + { 54, 13, 12, 0, 0, }, /* 263 */ + { 54, 15, 12, 0, 0, }, /* 264 */ + { 54, 26, 12, 0, 0, }, /* 265 */ + { 28, 12, 3, 0, 0, }, /* 266 */ + { 28, 10, 5, 0, 0, }, /* 267 */ + { 28, 7, 12, 0, 0, }, /* 268 */ + { 28, 10, 3, 0, 0, }, /* 269 */ + { 28, 13, 12, 0, 0, }, /* 270 */ + { 36, 12, 3, 0, 0, }, /* 271 */ + { 36, 10, 5, 0, 0, }, /* 272 */ + { 36, 7, 12, 0, 0, }, /* 273 */ + { 36, 10, 3, 0, 0, }, /* 274 */ + { 36, 13, 12, 0, 0, }, /* 275 */ + { 36, 15, 12, 0, 0, }, /* 276 */ + { 36, 26, 12, 0, 0, }, /* 277 */ + { 47, 10, 5, 0, 0, }, /* 278 */ + { 47, 7, 12, 0, 0, }, /* 279 */ + { 47, 12, 3, 0, 0, }, /* 280 */ + { 47, 10, 3, 0, 0, }, /* 281 */ + { 47, 13, 12, 0, 0, }, /* 282 */ + { 47, 21, 12, 0, 0, }, /* 283 */ + { 56, 7, 12, 0, 0, }, /* 284 */ + { 56, 12, 3, 0, 0, }, /* 285 */ + { 56, 7, 5, 0, 0, }, /* 286 */ + { 56, 6, 12, 0, 0, }, /* 287 */ + { 56, 21, 12, 0, 0, }, /* 288 */ + { 56, 13, 12, 0, 0, }, /* 289 */ + { 32, 7, 12, 0, 0, }, /* 290 */ + { 32, 12, 3, 0, 0, }, /* 291 */ + { 32, 7, 5, 0, 0, }, /* 292 */ + { 32, 6, 12, 0, 0, }, /* 293 */ + { 32, 13, 12, 0, 0, }, /* 294 */ + { 57, 7, 12, 0, 0, }, /* 295 */ + { 57, 26, 12, 0, 0, }, /* 296 */ + { 57, 21, 12, 0, 0, }, /* 297 */ + { 57, 12, 3, 0, 0, }, /* 298 */ + { 57, 13, 12, 0, 0, }, /* 299 */ + { 57, 15, 12, 0, 0, }, /* 300 */ + { 57, 22, 12, 0, 0, }, /* 301 */ + { 57, 18, 12, 0, 0, }, /* 302 */ + { 57, 10, 5, 0, 0, }, /* 303 */ + { 38, 7, 12, 0, 0, }, /* 304 */ + { 38, 10, 12, 0, 0, }, /* 305 */ + { 38, 12, 3, 0, 0, }, /* 306 */ + { 38, 10, 5, 0, 0, }, /* 307 */ + { 38, 13, 12, 0, 0, }, /* 308 */ + { 38, 21, 12, 0, 0, }, /* 309 */ + { 38, 26, 12, 0, 0, }, /* 310 */ + { 16, 9, 12, 0, 7264, }, /* 311 */ + { 16, 7, 12, 0, 0, }, /* 312 */ + { 16, 6, 12, 0, 0, }, /* 313 */ + { 23, 7, 6, 0, 0, }, /* 314 */ + { 23, 7, 7, 0, 0, }, /* 315 */ + { 23, 7, 8, 0, 0, }, /* 316 */ + { 15, 7, 12, 0, 0, }, /* 317 */ + { 15, 12, 3, 0, 0, }, /* 318 */ + { 15, 21, 12, 0, 0, }, /* 319 */ + { 15, 15, 12, 0, 0, }, /* 320 */ + { 15, 26, 12, 0, 0, }, /* 321 */ + { 8, 7, 12, 0, 0, }, /* 322 */ + { 7, 17, 12, 0, 0, }, /* 323 */ + { 7, 7, 12, 0, 0, }, /* 324 */ + { 7, 21, 12, 0, 0, }, /* 325 */ + { 40, 29, 12, 0, 0, }, /* 326 */ + { 40, 7, 12, 0, 0, }, /* 327 */ + { 40, 22, 12, 0, 0, }, /* 328 */ + { 40, 18, 12, 0, 0, }, /* 329 */ + { 45, 7, 12, 0, 0, }, /* 330 */ + { 45, 14, 12, 0, 0, }, /* 331 */ + { 50, 7, 12, 0, 0, }, /* 332 */ + { 50, 12, 3, 0, 0, }, /* 333 */ + { 24, 7, 12, 0, 0, }, /* 334 */ + { 24, 12, 3, 0, 0, }, /* 335 */ + { 6, 7, 12, 0, 0, }, /* 336 */ + { 6, 12, 3, 0, 0, }, /* 337 */ + { 51, 7, 12, 0, 0, }, /* 338 */ + { 51, 12, 3, 0, 0, }, /* 339 */ + { 31, 7, 12, 0, 0, }, /* 340 */ + { 31, 12, 3, 0, 0, }, /* 341 */ + { 31, 10, 5, 0, 0, }, /* 342 */ + { 31, 21, 12, 0, 0, }, /* 343 */ + { 31, 6, 12, 0, 0, }, /* 344 */ + { 31, 23, 12, 0, 0, }, /* 345 */ + { 31, 13, 12, 0, 0, }, /* 346 */ + { 31, 15, 12, 0, 0, }, /* 347 */ + { 37, 21, 12, 0, 0, }, /* 348 */ + { 37, 17, 12, 0, 0, }, /* 349 */ + { 37, 12, 3, 0, 0, }, /* 350 */ + { 37, 1, 2, 0, 0, }, /* 351 */ + { 37, 13, 12, 0, 0, }, /* 352 */ + { 37, 7, 12, 0, 0, }, /* 353 */ + { 37, 6, 12, 0, 0, }, /* 354 */ + { 34, 7, 12, 0, 0, }, /* 355 */ + { 34, 12, 3, 0, 0, }, /* 356 */ + { 34, 10, 5, 0, 0, }, /* 357 */ + { 34, 26, 12, 0, 0, }, /* 358 */ + { 34, 21, 12, 0, 0, }, /* 359 */ + { 34, 13, 12, 0, 0, }, /* 360 */ + { 52, 7, 12, 0, 0, }, /* 361 */ + { 39, 7, 12, 0, 0, }, /* 362 */ + { 39, 10, 12, 0, 0, }, /* 363 */ + { 39, 10, 5, 0, 0, }, /* 364 */ + { 39, 13, 12, 0, 0, }, /* 365 */ + { 39, 15, 12, 0, 0, }, /* 366 */ + { 39, 26, 12, 0, 0, }, /* 367 */ + { 31, 26, 12, 0, 0, }, /* 368 */ + { 5, 7, 12, 0, 0, }, /* 369 */ + { 5, 12, 3, 0, 0, }, /* 370 */ + { 5, 10, 5, 0, 0, }, /* 371 */ + { 5, 21, 12, 0, 0, }, /* 372 */ + { 90, 7, 12, 0, 0, }, /* 373 */ + { 90, 10, 5, 0, 0, }, /* 374 */ + { 90, 12, 3, 0, 0, }, /* 375 */ + { 90, 10, 12, 0, 0, }, /* 376 */ + { 90, 13, 12, 0, 0, }, /* 377 */ + { 90, 21, 12, 0, 0, }, /* 378 */ + { 90, 6, 12, 0, 0, }, /* 379 */ + { 27, 11, 3, 0, 0, }, /* 380 */ + { 61, 12, 3, 0, 0, }, /* 381 */ + { 61, 10, 5, 0, 0, }, /* 382 */ + { 61, 7, 12, 0, 0, }, /* 383 */ + { 61, 13, 12, 0, 0, }, /* 384 */ + { 61, 21, 12, 0, 0, }, /* 385 */ + { 61, 26, 12, 0, 0, }, /* 386 */ + { 75, 12, 3, 0, 0, }, /* 387 */ + { 75, 10, 5, 0, 0, }, /* 388 */ + { 75, 7, 12, 0, 0, }, /* 389 */ + { 75, 13, 12, 0, 0, }, /* 390 */ + { 92, 7, 12, 0, 0, }, /* 391 */ + { 92, 12, 3, 0, 0, }, /* 392 */ + { 92, 10, 5, 0, 0, }, /* 393 */ + { 92, 21, 12, 0, 0, }, /* 394 */ + { 69, 7, 12, 0, 0, }, /* 395 */ + { 69, 10, 5, 0, 0, }, /* 396 */ + { 69, 12, 3, 0, 0, }, /* 397 */ + { 69, 21, 12, 0, 0, }, /* 398 */ + { 69, 13, 12, 0, 0, }, /* 399 */ + { 72, 13, 12, 0, 0, }, /* 400 */ + { 72, 7, 12, 0, 0, }, /* 401 */ + { 72, 6, 12, 0, 0, }, /* 402 */ + { 72, 21, 12, 0, 0, }, /* 403 */ + { 75, 21, 12, 0, 0, }, /* 404 */ + { 9, 10, 5, 0, 0, }, /* 405 */ + { 9, 7, 12, 0, 0, }, /* 406 */ + { 12, 5, 12, 0, 0, }, /* 407 */ + { 12, 6, 12, 0, 0, }, /* 408 */ + { 33, 5, 12, 0, 35332, }, /* 409 */ + { 33, 5, 12, 0, 3814, }, /* 410 */ + { 33, 9, 12, 63, 1, }, /* 411 */ + { 33, 5, 12, 63, -1, }, /* 412 */ + { 33, 5, 12, 63, -58, }, /* 413 */ + { 33, 9, 12, 0, -7615, }, /* 414 */ + { 19, 5, 12, 0, 8, }, /* 415 */ + { 19, 9, 12, 0, -8, }, /* 416 */ + { 19, 5, 12, 0, 74, }, /* 417 */ + { 19, 5, 12, 0, 86, }, /* 418 */ + { 19, 5, 12, 0, 100, }, /* 419 */ + { 19, 5, 12, 0, 128, }, /* 420 */ + { 19, 5, 12, 0, 112, }, /* 421 */ + { 19, 5, 12, 0, 126, }, /* 422 */ + { 19, 8, 12, 0, -8, }, /* 423 */ + { 19, 5, 12, 0, 9, }, /* 424 */ + { 19, 9, 12, 0, -74, }, /* 425 */ + { 19, 8, 12, 0, -9, }, /* 426 */ + { 19, 5, 12, 21, -7173, }, /* 427 */ + { 19, 9, 12, 0, -86, }, /* 428 */ + { 19, 9, 12, 0, -100, }, /* 429 */ + { 19, 9, 12, 0, -112, }, /* 430 */ + { 19, 9, 12, 0, -128, }, /* 431 */ + { 19, 9, 12, 0, -126, }, /* 432 */ + { 27, 1, 3, 0, 0, }, /* 433 */ + { 9, 27, 2, 0, 0, }, /* 434 */ + { 9, 28, 2, 0, 0, }, /* 435 */ + { 9, 2, 2, 0, 0, }, /* 436 */ + { 9, 9, 12, 0, 0, }, /* 437 */ + { 9, 5, 12, 0, 0, }, /* 438 */ + { 19, 9, 12, 67, -7517, }, /* 439 */ + { 33, 9, 12, 71, -8383, }, /* 440 */ + { 33, 9, 12, 75, -8262, }, /* 441 */ + { 33, 9, 12, 0, 28, }, /* 442 */ + { 33, 5, 12, 0, -28, }, /* 443 */ + { 33, 14, 12, 0, 16, }, /* 444 */ + { 33, 14, 12, 0, -16, }, /* 445 */ + { 33, 14, 12, 0, 0, }, /* 446 */ + { 9, 26, 12, 0, 26, }, /* 447 */ + { 9, 26, 12, 0, -26, }, /* 448 */ + { 4, 26, 12, 0, 0, }, /* 449 */ + { 17, 9, 12, 0, 48, }, /* 450 */ + { 17, 5, 12, 0, -48, }, /* 451 */ + { 33, 9, 12, 0, -10743, }, /* 452 */ + { 33, 9, 12, 0, -3814, }, /* 453 */ + { 33, 9, 12, 0, -10727, }, /* 454 */ + { 33, 5, 12, 0, -10795, }, /* 455 */ + { 33, 5, 12, 0, -10792, }, /* 456 */ + { 33, 9, 12, 0, -10780, }, /* 457 */ + { 33, 9, 12, 0, -10749, }, /* 458 */ + { 33, 9, 12, 0, -10783, }, /* 459 */ + { 33, 9, 12, 0, -10782, }, /* 460 */ + { 33, 9, 12, 0, -10815, }, /* 461 */ + { 10, 5, 12, 0, 0, }, /* 462 */ + { 10, 26, 12, 0, 0, }, /* 463 */ + { 10, 12, 3, 0, 0, }, /* 464 */ + { 10, 21, 12, 0, 0, }, /* 465 */ + { 10, 15, 12, 0, 0, }, /* 466 */ + { 16, 5, 12, 0, -7264, }, /* 467 */ + { 58, 7, 12, 0, 0, }, /* 468 */ + { 58, 6, 12, 0, 0, }, /* 469 */ + { 58, 21, 12, 0, 0, }, /* 470 */ + { 58, 12, 3, 0, 0, }, /* 471 */ + { 22, 26, 12, 0, 0, }, /* 472 */ + { 22, 6, 12, 0, 0, }, /* 473 */ + { 22, 14, 12, 0, 0, }, /* 474 */ + { 23, 10, 3, 0, 0, }, /* 475 */ + { 26, 7, 12, 0, 0, }, /* 476 */ + { 26, 6, 12, 0, 0, }, /* 477 */ + { 29, 7, 12, 0, 0, }, /* 478 */ + { 29, 6, 12, 0, 0, }, /* 479 */ + { 3, 7, 12, 0, 0, }, /* 480 */ + { 23, 7, 12, 0, 0, }, /* 481 */ + { 23, 26, 12, 0, 0, }, /* 482 */ + { 29, 26, 12, 0, 0, }, /* 483 */ + { 22, 7, 12, 0, 0, }, /* 484 */ + { 60, 7, 12, 0, 0, }, /* 485 */ + { 60, 6, 12, 0, 0, }, /* 486 */ + { 60, 26, 12, 0, 0, }, /* 487 */ + { 85, 7, 12, 0, 0, }, /* 488 */ + { 85, 6, 12, 0, 0, }, /* 489 */ + { 85, 21, 12, 0, 0, }, /* 490 */ + { 76, 7, 12, 0, 0, }, /* 491 */ + { 76, 6, 12, 0, 0, }, /* 492 */ + { 76, 21, 12, 0, 0, }, /* 493 */ + { 76, 13, 12, 0, 0, }, /* 494 */ + { 12, 7, 12, 0, 0, }, /* 495 */ + { 12, 21, 12, 0, 0, }, /* 496 */ + { 78, 7, 12, 0, 0, }, /* 497 */ + { 78, 14, 12, 0, 0, }, /* 498 */ + { 78, 12, 3, 0, 0, }, /* 499 */ + { 78, 21, 12, 0, 0, }, /* 500 */ + { 33, 9, 12, 0, -35332, }, /* 501 */ + { 33, 9, 12, 0, -42280, }, /* 502 */ + { 33, 9, 12, 0, -42308, }, /* 503 */ + { 33, 9, 12, 0, -42319, }, /* 504 */ + { 33, 9, 12, 0, -42315, }, /* 505 */ + { 33, 9, 12, 0, -42305, }, /* 506 */ + { 33, 9, 12, 0, -42258, }, /* 507 */ + { 33, 9, 12, 0, -42282, }, /* 508 */ + { 48, 7, 12, 0, 0, }, /* 509 */ + { 48, 12, 3, 0, 0, }, /* 510 */ + { 48, 10, 5, 0, 0, }, /* 511 */ + { 48, 26, 12, 0, 0, }, /* 512 */ + { 64, 7, 12, 0, 0, }, /* 513 */ + { 64, 21, 12, 0, 0, }, /* 514 */ + { 74, 10, 5, 0, 0, }, /* 515 */ + { 74, 7, 12, 0, 0, }, /* 516 */ + { 74, 12, 3, 0, 0, }, /* 517 */ + { 74, 21, 12, 0, 0, }, /* 518 */ + { 74, 13, 12, 0, 0, }, /* 519 */ + { 68, 13, 12, 0, 0, }, /* 520 */ + { 68, 7, 12, 0, 0, }, /* 521 */ + { 68, 12, 3, 0, 0, }, /* 522 */ + { 68, 21, 12, 0, 0, }, /* 523 */ + { 73, 7, 12, 0, 0, }, /* 524 */ + { 73, 12, 3, 0, 0, }, /* 525 */ + { 73, 10, 5, 0, 0, }, /* 526 */ + { 73, 21, 12, 0, 0, }, /* 527 */ + { 83, 12, 3, 0, 0, }, /* 528 */ + { 83, 10, 5, 0, 0, }, /* 529 */ + { 83, 7, 12, 0, 0, }, /* 530 */ + { 83, 21, 12, 0, 0, }, /* 531 */ + { 83, 13, 12, 0, 0, }, /* 532 */ + { 38, 6, 12, 0, 0, }, /* 533 */ + { 67, 7, 12, 0, 0, }, /* 534 */ + { 67, 12, 3, 0, 0, }, /* 535 */ + { 67, 10, 5, 0, 0, }, /* 536 */ + { 67, 13, 12, 0, 0, }, /* 537 */ + { 67, 21, 12, 0, 0, }, /* 538 */ + { 91, 7, 12, 0, 0, }, /* 539 */ + { 91, 12, 3, 0, 0, }, /* 540 */ + { 91, 6, 12, 0, 0, }, /* 541 */ + { 91, 21, 12, 0, 0, }, /* 542 */ + { 86, 7, 12, 0, 0, }, /* 543 */ + { 86, 10, 5, 0, 0, }, /* 544 */ + { 86, 12, 3, 0, 0, }, /* 545 */ + { 86, 21, 12, 0, 0, }, /* 546 */ + { 86, 6, 12, 0, 0, }, /* 547 */ + { 86, 13, 12, 0, 0, }, /* 548 */ + { 23, 7, 9, 0, 0, }, /* 549 */ + { 23, 7, 10, 0, 0, }, /* 550 */ + { 9, 4, 2, 0, 0, }, /* 551 */ + { 9, 3, 12, 0, 0, }, /* 552 */ + { 25, 25, 12, 0, 0, }, /* 553 */ + { 0, 24, 12, 0, 0, }, /* 554 */ + { 9, 6, 3, 0, 0, }, /* 555 */ + { 35, 7, 12, 0, 0, }, /* 556 */ + { 19, 14, 12, 0, 0, }, /* 557 */ + { 19, 15, 12, 0, 0, }, /* 558 */ + { 19, 26, 12, 0, 0, }, /* 559 */ + { 70, 7, 12, 0, 0, }, /* 560 */ + { 66, 7, 12, 0, 0, }, /* 561 */ + { 41, 7, 12, 0, 0, }, /* 562 */ + { 41, 15, 12, 0, 0, }, /* 563 */ + { 18, 7, 12, 0, 0, }, /* 564 */ + { 18, 14, 12, 0, 0, }, /* 565 */ + { 117, 7, 12, 0, 0, }, /* 566 */ + { 117, 12, 3, 0, 0, }, /* 567 */ + { 59, 7, 12, 0, 0, }, /* 568 */ + { 59, 21, 12, 0, 0, }, /* 569 */ + { 42, 7, 12, 0, 0, }, /* 570 */ + { 42, 21, 12, 0, 0, }, /* 571 */ + { 42, 14, 12, 0, 0, }, /* 572 */ + { 13, 9, 12, 0, 40, }, /* 573 */ + { 13, 5, 12, 0, -40, }, /* 574 */ + { 46, 7, 12, 0, 0, }, /* 575 */ + { 44, 7, 12, 0, 0, }, /* 576 */ + { 44, 13, 12, 0, 0, }, /* 577 */ + { 105, 7, 12, 0, 0, }, /* 578 */ + { 103, 7, 12, 0, 0, }, /* 579 */ + { 103, 21, 12, 0, 0, }, /* 580 */ + { 109, 7, 12, 0, 0, }, /* 581 */ + { 11, 7, 12, 0, 0, }, /* 582 */ + { 80, 7, 12, 0, 0, }, /* 583 */ + { 80, 21, 12, 0, 0, }, /* 584 */ + { 80, 15, 12, 0, 0, }, /* 585 */ + { 119, 7, 12, 0, 0, }, /* 586 */ + { 119, 26, 12, 0, 0, }, /* 587 */ + { 119, 15, 12, 0, 0, }, /* 588 */ + { 115, 7, 12, 0, 0, }, /* 589 */ + { 115, 15, 12, 0, 0, }, /* 590 */ + { 65, 7, 12, 0, 0, }, /* 591 */ + { 65, 15, 12, 0, 0, }, /* 592 */ + { 65, 21, 12, 0, 0, }, /* 593 */ + { 71, 7, 12, 0, 0, }, /* 594 */ + { 71, 21, 12, 0, 0, }, /* 595 */ + { 97, 7, 12, 0, 0, }, /* 596 */ + { 96, 7, 12, 0, 0, }, /* 597 */ + { 30, 7, 12, 0, 0, }, /* 598 */ + { 30, 12, 3, 0, 0, }, /* 599 */ + { 30, 15, 12, 0, 0, }, /* 600 */ + { 30, 21, 12, 0, 0, }, /* 601 */ + { 87, 7, 12, 0, 0, }, /* 602 */ + { 87, 15, 12, 0, 0, }, /* 603 */ + { 87, 21, 12, 0, 0, }, /* 604 */ + { 116, 7, 12, 0, 0, }, /* 605 */ + { 116, 15, 12, 0, 0, }, /* 606 */ + { 111, 7, 12, 0, 0, }, /* 607 */ + { 111, 26, 12, 0, 0, }, /* 608 */ + { 111, 12, 3, 0, 0, }, /* 609 */ + { 111, 15, 12, 0, 0, }, /* 610 */ + { 111, 21, 12, 0, 0, }, /* 611 */ + { 77, 7, 12, 0, 0, }, /* 612 */ + { 77, 21, 12, 0, 0, }, /* 613 */ + { 82, 7, 12, 0, 0, }, /* 614 */ + { 82, 15, 12, 0, 0, }, /* 615 */ + { 81, 7, 12, 0, 0, }, /* 616 */ + { 81, 15, 12, 0, 0, }, /* 617 */ + { 120, 7, 12, 0, 0, }, /* 618 */ + { 120, 21, 12, 0, 0, }, /* 619 */ + { 120, 15, 12, 0, 0, }, /* 620 */ + { 88, 7, 12, 0, 0, }, /* 621 */ + { 0, 15, 12, 0, 0, }, /* 622 */ + { 93, 10, 5, 0, 0, }, /* 623 */ + { 93, 12, 3, 0, 0, }, /* 624 */ + { 93, 7, 12, 0, 0, }, /* 625 */ + { 93, 21, 12, 0, 0, }, /* 626 */ + { 93, 15, 12, 0, 0, }, /* 627 */ + { 93, 13, 12, 0, 0, }, /* 628 */ + { 84, 12, 3, 0, 0, }, /* 629 */ + { 84, 10, 5, 0, 0, }, /* 630 */ + { 84, 7, 12, 0, 0, }, /* 631 */ + { 84, 21, 12, 0, 0, }, /* 632 */ + { 84, 1, 2, 0, 0, }, /* 633 */ + { 100, 7, 12, 0, 0, }, /* 634 */ + { 100, 13, 12, 0, 0, }, /* 635 */ + { 95, 12, 3, 0, 0, }, /* 636 */ + { 95, 7, 12, 0, 0, }, /* 637 */ + { 95, 10, 5, 0, 0, }, /* 638 */ + { 95, 13, 12, 0, 0, }, /* 639 */ + { 95, 21, 12, 0, 0, }, /* 640 */ + { 110, 7, 12, 0, 0, }, /* 641 */ + { 110, 12, 3, 0, 0, }, /* 642 */ + { 110, 21, 12, 0, 0, }, /* 643 */ + { 99, 12, 3, 0, 0, }, /* 644 */ + { 99, 10, 5, 0, 0, }, /* 645 */ + { 99, 7, 12, 0, 0, }, /* 646 */ + { 99, 21, 12, 0, 0, }, /* 647 */ + { 99, 13, 12, 0, 0, }, /* 648 */ + { 47, 15, 12, 0, 0, }, /* 649 */ + { 107, 7, 12, 0, 0, }, /* 650 */ + { 107, 10, 5, 0, 0, }, /* 651 */ + { 107, 12, 3, 0, 0, }, /* 652 */ + { 107, 21, 12, 0, 0, }, /* 653 */ + { 108, 7, 12, 0, 0, }, /* 654 */ + { 108, 12, 3, 0, 0, }, /* 655 */ + { 108, 10, 5, 0, 0, }, /* 656 */ + { 108, 13, 12, 0, 0, }, /* 657 */ + { 106, 12, 3, 0, 0, }, /* 658 */ + { 106, 10, 5, 0, 0, }, /* 659 */ + { 106, 7, 12, 0, 0, }, /* 660 */ + { 106, 10, 3, 0, 0, }, /* 661 */ + { 123, 7, 12, 0, 0, }, /* 662 */ + { 123, 10, 3, 0, 0, }, /* 663 */ + { 123, 10, 5, 0, 0, }, /* 664 */ + { 123, 12, 3, 0, 0, }, /* 665 */ + { 123, 21, 12, 0, 0, }, /* 666 */ + { 123, 13, 12, 0, 0, }, /* 667 */ + { 122, 7, 12, 0, 0, }, /* 668 */ + { 122, 10, 3, 0, 0, }, /* 669 */ + { 122, 10, 5, 0, 0, }, /* 670 */ + { 122, 12, 3, 0, 0, }, /* 671 */ + { 122, 21, 12, 0, 0, }, /* 672 */ + { 113, 7, 12, 0, 0, }, /* 673 */ + { 113, 10, 5, 0, 0, }, /* 674 */ + { 113, 12, 3, 0, 0, }, /* 675 */ + { 113, 21, 12, 0, 0, }, /* 676 */ + { 113, 13, 12, 0, 0, }, /* 677 */ + { 101, 7, 12, 0, 0, }, /* 678 */ + { 101, 12, 3, 0, 0, }, /* 679 */ + { 101, 10, 5, 0, 0, }, /* 680 */ + { 101, 13, 12, 0, 0, }, /* 681 */ + { 124, 9, 12, 0, 32, }, /* 682 */ + { 124, 5, 12, 0, -32, }, /* 683 */ + { 124, 13, 12, 0, 0, }, /* 684 */ + { 124, 15, 12, 0, 0, }, /* 685 */ + { 124, 7, 12, 0, 0, }, /* 686 */ + { 121, 7, 12, 0, 0, }, /* 687 */ + { 62, 7, 12, 0, 0, }, /* 688 */ + { 62, 14, 12, 0, 0, }, /* 689 */ + { 62, 21, 12, 0, 0, }, /* 690 */ + { 79, 7, 12, 0, 0, }, /* 691 */ + { 114, 7, 12, 0, 0, }, /* 692 */ + { 114, 13, 12, 0, 0, }, /* 693 */ + { 114, 21, 12, 0, 0, }, /* 694 */ + { 102, 7, 12, 0, 0, }, /* 695 */ + { 102, 12, 3, 0, 0, }, /* 696 */ + { 102, 21, 12, 0, 0, }, /* 697 */ + { 118, 7, 12, 0, 0, }, /* 698 */ + { 118, 12, 3, 0, 0, }, /* 699 */ + { 118, 21, 12, 0, 0, }, /* 700 */ + { 118, 26, 12, 0, 0, }, /* 701 */ + { 118, 6, 12, 0, 0, }, /* 702 */ + { 118, 13, 12, 0, 0, }, /* 703 */ + { 118, 15, 12, 0, 0, }, /* 704 */ + { 98, 7, 12, 0, 0, }, /* 705 */ + { 98, 10, 5, 0, 0, }, /* 706 */ + { 98, 12, 3, 0, 0, }, /* 707 */ + { 98, 6, 12, 0, 0, }, /* 708 */ + { 104, 7, 12, 0, 0, }, /* 709 */ + { 104, 26, 12, 0, 0, }, /* 710 */ + { 104, 12, 3, 0, 0, }, /* 711 */ + { 104, 21, 12, 0, 0, }, /* 712 */ + { 9, 10, 3, 0, 0, }, /* 713 */ + { 19, 12, 3, 0, 0, }, /* 714 */ + { 112, 7, 12, 0, 0, }, /* 715 */ + { 112, 15, 12, 0, 0, }, /* 716 */ + { 112, 12, 3, 0, 0, }, /* 717 */ + { 9, 26, 11, 0, 0, }, /* 718 */ + { 26, 26, 12, 0, 0, }, /* 719 */ }; const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */ @@ -742,38 +835,38 @@ const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+E800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F000 */ 123,123, 95, 95,124,125,126,127,128,128,129,130,131,132,133,134, /* U+F800 */ -135,136,137,138, 79,139,140,141,142,143, 79, 79, 79, 79, 79, 79, /* U+10000 */ -144, 79,145,146,147, 79,148, 79,149, 79, 79, 79,150, 79, 79, 79, /* U+10800 */ -151,152,153,154, 79, 79, 79, 79, 79, 79, 79, 79, 79,155, 79, 79, /* U+11000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+11800 */ -156,156,156,156,156,156,157, 79,158, 79, 79, 79, 79, 79, 79, 79, /* U+12000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+12800 */ -159,159,159,159,159,159,159,159,160, 79, 79, 79, 79, 79, 79, 79, /* U+13000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+13800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+14000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+14800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+15000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+15800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+16000 */ -161,161,161,161,162, 79, 79, 79, 79, 79, 79, 79, 79, 79,163,164, /* U+16800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+17000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+17800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+18000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+18800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+19000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+19800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1A800 */ -165, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1C800 */ - 71,166,167,168,169, 79,170, 79,171,172,173,174,175,176,177,178, /* U+1D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,179,180, 79, 79, /* U+1E800 */ -181,182,183,184,185, 79,186,187,188,189,190,191,192,193,194, 79, /* U+1F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+1F800 */ +135,136,137,138,139,140,141,142,143,144,145,139,146,146,147,139, /* U+10000 */ +148,149,150,151,152,153,154,155,156,139,139,139,157,139,139,139, /* U+10800 */ +158,159,160,161,162,163,164,139,139,165,139,166,167,168,139,139, /* U+11000 */ +139,169,139,139,139,170,139,139,139,139,139,139,139,139,139,139, /* U+11800 */ +171,171,171,171,171,171,171,172,173,139,139,139,139,139,139,139, /* U+12000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+12800 */ +174,174,174,174,174,174,174,174,175,139,139,139,139,139,139,139, /* U+13000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+13800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+14000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+14800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+15800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+16000 */ +176,176,176,176,177,178,179,180,139,139,139,139,139,139,181,182, /* U+16800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+17800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+18800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+19800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1A800 */ +183,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1B000 */ +139,139,139,139,139,139,139,139,184,185,139,139,139,139,139,139, /* U+1B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1C800 */ + 71,186,187,188,189,139,190,139,191,192,193,194,195,196,197,198, /* U+1D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1E000 */ +199,200,139,139,139,139,139,139,139,139,139,139,201,202,139,139, /* U+1E800 */ +203,204,205,206,207,139,208,209, 71,210,211,212,213,214,215,216, /* U+1F000 */ +217,218,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+1F800 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20000 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+20800 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+21000 */ @@ -794,402 +887,402 @@ const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+28800 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29000 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+29800 */ - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,195, 95, 95, /* U+2A000 */ + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,219, 95, 95, /* U+2A000 */ 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, /* U+2A800 */ - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,196, 95, /* U+2B000 */ -197, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2F000 */ - 95, 95, 95, 95,197, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+2F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+30000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+30800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+31000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+31800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+32000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+32800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+33000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+33800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+34000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+34800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+35000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+35800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+36000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+36800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+37000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+37800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+38000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+38800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+39000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+39800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+3F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+40000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+40800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+41000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+41800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+42000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+42800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+43000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+43800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+44000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+44800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+45000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+45800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+46000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+46800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+47000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+47800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+48000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+48800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+49000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+49800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+4F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+50000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+50800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+51000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+51800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+52000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+52800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+53000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+53800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+54000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+54800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+55000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+55800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+56000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+56800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+57000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+57800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+58000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+58800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+59000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+59800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+5F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+60000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+60800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+61000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+61800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+62000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+62800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+63000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+63800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+64000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+64800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+65000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+65800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+66000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+66800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+67000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+67800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+68000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+68800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+69000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+69800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+6F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+70000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+70800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+71000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+71800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+72000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+72800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+73000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+73800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+74000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+74800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+75000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+75800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+76000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+76800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+77000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+77800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+78000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+78800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+79000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+79800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+7F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+80000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+80800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+81000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+81800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+82000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+82800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+83000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+83800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+84000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+84800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+85000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+85800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+86000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+86800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+87000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+87800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+88000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+88800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+89000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+89800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+8F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+90000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+90800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+91000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+91800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+92000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+92800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+93000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+93800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+94000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+94800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+95000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+95800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+96000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+96800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+97000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+97800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+98000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+98800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+99000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+99800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9A000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9A800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9B000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9B800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9C000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9C800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9D000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9D800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9E000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9E800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9F000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+9F800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A0000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A0800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A1000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A1800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A2000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A2800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A3000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A3800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A4000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A4800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A5000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A5800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A6000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A6800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A7000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A7800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A8000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A8800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A9000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+A9800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AA000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AA800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AB000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AB800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AC000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AC800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AD000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AD800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AE000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AE800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AF000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+AF800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B0000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B0800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B1000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B1800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B2000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B2800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B3000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B3800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B4000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B4800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B5000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B5800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B6000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B6800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B7000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B7800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B8000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B8800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B9000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+B9800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BA000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BA800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BB000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BB800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BC000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BC800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BD000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BD800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BE000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BE800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BF000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+BF800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C0000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C0800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C1000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C1800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C2000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C2800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C3000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C3800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C4000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C4800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C5000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C5800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C6000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C6800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C7000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C7800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C8000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C8800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C9000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+C9800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CA000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CA800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CB000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CB800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CC000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CC800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CD000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CD800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CE000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CE800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CF000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+CF800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D0000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D0800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D1000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D1800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D2000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D2800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D3000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D3800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D4000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D4800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D5000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D5800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D6000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D6800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D7000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D7800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D8000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D8800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D9000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+D9800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DA000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DA800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DB000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DB800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DC000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DC800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DD000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DD800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DE000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DE800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DF000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+DF800 */ -198,199,200,201,199,199,199,199,199,199,199,199,199,199,199,199, /* U+E0000 */ -199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* U+E0800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E1000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E1800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E2000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E2800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E3000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E3800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E4000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E4800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E5000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E5800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E6000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E6800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E7000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E7800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E8000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E8800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E9000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+E9800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EA000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EA800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EB000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EB800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EC000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EC800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+ED000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+ED800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EE000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EE800 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EF000 */ - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, /* U+EF800 */ + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,220, 95, /* U+2B000 */ +221,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+2F000 */ + 95, 95, 95, 95,221,139,139,139,139,139,139,139,139,139,139,139, /* U+2F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+30800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+31800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+32800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+33800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+34800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+35800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+36800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+37800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+38800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+39800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+3F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+40800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+41800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+42800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+43800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+44800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+45800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+46800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+47800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+48800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+49800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+4F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+50800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+51800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+52800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+53800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+54800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+55800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+56800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+57800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+58800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+59800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+5F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+60800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+61800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+62800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+63800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+64800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+65800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+66800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+67800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+68800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+69800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+6F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+70800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+71800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+72800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+73800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+74800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+75800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+76800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+77800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+78800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+79800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+7F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+80800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+81800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+82800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+83800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+84800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+85800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+86800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+87800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+88800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+89800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+8F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+90800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+91800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+92800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+93800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+94800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+95800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+96800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+97800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+98800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+99800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9A800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9B800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9C800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9D800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9E800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+9F800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A0800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A1800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A2800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A3800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A4800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A5800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A6800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A7800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A8800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+A9800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AA800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AB800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AC800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AD800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AE800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+AF800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B0800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B1800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B2800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B3800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B4800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B5800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B6800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B7800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B8800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+B9800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BA800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BB800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BC800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BD800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BE800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+BF800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C0800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C1800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C2800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C3800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C4800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C5800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C6800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C7800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C8800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+C9800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CA800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CB800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CC800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CD800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CE800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+CF800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D0800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D1800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D2800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D3800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D4800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D5800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D6800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D7800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D8800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+D9800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DA800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DB800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DC800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DD800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DE800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+DF800 */ +222,223,224,225,223,223,223,223,223,223,223,223,223,223,223,223, /* U+E0000 */ +223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, /* U+E0800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E1800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E2800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E3800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E4800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E5800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E6800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E7800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E8800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+E9800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EA800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EB800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EC800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+ED800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EE800 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF000 */ +139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139, /* U+EF800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0000 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F0800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+F1000 */ @@ -1221,7 +1314,7 @@ const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE000 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FE800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+FF000 */ -123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,202, /* U+FF800 */ +123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,226, /* U+FF800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100000 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+100800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+101000 */ @@ -1253,10 +1346,10 @@ const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E000 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10E800 */ 123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123, /* U+10F000 */ -123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,202, /* U+10F800 */ +123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,226, /* U+10F800 */ }; -const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ +const pcre_uint16 PRIV(ucd_stage2)[] = { /* 58112 bytes, block = 128 */ /* block 0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1303,539 +1396,539 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 70, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33, 33, 71, 30, 31, 72, 73, 74, 74, 30, 31, 75, 76, 77, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, - 78, 79, 80, 81, 82, 33, 83, 83, 33, 84, 33, 85, 33, 33, 33, 33, - 83, 33, 33, 86, 33, 87, 88, 33, 89, 90, 33, 91, 33, 33, 33, 90, - 33, 92, 93, 33, 33, 94, 33, 33, 33, 33, 33, 33, 33, 95, 33, 33, + 78, 79, 80, 81, 82, 33, 83, 83, 33, 84, 33, 85, 86, 33, 33, 33, + 83, 87, 33, 88, 33, 89, 90, 33, 91, 92, 33, 93, 94, 33, 33, 92, + 33, 95, 96, 33, 33, 97, 33, 33, 33, 33, 33, 33, 33, 98, 33, 33, /* block 5 */ - 96, 33, 33, 96, 33, 33, 33, 33, 96, 97, 98, 98, 99, 33, 33, 33, - 33, 33,100, 33, 20, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 99, 33, 33, 99, 33, 33, 33,100, 99,101,102,102,103, 33, 33, 33, + 33, 33,104, 33, 20, 33, 33, 33, 33, 33, 33, 33, 33, 33,105, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, -101,101,101,101,101,101,101,101,101,102,102,102,102,102,102,102, -102,102, 14, 14, 14, 14,102,102,102,102,102,102,102,102,102,102, -102,102, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -101,101,101,101,101, 14, 14, 14, 14, 14,103,103,102, 14,102, 14, +106,106,106,106,106,106,106,106,106,107,107,107,107,107,107,107, +107,107, 14, 14, 14, 14,107,107,107,107,107,107,107,107,107,107, +107,107, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +106,106,106,106,106, 14, 14, 14, 14, 14,108,108,107, 14,107, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, /* block 6 */ -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,105,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -106,107,106,107,102,108,106,107,109,109,110,111,111,111, 4,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,110,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +111,112,111,112,107,113,111,112,114,114,115,116,116,116, 4,117, /* block 7 */ -109,109,109,109,108, 14,112, 4,113,113,113,109,114,109,115,115, -116,117,118,117,117,119,117,117,120,121,122,117,123,117,117,117, -124,125,109,126,117,117,127,117,117,128,117,117,129,130,130,130, -116,131,132,131,131,133,131,131,134,135,136,131,137,131,131,131, -138,139,140,141,131,131,142,131,131,143,131,131,144,145,145,146, -147,148,149,149,149,150,151,152,106,107,106,107,106,107,106,107, -106,107,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -155,156,157,116,158,159,160,106,107,161,106,107,116,162,162,162, +114,114,114,114,113, 14,118, 4,119,119,119,114,120,114,121,121, +122,123,124,123,123,125,123,123,126,127,128,123,129,123,123,123, +130,131,114,132,123,123,133,123,123,134,123,123,135,136,136,136, +122,137,138,137,137,139,137,137,140,141,142,137,143,137,137,137, +144,145,146,147,137,137,148,137,137,149,137,137,150,151,151,152, +153,154,155,155,155,156,157,158,111,112,111,112,111,112,111,112, +111,112,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +161,162,163,164,165,166,167,111,112,168,111,112,122,169,169,169, /* block 8 */ -163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163, -164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164, -164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164, -165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165, -165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165, -166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, +170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170, +171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171, +171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171, +172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172, +172,172,172,172,172,172,172,172,172,172,172,172,172,172,172,172, +173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, /* block 9 */ -167,168,169,170,170,104,104,170,171,171,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -172,167,168,167,168,167,168,167,168,167,168,167,168,167,168,173, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, +174,175,176,177,177,109,109,177,178,178,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +179,174,175,174,175,174,175,174,175,174,175,174,175,174,175,180, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, /* block 10 */ -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,109,109,109,109,109,109,109,109, -109,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174, -174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174, -174,174,174,174,174,174,174,109,109,175,176,176,176,176,176,176, -109,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177, -177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +114,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181, +181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181, +181,181,181,181,181,181,181,114,114,182,183,183,183,183,183,183, +114,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184, +184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184, /* block 11 */ -177,177,177,177,177,177,177,178,109, 4,179,109,109,109,109,180, -109,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181, -181,181,181,181,181,181,181,181,181,181,181,181,181,181,181,181, -181,181,181,181,181,181,181,181,181,181,181,181,181,181,182,181, -183,181,181,183,181,181,183,181,109,109,109,109,109,109,109,109, -184,184,184,184,184,184,184,184,184,184,184,184,184,184,184,184, -184,184,184,184,184,184,184,184,184,184,184,109,109,109,109,109, -184,184,184,183,183,109,109,109,109,109,109,109,109,109,109,109, +184,184,184,184,184,184,184,185,114, 4,186,114,114,187,187,188, +114,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189, +189,189,189,189,189,189,189,189,189,189,189,189,189,189,189,189, +189,189,189,189,189,189,189,189,189,189,189,189,189,189,190,189, +191,189,189,191,189,189,191,189,114,114,114,114,114,114,114,114, +192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192, +192,192,192,192,192,192,192,192,192,192,192,114,114,114,114,114, +192,192,192,191,191,114,114,114,114,114,114,114,114,114,114,114, /* block 12 */ -185,185,185,185,185,109,186,186,186,187,187,188, 4,187,189,189, -190,190,190,190,190,190,190,190,190,190,190, 4,185,109,187, 4, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -102,191,191,191,191,191,191,191,191,191,191,104,104,104,104,104, -104,104,104,104,104,104,190,190,190,190,190,190,190,190,190,190, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,187,187,187,187,191,191, -104,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +193,193,193,193,193, 22,194,194,194,195,195,196, 4,195,197,197, +198,198,198,198,198,198,198,198,198,198,198, 4, 22,114,195, 4, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +107,199,199,199,199,199,199,199,199,199,199,109,109,109,109,109, +109,109,109,109,109,109,198,198,198,198,198,198,198,198,198,198, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,195,195,195,195,199,199, +109,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 13 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,187,191,190,190,190,190,190,190,190, 22,189,190, -190,190,190,190,190,192,192,190,190,189,190,190,190,190,191,191, -193,193,193,193,193,193,193,193,193,193,191,191,191,189,189,191, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,195,199,198,198,198,198,198,198,198, 22,197,198, +198,198,198,198,198,200,200,198,198,197,198,198,198,198,199,199, +201,201,201,201,201,201,201,201,201,201,199,199,199,197,197,199, /* block 14 */ -194,194,194,194,194,194,194,194,194,194,194,194,194,194,109,195, -196,197,196,196,196,196,196,196,196,196,196,196,196,196,196,196, -196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196, -197,197,197,197,197,197,197,197,197,197,197,197,197,197,197,197, -197,197,197,197,197,197,197,197,197,197,197,109,109,196,196,196, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +202,202,202,202,202,202,202,202,202,202,202,202,202,202,114,203, +204,205,204,204,204,204,204,204,204,204,204,204,204,204,204,204, +204,204,204,204,204,204,204,204,204,204,204,204,204,204,204,204, +205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205, +205,205,205,205,205,205,205,205,205,205,205,114,114,204,204,204, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 15 */ -198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, -198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, -198,198,198,198,198,198,199,199,199,199,199,199,199,199,199,199, -199,198,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -200,200,200,200,200,200,200,200,200,200,201,201,201,201,201,201, -201,201,201,201,201,201,201,201,201,201,201,201,201,201,201,201, -201,201,201,201,201,201,201,201,201,201,201,202,202,202,202,202, -202,202,202,202,203,203,204,205,205,205,203,109,109,109,109,109, +206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, +206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, +206,206,206,206,206,206,207,207,207,207,207,207,207,207,207,207, +207,206,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +208,208,208,208,208,208,208,208,208,208,209,209,209,209,209,209, +209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,209, +209,209,209,209,209,209,209,209,209,209,209,210,210,210,210,210, +210,210,210,210,211,211,212,213,213,213,211,114,114,114,114,114, /* block 16 */ -206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, -206,206,206,206,206,206,207,207,207,207,208,207,207,207,207,207, -207,207,207,207,208,207,207,207,208,207,207,207,207,207,109,109, -209,209,209,209,209,209,209,209,209,209,209,209,209,209,209,109, -210,210,210,210,210,210,210,210,210,210,210,210,210,210,210,210, -210,210,210,210,210,210,210,210,210,211,211,211,109,109,212,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214, +214,214,214,214,214,214,215,215,215,215,216,215,215,215,215,215, +215,215,215,215,216,215,215,215,216,215,215,215,215,215,114,114, +217,217,217,217,217,217,217,217,217,217,217,217,217,217,217,114, +218,218,218,218,218,218,218,218,218,218,218,218,218,218,218,218, +218,218,218,218,218,218,218,218,218,219,219,219,114,114,220,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 17 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -191,109,191,191,191,191,191,191,191,191,191,191,191,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,190,190,190,190,190,190,190,190,190,190,190,190, -190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,198,198,198,198,198,198,198,198,198,198,198,198, +198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198, /* block 18 */ -213,213,213,214,215,215,215,215,215,215,215,215,215,215,215,215, -215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215, -215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215, -215,215,215,215,215,215,215,215,215,215,213,214,213,215,214,214, -214,213,213,213,213,213,213,213,213,214,214,214,214,213,214,214, -215,104,104,213,213,213,213,213,215,215,215,215,215,215,215,215, -215,215,213,213, 4, 4,216,216,216,216,216,216,216,216,216,216, -217,218,215,215,215,215,215,215,109,215,215,215,215,215,215,215, +221,221,221,222,223,223,223,223,223,223,223,223,223,223,223,223, +223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, +223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, +223,223,223,223,223,223,223,223,223,223,221,222,221,223,222,222, +222,221,221,221,221,221,221,221,221,222,222,222,222,221,222,222, +223,109,109,221,221,221,221,221,223,223,223,223,223,223,223,223, +223,223,221,221, 4, 4,224,224,224,224,224,224,224,224,224,224, +225,226,223,223,223,223,223,223,223,223,223,223,223,223,223,223, /* block 19 */ -109,219,220,220,109,221,221,221,221,221,221,221,221,109,109,221, -221,109,109,221,221,221,221,221,221,221,221,221,221,221,221,221, -221,221,221,221,221,221,221,221,221,109,221,221,221,221,221,221, -221,109,221,109,109,109,221,221,221,221,109,109,219,221,222,220, -220,219,219,219,219,109,109,220,220,109,109,220,220,219,221,109, -109,109,109,109,109,109,109,222,109,109,109,109,221,221,109,221, -221,221,219,219,109,109,223,223,223,223,223,223,223,223,223,223, -221,221,224,224,225,225,225,225,225,225,226,224,109,109,109,109, +227,228,229,229,114,227,227,227,227,227,227,227,227,114,114,227, +227,114,114,227,227,227,227,227,227,227,227,227,227,227,227,227, +227,227,227,227,227,227,227,227,227,114,227,227,227,227,227,227, +227,114,227,114,114,114,227,227,227,227,114,114,228,227,230,229, +229,228,228,228,228,114,114,229,229,114,114,229,229,228,227,114, +114,114,114,114,114,114,114,230,114,114,114,114,227,227,114,227, +227,227,228,228,114,114,231,231,231,231,231,231,231,231,231,231, +227,227,232,232,233,233,233,233,233,233,234,232,114,114,114,114, /* block 20 */ -109,227,227,228,109,229,229,229,229,229,229,109,109,109,109,229, -229,109,109,229,229,229,229,229,229,229,229,229,229,229,229,229, -229,229,229,229,229,229,229,229,229,109,229,229,229,229,229,229, -229,109,229,229,109,229,229,109,229,229,109,109,227,109,228,228, -228,227,227,109,109,109,109,227,227,109,109,227,227,227,109,109, -109,227,109,109,109,109,109,109,109,229,229,229,229,109,229,109, -109,109,109,109,109,109,230,230,230,230,230,230,230,230,230,230, -227,227,229,229,229,227,109,109,109,109,109,109,109,109,109,109, +114,235,235,236,114,237,237,237,237,237,237,114,114,114,114,237, +237,114,114,237,237,237,237,237,237,237,237,237,237,237,237,237, +237,237,237,237,237,237,237,237,237,114,237,237,237,237,237,237, +237,114,237,237,114,237,237,114,237,237,114,114,235,114,236,236, +236,235,235,114,114,114,114,235,235,114,114,235,235,235,114,114, +114,235,114,114,114,114,114,114,114,237,237,237,237,114,237,114, +114,114,114,114,114,114,238,238,238,238,238,238,238,238,238,238, +235,235,237,237,237,235,114,114,114,114,114,114,114,114,114,114, /* block 21 */ -109,231,231,232,109,233,233,233,233,233,233,233,233,233,109,233, -233,233,109,233,233,233,233,233,233,233,233,233,233,233,233,233, -233,233,233,233,233,233,233,233,233,109,233,233,233,233,233,233, -233,109,233,233,109,233,233,233,233,233,109,109,231,233,232,232, -232,231,231,231,231,231,109,231,231,232,109,232,232,231,109,109, -233,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -233,233,231,231,109,109,234,234,234,234,234,234,234,234,234,234, -235,236,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,239,239,240,114,241,241,241,241,241,241,241,241,241,114,241, +241,241,114,241,241,241,241,241,241,241,241,241,241,241,241,241, +241,241,241,241,241,241,241,241,241,114,241,241,241,241,241,241, +241,114,241,241,114,241,241,241,241,241,114,114,239,241,240,240, +240,239,239,239,239,239,114,239,239,240,114,240,240,239,114,114, +241,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +241,241,239,239,114,114,242,242,242,242,242,242,242,242,242,242, +243,244,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 22 */ -109,237,238,238,109,239,239,239,239,239,239,239,239,109,109,239, -239,109,109,239,239,239,239,239,239,239,239,239,239,239,239,239, -239,239,239,239,239,239,239,239,239,109,239,239,239,239,239,239, -239,109,239,239,109,239,239,239,239,239,109,109,237,239,240,237, -238,237,237,237,237,109,109,238,238,109,109,238,238,237,109,109, -109,109,109,109,109,109,237,240,109,109,109,109,239,239,109,239, -239,239,237,237,109,109,241,241,241,241,241,241,241,241,241,241, -242,239,243,243,243,243,243,243,109,109,109,109,109,109,109,109, +114,245,246,246,114,247,247,247,247,247,247,247,247,114,114,247, +247,114,114,247,247,247,247,247,247,247,247,247,247,247,247,247, +247,247,247,247,247,247,247,247,247,114,247,247,247,247,247,247, +247,114,247,247,114,247,247,247,247,247,114,114,245,247,248,245, +246,245,245,245,245,114,114,246,246,114,114,246,246,245,114,114, +114,114,114,114,114,114,245,248,114,114,114,114,247,247,114,247, +247,247,245,245,114,114,249,249,249,249,249,249,249,249,249,249, +250,247,251,251,251,251,251,251,114,114,114,114,114,114,114,114, /* block 23 */ -109,109,244,245,109,245,245,245,245,245,245,109,109,109,245,245, -245,109,245,245,245,245,109,109,109,245,245,109,245,109,245,245, -109,109,109,245,245,109,109,109,245,245,245,109,109,109,245,245, -245,245,245,245,245,245,245,245,245,245,109,109,109,109,246,247, -244,247,247,109,109,109,247,247,247,109,247,247,247,244,109,109, -245,109,109,109,109,109,109,246,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,248,248,248,248,248,248,248,248,248,248, -249,249,249,250,250,250,250,250,250,251,250,109,109,109,109,109, +114,114,252,253,114,253,253,253,253,253,253,114,114,114,253,253, +253,114,253,253,253,253,114,114,114,253,253,114,253,114,253,253, +114,114,114,253,253,114,114,114,253,253,253,114,114,114,253,253, +253,253,253,253,253,253,253,253,253,253,114,114,114,114,254,255, +252,255,255,114,114,114,255,255,255,114,255,255,255,252,114,114, +253,114,114,114,114,114,114,254,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,256,256,256,256,256,256,256,256,256,256, +257,257,257,258,258,258,258,258,258,259,258,114,114,114,114,114, /* block 24 */ -109,252,252,252,109,253,253,253,253,253,253,253,253,109,253,253, -253,109,253,253,253,253,253,253,253,253,253,253,253,253,253,253, -253,253,253,253,253,253,253,253,253,109,253,253,253,253,253,253, -253,253,253,253,109,253,253,253,253,253,109,109,109,253,254,254, -254,252,252,252,252,109,254,254,254,109,254,254,254,254,109,109, -109,109,109,109,109,254,254,109,253,253,109,109,109,109,109,109, -253,253,254,254,109,109,255,255,255,255,255,255,255,255,255,255, -109,109,109,109,109,109,109,109,256,256,256,256,256,256,256,257, +260,261,261,261,114,262,262,262,262,262,262,262,262,114,262,262, +262,114,262,262,262,262,262,262,262,262,262,262,262,262,262,262, +262,262,262,262,262,262,262,262,262,114,262,262,262,262,262,262, +262,262,262,262,262,262,262,262,262,262,114,114,114,262,260,260, +260,261,261,261,261,114,260,260,260,114,260,260,260,260,114,114, +114,114,114,114,114,260,260,114,262,262,114,114,114,114,114,114, +262,262,260,260,114,114,263,263,263,263,263,263,263,263,263,263, +114,114,114,114,114,114,114,114,264,264,264,264,264,264,264,265, /* block 25 */ -109,109,258,258,109,259,259,259,259,259,259,259,259,109,259,259, -259,109,259,259,259,259,259,259,259,259,259,259,259,259,259,259, -259,259,259,259,259,259,259,259,259,109,259,259,259,259,259,259, -259,259,259,259,109,259,259,259,259,259,109,109,260,259,258,260, -258,258,261,258,258,109,260,258,258,109,258,258,260,260,109,109, -109,109,109,109,109,261,261,109,109,109,109,109,109,109,259,109, -259,259,260,260,109,109,262,262,262,262,262,262,262,262,262,262, -109,259,259,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,266,267,267,114,268,268,268,268,268,268,268,268,114,268,268, +268,114,268,268,268,268,268,268,268,268,268,268,268,268,268,268, +268,268,268,268,268,268,268,268,268,114,268,268,268,268,268,268, +268,268,268,268,114,268,268,268,268,268,114,114,266,268,267,266, +267,267,269,267,267,114,266,267,267,114,267,267,266,266,114,114, +114,114,114,114,114,269,269,114,114,114,114,114,114,114,268,114, +268,268,266,266,114,114,270,270,270,270,270,270,270,270,270,270, +114,268,268,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 26 */ -109,109,263,263,109,264,264,264,264,264,264,264,264,109,264,264, -264,109,264,264,264,264,264,264,264,264,264,264,264,264,264,264, -264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, -264,264,264,264,264,264,264,264,264,264,264,109,109,264,265,263, -263,266,266,266,266,109,263,263,263,109,263,263,263,266,264,109, -109,109,109,109,109,109,109,265,109,109,109,109,109,109,109,109, -264,264,266,266,109,109,267,267,267,267,267,267,267,267,267,267, -268,268,268,268,268,268,109,109,109,269,264,264,264,264,264,264, +114,271,272,272,114,273,273,273,273,273,273,273,273,114,273,273, +273,114,273,273,273,273,273,273,273,273,273,273,273,273,273,273, +273,273,273,273,273,273,273,273,273,273,273,273,273,273,273,273, +273,273,273,273,273,273,273,273,273,273,273,114,114,273,274,272, +272,271,271,271,271,114,272,272,272,114,272,272,272,271,273,114, +114,114,114,114,114,114,114,274,114,114,114,114,114,114,114,114, +273,273,271,271,114,114,275,275,275,275,275,275,275,275,275,275, +276,276,276,276,276,276,114,114,114,277,273,273,273,273,273,273, /* block 27 */ -109,109,270,270,109,271,271,271,271,271,271,271,271,271,271,271, -271,271,271,271,271,271,271,109,109,109,271,271,271,271,271,271, -271,271,271,271,271,271,271,271,271,271,271,271,271,271,271,271, -271,271,109,271,271,271,271,271,271,271,271,271,109,271,109,109, -271,271,271,271,271,271,271,109,109,109,272,109,109,109,109,273, -270,270,272,272,272,109,272,109,270,270,270,270,270,270,270,273, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,270,270,274,109,109,109,109,109,109,109,109,109,109,109, +114,114,278,278,114,279,279,279,279,279,279,279,279,279,279,279, +279,279,279,279,279,279,279,114,114,114,279,279,279,279,279,279, +279,279,279,279,279,279,279,279,279,279,279,279,279,279,279,279, +279,279,114,279,279,279,279,279,279,279,279,279,114,279,114,114, +279,279,279,279,279,279,279,114,114,114,280,114,114,114,114,281, +278,278,280,280,280,114,280,114,278,278,278,278,278,278,278,281, +114,114,114,114,114,114,282,282,282,282,282,282,282,282,282,282, +114,114,278,278,283,114,114,114,114,114,114,114,114,114,114,114, /* block 28 */ -109,275,275,275,275,275,275,275,275,275,275,275,275,275,275,275, -275,275,275,275,275,275,275,275,275,275,275,275,275,275,275,275, -275,275,275,275,275,275,275,275,275,275,275,275,275,275,275,275, -275,276,275,277,276,276,276,276,276,276,276,109,109,109,109, 5, -275,275,275,275,275,275,278,276,276,276,276,276,276,276,276,279, -280,280,280,280,280,280,280,280,280,280,279,279,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284, +284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284, +284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284, +284,285,284,286,285,285,285,285,285,285,285,114,114,114,114, 5, +284,284,284,284,284,284,287,285,285,285,285,285,285,285,285,288, +289,289,289,289,289,289,289,289,289,289,288,288,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 29 */ -109,281,281,109,281,109,109,281,281,109,281,109,109,281,109,109, -109,109,109,109,281,281,281,281,109,281,281,281,281,281,281,281, -109,281,281,281,109,281,109,281,109,109,281,281,109,281,281,281, -281,282,281,283,282,282,282,282,282,282,109,282,282,281,109,109, -281,281,281,281,281,109,284,109,282,282,282,282,282,282,109,109, -285,285,285,285,285,285,285,285,285,285,109,109,281,281,281,281, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,290,290,114,290,114,114,290,290,114,290,114,114,290,114,114, +114,114,114,114,290,290,290,290,114,290,290,290,290,290,290,290, +114,290,290,290,114,290,114,290,114,114,290,290,114,290,290,290, +290,291,290,292,291,291,291,291,291,291,114,291,291,290,114,114, +290,290,290,290,290,114,293,114,291,291,291,291,291,291,114,114, +294,294,294,294,294,294,294,294,294,294,114,114,290,290,290,290, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 30 */ -286,287,287,287,288,288,288,288,288,288,288,288,288,288,288,288, -288,288,288,287,288,287,287,287,289,289,287,287,287,287,287,287, -290,290,290,290,290,290,290,290,290,290,291,291,291,291,291,291, -291,291,291,291,287,289,287,289,287,289,292,293,292,293,294,294, -286,286,286,286,286,286,286,286,109,286,286,286,286,286,286,286, -286,286,286,286,286,286,286,286,286,286,286,286,286,286,286,286, -286,286,286,286,286,286,286,286,286,286,286,286,286,109,109,109, -109,289,289,289,289,289,289,289,289,289,289,289,289,289,289,294, +295,296,296,296,297,297,297,297,297,297,297,297,297,297,297,297, +297,297,297,296,297,296,296,296,298,298,296,296,296,296,296,296, +299,299,299,299,299,299,299,299,299,299,300,300,300,300,300,300, +300,300,300,300,296,298,296,298,296,298,301,302,301,302,303,303, +295,295,295,295,295,295,295,295,114,295,295,295,295,295,295,295, +295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295, +295,295,295,295,295,295,295,295,295,295,295,295,295,114,114,114, +114,298,298,298,298,298,298,298,298,298,298,298,298,298,298,303, /* block 31 */ -289,289,289,289,289,288,289,289,286,286,286,286,286,289,289,289, -289,289,289,289,289,289,289,289,109,289,289,289,289,289,289,289, -289,289,289,289,289,289,289,289,289,289,289,289,289,289,289,289, -289,289,289,289,289,289,289,289,289,289,289,289,289,109,287,287, -287,287,287,287,287,287,289,287,287,287,287,287,287,109,287,287, -288,288,288,288,288, 19, 19, 19, 19,288,288,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +298,298,298,298,298,297,298,298,295,295,295,295,295,298,298,298, +298,298,298,298,298,298,298,298,114,298,298,298,298,298,298,298, +298,298,298,298,298,298,298,298,298,298,298,298,298,298,298,298, +298,298,298,298,298,298,298,298,298,298,298,298,298,114,296,296, +296,296,296,296,296,296,298,296,296,296,296,296,296,114,296,296, +297,297,297,297,297, 19, 19, 19, 19,297,297,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 32 */ -295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295, -295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295, -295,295,295,295,295,295,295,295,295,295,295,296,296,297,297,297, -297,298,297,297,297,297,297,297,296,297,297,298,298,297,297,295, -299,299,299,299,299,299,299,299,299,299,300,300,300,300,300,300, -295,295,295,295,295,295,298,298,297,297,295,295,295,295,297,297, -297,295,296,296,296,295,295,296,296,296,296,296,296,296,295,295, -295,297,297,297,297,295,295,295,295,295,295,295,295,295,295,295, +304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304, +304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304, +304,304,304,304,304,304,304,304,304,304,304,305,305,306,306,306, +306,307,306,306,306,306,306,306,305,306,306,307,307,306,306,304, +308,308,308,308,308,308,308,308,308,308,309,309,309,309,309,309, +304,304,304,304,304,304,307,307,306,306,304,304,304,304,306,306, +306,304,305,305,305,304,304,305,305,305,305,305,305,305,304,304, +304,306,306,306,306,304,304,304,304,304,304,304,304,304,304,304, /* block 33 */ -295,295,297,296,298,297,297,296,296,296,296,296,296,297,295,296, -299,299,299,299,299,299,299,299,299,299,296,296,296,297,301,301, -302,302,302,302,302,302,302,302,302,302,302,302,302,302,302,302, -302,302,302,302,302,302,302,302,302,302,302,302,302,302,302,302, -302,302,302,302,302,302,109,302,109,109,109,109,109,302,109,109, -303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303, -303,303,303,303,303,303,303,303,303,303,303,303,303,303,303,303, -303,303,303,303,303,303,303,303,303,303,303, 4,304,303,303,303, +304,304,306,305,307,306,306,305,305,305,305,305,305,306,304,305, +308,308,308,308,308,308,308,308,308,308,305,305,305,306,310,310, +311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311, +311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311, +311,311,311,311,311,311,114,311,114,114,114,114,114,311,114,114, +312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312, +312,312,312,312,312,312,312,312,312,312,312,312,312,312,312,312, +312,312,312,312,312,312,312,312,312,312,312, 4,313,312,312,312, /* block 34 */ -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, -306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, /* block 35 */ -306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, -306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, -306,306,306,306,306,306,306,306,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, +315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +315,315,315,315,315,315,315,315,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, /* block 36 */ -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,109,308,308,308,308,109,109, -308,308,308,308,308,308,308,109,308,109,308,308,308,308,109,109, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,114,317,317,317,317,114,114, +317,317,317,317,317,317,317,114,317,114,317,317,317,317,114,114, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, /* block 37 */ -308,308,308,308,308,308,308,308,308,109,308,308,308,308,109,109, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,109,308,308,308,308,109,109,308,308,308,308,308,308,308,109, -308,109,308,308,308,308,109,109,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, +317,317,317,317,317,317,317,317,317,114,317,317,317,317,114,114, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,114, +317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, /* block 38 */ -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,109,308,308,308,308,109,109,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,308,308,308,308,109,109,309,309,309, -310,310,310,310,310,310,310,310,310,311,311,311,311,311,311,311, -311,311,311,311,311,311,311,311,311,311,311,311,311,109,109,109, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,114,317,317,317,317,114,114,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,317,317,317,317,114,114,318,318,318, +319,319,319,319,319,319,319,319,319,320,320,320,320,320,320,320, +320,320,320,320,320,320,320,320,320,320,320,320,320,114,114,114, /* block 39 */ -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -312,312,312,312,312,312,312,312,312,312,109,109,109,109,109,109, -313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, -313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, -313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, -313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, -313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, -313,313,313,313,313,109,109,109,109,109,109,109,109,109,109,109, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +321,321,321,321,321,321,321,321,321,321,114,114,114,114,114,114, +322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322, +322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322, +322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322, +322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322, +322,322,322,322,322,322,322,322,322,322,322,322,322,322,322,322, +322,322,322,322,322,114,114,114,114,114,114,114,114,114,114,114, /* block 40 */ -314,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +323,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, /* block 41 */ -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, /* block 42 */ -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,316,316,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,325,325,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, /* block 43 */ -317,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318, -318,318,318,318,318,318,318,318,318,318,318,319,320,109,109,109, -321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321, -321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321, -321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321, -321,321,321,321,321,321,321,321,321,321,321,321,321,321,321,321, -321,321,321,321,321,321,321,321,321,321,321, 4, 4, 4,322,322, -322,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +326,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327, +327,327,327,327,327,327,327,327,327,327,327,328,329,114,114,114, +330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330, +330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330, +330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330, +330,330,330,330,330,330,330,330,330,330,330,330,330,330,330,330, +330,330,330,330,330,330,330,330,330,330,330, 4, 4, 4,331,331, +331,330,330,330,330,330,330,330,330,114,114,114,114,114,114,114, /* block 44 */ -323,323,323,323,323,323,323,323,323,323,323,323,323,109,323,323, -323,323,324,324,324,109,109,109,109,109,109,109,109,109,109,109, -325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325, -325,325,326,326,326, 4, 4,109,109,109,109,109,109,109,109,109, -327,327,327,327,327,327,327,327,327,327,327,327,327,327,327,327, -327,327,328,328,109,109,109,109,109,109,109,109,109,109,109,109, -329,329,329,329,329,329,329,329,329,329,329,329,329,109,329,329, -329,109,330,330,109,109,109,109,109,109,109,109,109,109,109,109, +332,332,332,332,332,332,332,332,332,332,332,332,332,114,332,332, +332,332,333,333,333,114,114,114,114,114,114,114,114,114,114,114, +334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334, +334,334,335,335,335, 4, 4,114,114,114,114,114,114,114,114,114, +336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336, +336,336,337,337,114,114,114,114,114,114,114,114,114,114,114,114, +338,338,338,338,338,338,338,338,338,338,338,338,338,114,338,338, +338,114,339,339,114,114,114,114,114,114,114,114,114,114,114,114, /* block 45 */ -331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331, -331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331, -331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331, -331,331,331,331,332,332,333,332,332,332,332,332,332,332,333,333, -333,333,333,333,333,333,332,333,333,332,332,332,332,332,332,332, -332,332,332,332,334,334,334,335,334,334,334,336,331,332,109,109, -337,337,337,337,337,337,337,337,337,337,109,109,109,109,109,109, -338,338,338,338,338,338,338,338,338,338,109,109,109,109,109,109, +340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340, +340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340, +340,340,340,340,340,340,340,340,340,340,340,340,340,340,340,340, +340,340,340,340,341,341,342,341,341,341,341,341,341,341,342,342, +342,342,342,342,342,342,341,342,342,341,341,341,341,341,341,341, +341,341,341,341,343,343,343,344,343,343,343,345,340,341,114,114, +346,346,346,346,346,346,346,346,346,346,114,114,114,114,114,114, +347,347,347,347,347,347,347,347,347,347,114,114,114,114,114,114, /* block 46 */ -339,339, 4, 4,339, 4,340,339,339,339,339,341,341,341,342,109, -343,343,343,343,343,343,343,343,343,343,109,109,109,109,109,109, -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,345,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,109,109,109,109,109,109,109,109, +348,348, 4, 4,348, 4,349,348,348,348,348,350,350,350,351,114, +352,352,352,352,352,352,352,352,352,352,114,114,114,114,114,114, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,354,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,114,114,114,114,114,114,114,114, /* block 47 */ -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,344,344,344,344,344,344,344,344, -344,344,344,344,344,344,344,344,344,341,344,109,109,109,109,109, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, -315,315,315,315,315,315,109,109,109,109,109,109,109,109,109,109, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,350,353,114,114,114,114,114, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,324,324,324,324,324,324,324,324,324,324, +324,324,324,324,324,324,114,114,114,114,114,114,114,114,114,114, /* block 48 */ -346,346,346,346,346,346,346,346,346,346,346,346,346,346,346,346, -346,346,346,346,346,346,346,346,346,346,346,346,346,109,109,109, -347,347,347,348,348,348,348,347,347,348,348,348,109,109,109,109, -348,348,347,348,348,348,348,348,348,347,347,347,109,109,109,109, -349,109,109,109,350,350,351,351,351,351,351,351,351,351,351,351, -352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352, -352,352,352,352,352,352,352,352,352,352,352,352,352,352,109,109, -352,352,352,352,352,109,109,109,109,109,109,109,109,109,109,109, +355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, +355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,114, +356,356,356,357,357,357,357,356,356,357,357,357,114,114,114,114, +357,357,356,357,357,357,357,357,357,356,356,356,114,114,114,114, +358,114,114,114,359,359,360,360,360,360,360,360,360,360,360,360, +361,361,361,361,361,361,361,361,361,361,361,361,361,361,361,361, +361,361,361,361,361,361,361,361,361,361,361,361,361,361,114,114, +361,361,361,361,361,114,114,114,114,114,114,114,114,114,114,114, /* block 49 */ -353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, -353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, -353,353,353,353,353,353,353,353,353,353,353,353,109,109,109,109, -354,354,354,354,354,355,355,355,354,354,355,354,354,354,354,354, -354,353,353,353,353,353,353,353,354,354,109,109,109,109,109,109, -356,356,356,356,356,356,356,356,356,356,357,109,109,109,358,358, -359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, -359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,362, +362,362,362,362,362,362,362,362,362,362,362,362,362,362,362,362, +362,362,362,362,362,362,362,362,362,362,362,362,114,114,114,114, +363,363,363,363,363,364,364,364,363,363,364,363,363,363,363,363, +363,362,362,362,362,362,362,362,363,363,114,114,114,114,114,114, +365,365,365,365,365,365,365,365,365,365,366,114,114,114,367,367, +368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,368, +368,368,368,368,368,368,368,368,368,368,368,368,368,368,368,368, /* block 50 */ -360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, -360,360,360,360,360,360,360,361,361,362,362,361,109,109,363,363, -364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364, -364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364, -364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364, -364,364,364,364,364,365,366,365,366,366,366,366,366,366,366,109, -366,367,366,367,367,366,366,366,366,366,366,366,366,365,365,365, -365,365,365,366,366,366,366,366,366,366,366,366,366,109,109,366, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,370,370,371,371,370,114,114,372,372, +373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, +373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, +373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, +373,373,373,373,373,374,375,374,375,375,375,375,375,375,375,114, +375,376,375,376,376,375,375,375,375,375,375,375,375,374,374,374, +374,374,374,375,375,375,375,375,375,375,375,375,375,114,114,375, /* block 51 */ -368,368,368,368,368,368,368,368,368,368,109,109,109,109,109,109, -368,368,368,368,368,368,368,368,368,368,109,109,109,109,109,109, -369,369,369,369,369,369,369,370,369,369,369,369,369,369,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +377,377,377,377,377,377,377,377,377,377,114,114,114,114,114,114, +377,377,377,377,377,377,377,377,377,377,114,114,114,114,114,114, +378,378,378,378,378,378,378,379,378,378,378,378,378,378,114,114, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,380,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 52 */ -371,371,371,371,372,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,371,372,371,371,371,371,371,372,371,372,372,372, -372,372,371,372,372,373,373,373,373,373,373,373,109,109,109,109, -374,374,374,374,374,374,374,374,374,374,375,375,375,375,375,375, -375,376,376,376,376,376,376,376,376,376,376,371,371,371,371,371, -371,371,371,371,376,376,376,376,376,376,376,376,376,109,109,109, +381,381,381,381,382,383,383,383,383,383,383,383,383,383,383,383, +383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383, +383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383, +383,383,383,383,381,382,381,381,381,381,381,382,381,382,382,382, +382,382,381,382,382,383,383,383,383,383,383,383,114,114,114,114, +384,384,384,384,384,384,384,384,384,384,385,385,385,385,385,385, +385,386,386,386,386,386,386,386,386,386,386,381,381,381,381,381, +381,381,381,381,386,386,386,386,386,386,386,386,386,114,114,114, /* block 53 */ -377,377,378,379,379,379,379,379,379,379,379,379,379,379,379,379, -379,379,379,379,379,379,379,379,379,379,379,379,379,379,379,379, -379,378,377,377,377,377,378,378,377,377,378,377,378,378,379,379, -380,380,380,380,380,380,380,380,380,380,379,379,379,379,379,379, -381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,381, -381,381,381,381,381,381,381,381,381,381,381,381,381,381,381,381, -381,381,381,381,381,381,382,383,382,382,383,383,383,382,383,382, -382,382,383,383,109,109,109,109,109,109,109,109,384,384,384,384, +387,387,388,389,389,389,389,389,389,389,389,389,389,389,389,389, +389,389,389,389,389,389,389,389,389,389,389,389,389,389,389,389, +389,388,387,387,387,387,388,388,387,387,388,387,387,387,389,389, +390,390,390,390,390,390,390,390,390,390,389,389,389,389,389,389, +391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,391, +391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,391, +391,391,391,391,391,391,392,393,392,392,393,393,393,392,393,392, +392,392,393,393,114,114,114,114,114,114,114,114,394,394,394,394, /* block 54 */ -385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385, -385,385,385,385,385,385,385,385,385,385,385,385,385,385,385,385, -385,385,385,385,386,386,386,386,386,386,386,386,387,387,387,387, -387,387,387,387,386,386,387,387,109,109,109,388,388,388,388,388, -389,389,389,389,389,389,389,389,389,389,109,109,109,385,385,385, -390,390,390,390,390,390,390,390,390,390,391,391,391,391,391,391, -391,391,391,391,391,391,391,391,391,391,391,391,391,391,391,391, -391,391,391,391,391,391,391,391,392,392,392,392,392,392,393,393, +395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395, +395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395, +395,395,395,395,396,396,396,396,396,396,396,396,397,397,397,397, +397,397,397,397,396,396,397,397,114,114,114,398,398,398,398,398, +399,399,399,399,399,399,399,399,399,399,114,114,114,395,395,395, +400,400,400,400,400,400,400,400,400,400,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,402,402,402,402,402,402,403,403, /* block 55 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -394,394,394,394,394,394,394,394,109,109,109,109,109,109,109,109, -104,104,104, 4,104,104,104,104,104,104,104,104,104,104,104,104, -104,395,104,104,104,104,104,104,104,396,396,396,396,104,396,396, -396,396,395,395,104,396,396,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +404,404,404,404,404,404,404,404,114,114,114,114,114,114,114,114, +109,109,109, 4,109,109,109,109,109,109,109,109,109,109,109,109, +109,405,109,109,109,109,109,109,109,406,406,406,406,109,406,406, +406,406,405,405,109,406,406,114,109,109,114,114,114,114,114,114, /* block 56 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33,116,116,116,116,116,397,101,101,101,101, -101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101, -101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101, -101,101,101,101,101,101,101,101,101,101,101,101,101,110,110,110, -110,110,101,101,101,101,110,110,110,110,110, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33,398,399, 33, 33, 33,400, 33, 33, + 33, 33, 33, 33, 33, 33,122,122,122,122,122,407,106,106,106,106, +106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106, +106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106, +106,106,106,106,106,106,106,106,106,106,106,106,106,115,115,115, +115,115,106,106,106,106,115,115,115,115,115, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33,408,409, 33, 33, 33,410, 33, 33, /* block 57 */ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,101,101,101,101,101, -101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101, -101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,110, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,104,104,104,104, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,106,106,106,106,106, +106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106, +106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,115, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,114,114,114,114,114,114,109,109,109,109, /* block 58 */ 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, @@ -1844,12 +1937,12 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, -401,402, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, +411,412, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, /* block 59 */ 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, - 30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33,403, 33, 33,404, 33, + 30, 31, 30, 31, 30, 31, 33, 33, 33, 33, 33,413, 33, 33,414, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, @@ -1858,57 +1951,57 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, /* block 60 */ -405,405,405,405,405,405,405,405,406,406,406,406,406,406,406,406, -405,405,405,405,405,405,109,109,406,406,406,406,406,406,109,109, -405,405,405,405,405,405,405,405,406,406,406,406,406,406,406,406, -405,405,405,405,405,405,405,405,406,406,406,406,406,406,406,406, -405,405,405,405,405,405,109,109,406,406,406,406,406,406,109,109, -116,405,116,405,116,405,116,405,109,406,109,406,109,406,109,406, -405,405,405,405,405,405,405,405,406,406,406,406,406,406,406,406, -407,407,408,408,408,408,409,409,410,410,411,411,412,412,109,109, +415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416, +415,415,415,415,415,415,114,114,416,416,416,416,416,416,114,114, +415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416, +415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416, +415,415,415,415,415,415,114,114,416,416,416,416,416,416,114,114, +122,415,122,415,122,415,122,415,114,416,114,416,114,416,114,416, +415,415,415,415,415,415,415,415,416,416,416,416,416,416,416,416, +417,417,418,418,418,418,419,419,420,420,421,421,422,422,114,114, /* block 61 */ -405,405,405,405,405,405,405,405,413,413,413,413,413,413,413,413, -405,405,405,405,405,405,405,405,413,413,413,413,413,413,413,413, -405,405,405,405,405,405,405,405,413,413,413,413,413,413,413,413, -405,405,116,414,116,109,116,116,406,406,415,415,416,108,417,108, -108,108,116,414,116,109,116,116,418,418,418,418,416,108,108,108, -405,405,116,116,109,109,116,116,406,406,419,419,109,108,108,108, -405,405,116,116,116,157,116,116,406,406,420,420,161,108,108,108, -109,109,116,414,116,109,116,116,421,421,422,422,416,108,108,109, +415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423, +415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423, +415,415,415,415,415,415,415,415,423,423,423,423,423,423,423,423, +415,415,122,424,122,114,122,122,416,416,425,425,426,113,427,113, +113,113,122,424,122,114,122,122,428,428,428,428,426,113,113,113, +415,415,122,122,114,114,122,122,416,416,429,429,114,113,113,113, +415,415,122,122,122,163,122,122,416,416,430,430,168,113,113,113, +114,114,122,424,122,114,122,122,431,431,432,432,426,113,113,114, /* block 62 */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 22,423,423, 22, 22, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 22,433,433, 22, 22, 9, 9, 9, 9, 9, 9, 4, 4, 21, 25, 6, 21, 21, 25, 6, 21, - 4, 4, 4, 4, 4, 4, 4, 4,424,425, 22, 22, 22, 22, 22, 3, + 4, 4, 4, 4, 4, 4, 4, 4,434,435, 22, 22, 22, 22, 22, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 21, 25, 4, 4, 4, 4, 15, 15, 4, 4, 4, 8, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 4, 15, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, - 22, 22, 22, 22, 22,426, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 23,101,109,109, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,101, + 22, 22, 22, 22, 22,436, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 23,106,114,114, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,106, /* block 63 */ - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,109, -101,101,101,101,101,101,101,101,101,101,101,101,101,109,109,109, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,114, +106,106,106,106,106,106,106,106,106,106,106,106,106,114,114,114, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -104,104,104,104,104,104,104,104,104,104,104,104,104,427,427,427, -427,104,427,427,427,104,104,104,104,104,104,104,104,104,104,104, -104,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +109,109,109,109,109,109,109,109,109,109,109,109,109,380,380,380, +380,109,380,380,380,109,109,109,109,109,109,109,109,109,109,109, +109,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 64 */ - 19, 19,428, 19, 19, 19, 19,428, 19, 19,429,428,428,428,429,429, -428,428,428,429, 19,428, 19, 19, 8,428,428,428,428,428, 19, 19, - 19, 19, 19, 19,428, 19,430, 19,428, 19,431,432,428,428, 19,429, -428,428,433,428,429,396,396,396,396,429, 19, 19,429,429,428,428, - 8, 8, 8, 8, 8,428,429,429,429,429, 19, 8, 19, 19,434, 19, + 19, 19,437, 19, 19, 19, 19,437, 19, 19,438,437,437,437,438,438, +437,437,437,438, 19,437, 19, 19, 8,437,437,437,437,437, 19, 19, + 19, 19, 19, 19,437, 19,439, 19,437, 19,440,441,437,437, 19,438, +437,437,442,437,438,406,406,406,406,438, 19, 19,438,438,437,437, + 8, 8, 8, 8, 8,437,438,438,438,438, 19, 8, 19, 19,443, 19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -435,435,435,435,435,435,435,435,435,435,435,435,435,435,435,435, -436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444, +445,445,445,445,445,445,445,445,445,445,445,445,445,445,445,445, /* block 65 */ -437,437,437, 30, 31,437,437,437,437, 23,109,109,109,109,109,109, +446,446,446, 30, 31,446,446,446,446, 23,114,114,114,114,114,114, 8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 8, 8, 19, 19, 19, 19, 8, 19, 19, 8, 19, 19, 8, 19, 19, 19, 19, 19, 19, 19, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, @@ -1945,15 +2038,15 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 8, 8, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114, /* block 69 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, @@ -1961,10 +2054,10 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19,438,438,438,438,438,438,438,438,438,438, -438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, -439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439, -439,439,439,439,439,439,439,439,439,439, 23, 23, 23, 23, 23, 23, + 19, 19, 19, 19, 19, 19,447,447,447,447,447,447,447,447,447,447, +447,447,447,447,447,447,447,447,447,447,447,447,447,447,447,447, +448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, +448,448,448,448,448,448,448,448,448,448, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, /* block 71 */ @@ -1998,7 +2091,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* block 74 */ -109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, @@ -2018,14 +2111,14 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, /* block 76 */ -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, -440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, +449,449,449,449,449,449,449,449,449,449,449,449,449,449,449,449, /* block 77 */ 8, 8, 8, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, @@ -2042,150 +2135,150 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 19, 19, 8, 8, 8, 8, 8, 8,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 8, 8, 8, 8, 8, 19, 19, 8, 8, 8, 8, 8, 8, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* block 79 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19,114, 19, 19, 19, 19, 19, 19, + 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 80 */ -441,441,441,441,441,441,441,441,441,441,441,441,441,441,441,441, -441,441,441,441,441,441,441,441,441,441,441,441,441,441,441,441, -441,441,441,441,441,441,441,441,441,441,441,441,441,441,441,109, -442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442, -442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442, -442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,109, - 30, 31,443,444,445,446,447, 30, 31, 30, 31, 30, 31,448,449,450, -451, 33, 30, 31, 33, 30, 31, 33, 33, 33, 33, 33,101,101,452,452, +450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450, +450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,450, +450,450,450,450,450,450,450,450,450,450,450,450,450,450,450,114, +451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451, +451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,451, +451,451,451,451,451,451,451,451,451,451,451,451,451,451,451,114, + 30, 31,452,453,454,455,456, 30, 31, 30, 31, 30, 31,457,458,459, +460, 33, 30, 31, 33, 30, 31, 33, 33, 33, 33, 33,106,106,461,461, /* block 81 */ -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,153,154,153,154,153,154,153,154,153,154,153,154, -153,154,153,154,453,454,454,454,454,454,454,153,154,153,154,455, -455,455,153,154,109,109,109,109,109,456,456,456,456,457,456,456, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,159,160,159,160,159,160,159,160,159,160,159,160, +159,160,159,160,462,463,463,463,463,463,463,159,160,159,160,464, +464,464,159,160,114,114,114,114,114,465,465,465,465,466,465,465, /* block 82 */ -458,458,458,458,458,458,458,458,458,458,458,458,458,458,458,458, -458,458,458,458,458,458,458,458,458,458,458,458,458,458,458,458, -458,458,458,458,458,458,109,458,109,109,109,109,109,458,109,109, -459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459, -459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459, -459,459,459,459,459,459,459,459,459,459,459,459,459,459,459,459, -459,459,459,459,459,459,459,459,109,109,109,109,109,109,109,460, -461,109,109,109,109,109,109,109,109,109,109,109,109,109,109,462, +467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, +467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, +467,467,467,467,467,467,114,467,114,114,114,114,114,467,114,114, +468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468, +468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468, +468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468, +468,468,468,468,468,468,468,468,114,114,114,114,114,114,114,469, +470,114,114,114,114,114,114,114,114,114,114,114,114,114,114,471, /* block 83 */ -308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308, -308,308,308,308,308,308,308,109,109,109,109,109,109,109,109,109, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,109, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,109, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,109, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,109, -170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170, -170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170, +317,317,317,317,317,317,317,317,317,317,317,317,317,317,317,317, +317,317,317,317,317,317,317,114,114,114,114,114,114,114,114,114, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114, +177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177, +177,177,177,177,177,177,177,177,177,177,177,177,177,177,177,177, /* block 84 */ 4, 4, 21, 25, 21, 25, 4, 4, 4, 21, 25, 4, 21, 25, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 4, 4, 9, 4, 21, 25, 4, 4, - 21, 25, 6, 7, 6, 7, 6, 7, 6, 7, 4, 4, 4, 4, 4,102, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 9,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 21, 25, 6, 7, 6, 7, 6, 7, 6, 7, 4, 4, 4, 4, 4,107, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 9, 4, 4, 4, 4, + 9, 4, 6,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 85 */ -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,109,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,109,109,109,109,109,109,109,109,109,109,109,109, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,114,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,114,114,114,114,114,114,114,114,114,114,114,114, /* block 86 */ -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, /* block 87 */ -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463, -463,463,463,463,463,463,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +472,472,472,472,472,472,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114, /* block 88 */ - 3, 4, 4, 4, 19,464,396,465, 6, 7, 6, 7, 6, 7, 6, 7, + 3, 4, 4, 4, 19,473,406,474, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 19, 19, 6, 7, 6, 7, 6, 7, 6, 7, 9, 6, 7, 7, - 19,465,465,465,465,465,465,465,465,465,104,104,104,104,466,466, - 9,102,102,102,102,102, 19, 19,465,465,465,464,396, 4, 19, 19, -109,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, -467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, -467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, -467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, + 19,474,474,474,474,474,474,474,474,474,109,109,109,109,475,475, + 9,107,107,107,107,107, 19, 19,474,474,474,473,406, 4, 19, 19, +114,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, /* block 89 */ -467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467, -467,467,467,467,467,467,467,109,109,104,104, 14, 14,468,468,467, - 9,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469, 4,102,470,470,469, +476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +476,476,476,476,476,476,476,114,114,109,109, 14, 14,477,477,476, + 9,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478, 4,107,479,479,478, /* block 90 */ -109,109,109,109,109,471,471,471,471,471,471,471,471,471,471,471, -471,471,471,471,471,471,471,471,471,471,471,471,471,471,471,471, -471,471,471,471,471,471,471,471,471,471,471,471,471,471,109,109, -109,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, +114,114,114,114,114,480,480,480,480,480,480,480,480,480,480,480, +480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480, +480,480,480,480,480,480,480,480,480,480,480,480,480,480,114,114, +114,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, /* block 91 */ -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,109, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,114, 19, 19, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -471,471,471,471,471,471,471,471,471,471,471,471,471,471,471,471, -471,471,471,471,471,471,471,471,471,471,471,109,109,109,109,109, +480,480,480,480,480,480,480,480,480,480,480,480,480,480,480,480, +480,480,480,480,480,480,480,480,480,480,480,114,114,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, + 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, /* block 92 */ -473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473, -473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,109, +482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, +482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,114, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23, 19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, -473,473,473,473,473,473,473,473,473,473,473,473,473,473,473,473, -473,473,473,473,473,473,473,473,473,473,473,473,473,473,473, 19, +482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, +482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, 19, /* block 93 */ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, @@ -2193,1099 +2286,1339 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,109, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,114, /* block 94 */ -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474, -474,474,474,474,474,474,474,474, 19, 19, 19, 19, 19, 19, 19, 19, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483,483,483,483,483,483,483,483,483, +483,483,483,483,483,483,483,483, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* block 95 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, /* block 96 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,109,109,109,109,109,109,109,109,109,109, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,114,114,114,114,114,114,114,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, /* block 97 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 98 */ -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,477,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,486,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, /* block 99 */ -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, -476,476,476,476,476,476,476,476,476,476,476,476,476,476,476,476, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, +485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485, /* block 100 */ -476,476,476,476,476,476,476,476,476,476,476,476,476,109,109,109, -478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, -478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, -478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, -478,478,478,478,478,478,478,109,109,109,109,109,109,109,109,109, -479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479, -479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479, -479,479,479,479,479,479,479,479,480,480,480,480,480,480,481,481, +485,485,485,485,485,485,485,485,485,485,485,485,485,114,114,114, +487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487, +487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487, +487,487,487,487,487,487,487,487,487,487,487,487,487,487,487,487, +487,487,487,487,487,487,487,114,114,114,114,114,114,114,114,114, +488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, +488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, +488,488,488,488,488,488,488,488,489,489,489,489,489,489,490,490, /* block 101 */ -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, /* block 102 */ -482,482,482,482,482,482,482,482,482,482,482,482,483,484,484,484, -482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482, -485,485,485,485,485,485,485,485,485,485,482,482,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,167,168,167,168,167,168,486,170, -171,171,171,487,170,170,170,170,170,170,170,170,170,170,487,398, +491,491,491,491,491,491,491,491,491,491,491,491,492,493,493,493, +491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491, +494,494,494,494,494,494,494,494,494,494,491,491,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,495,177, +178,178,178,496,177,177,177,177,177,177,177,177,177,177,496,408, /* block 103 */ -167,168,167,168,167,168,167,168,167,168,167,168,167,168,167,168, -167,168,167,168,167,168,167,168,109,109,109,109,109,109,109,170, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,489,489,489,489,489,489,489,489,489,489, -490,490,491,491,491,491,491,491,109,109,109,109,109,109,109,109, +174,175,174,175,174,175,174,175,174,175,174,175,174,175,174,175, +174,175,174,175,174,175,174,175,174,175,174,175,408,408,114,177, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,498,498,498,498,498,498,498,498,498,498, +499,499,500,500,500,500,500,500,114,114,114,114,114,114,114,114, /* block 104 */ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14,102,102,102,102,102,102,102,102,102, + 14, 14, 14, 14, 14, 14, 14,107,107,107,107,107,107,107,107,107, 14, 14, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 33, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, -101, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 30, 31,492, 30, 31, +106, 33, 33, 33, 33, 33, 33, 33, 33, 30, 31, 30, 31,501, 30, 31, /* block 105 */ - 30, 31, 30, 31, 30, 31, 30, 31,102, 14, 14, 30, 31,493, 33,109, - 30, 31, 30, 31,109,109,109,109,109,109,109,109,109,109,109,109, - 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,494,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,101,101, 33, 20, 20, 20, 20, 20, + 30, 31, 30, 31, 30, 31, 30, 31,107, 14, 14, 30, 31,502, 33,114, + 30, 31, 30, 31, 33, 33, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,503,504,505,506,114,114, +507,508,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114, 20,106,106, 33, 20, 20, 20, 20, 20, /* block 106 */ -495,495,496,495,495,495,496,495,495,495,495,496,495,495,495,495, -495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495, -495,495,495,497,497,496,496,497,498,498,498,498,109,109,109,109, - 23, 23, 23, 23, 23, 23, 19, 19, 5, 19,109,109,109,109,109,109, -499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499, -499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499, -499,499,499,499,499,499,499,499,499,499,499,499,499,499,499,499, -499,499,499,499,500,500,500,500,109,109,109,109,109,109,109,109, +509,509,510,509,509,509,510,509,509,509,509,510,509,509,509,509, +509,509,509,509,509,509,509,509,509,509,509,509,509,509,509,509, +509,509,509,511,511,510,510,511,512,512,512,512,114,114,114,114, + 23, 23, 23, 23, 23, 23, 19, 19, 5, 19,114,114,114,114,114,114, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,514,514,514,514,114,114,114,114,114,114,114,114, /* block 107 */ -501,501,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,501,501,501,501,501,501,501,501,501,501,501,501, -501,501,501,501,503,109,109,109,109,109,109,109,109,109,504,504, -505,505,505,505,505,505,505,505,505,505,109,109,109,109,109,109, -213,213,213,213,213,213,213,213,213,213,213,213,213,213,213,213, -213,213,215,215,215,215,215,215,217,217,217,215,109,109,109,109, +515,515,516,516,516,516,516,516,516,516,516,516,516,516,516,516, +516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516, +516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516, +516,516,516,516,515,515,515,515,515,515,515,515,515,515,515,515, +515,515,515,515,517,114,114,114,114,114,114,114,114,114,518,518, +519,519,519,519,519,519,519,519,519,519,114,114,114,114,114,114, +221,221,221,221,221,221,221,221,221,221,221,221,221,221,221,221, +221,221,223,223,223,223,223,223,225,225,225,223,114,114,114,114, /* block 108 */ -506,506,506,506,506,506,506,506,506,506,507,507,507,507,507,507, -507,507,507,507,507,507,507,507,507,507,507,507,507,507,507,507, -507,507,507,507,507,507,508,508,508,508,508,508,508,508,509,509, -510,510,510,510,510,510,510,510,510,510,510,510,510,510,510,510, -510,510,510,510,510,510,510,511,511,511,511,511,511,511,511,511, -511,511,512,512,109,109,109,109,109,109,109,109,109,109,109,513, -305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305, -305,305,305,305,305,305,305,305,305,305,305,305,305,109,109,109, +520,520,520,520,520,520,520,520,520,520,521,521,521,521,521,521, +521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521, +521,521,521,521,521,521,522,522,522,522,522,522,522,522, 4,523, +524,524,524,524,524,524,524,524,524,524,524,524,524,524,524,524, +524,524,524,524,524,524,524,525,525,525,525,525,525,525,525,525, +525,525,526,526,114,114,114,114,114,114,114,114,114,114,114,527, +314,314,314,314,314,314,314,314,314,314,314,314,314,314,314,314, +314,314,314,314,314,314,314,314,314,314,314,314,314,114,114,114, /* block 109 */ -514,514,514,515,516,516,516,516,516,516,516,516,516,516,516,516, -516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516, -516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516, -516,516,516,514,515,515,514,514,514,514,515,515,514,515,515,515, -515,517,517,517,517,517,517,517,517,517,517,517,517,517,109,102, -518,518,518,518,518,518,518,518,518,518,109,109,109,109,517,517, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +528,528,528,529,530,530,530,530,530,530,530,530,530,530,530,530, +530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530, +530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530, +530,530,530,528,529,529,528,528,528,528,529,529,528,529,529,529, +529,531,531,531,531,531,531,531,531,531,531,531,531,531,114,107, +532,532,532,532,532,532,532,532,532,532,114,114,114,114,531,531, +304,304,304,304,304,306,533,304,304,304,304,304,304,304,304,304, +308,308,308,308,308,308,308,308,308,308,304,304,304,304,304,114, /* block 110 */ -519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519, -519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519, -519,519,519,519,519,519,519,519,519,520,520,520,520,520,520,521, -521,520,520,521,521,520,520,109,109,109,109,109,109,109,109,109, -519,519,519,520,519,519,519,519,519,519,519,519,520,521,109,109, -522,522,522,522,522,522,522,522,522,522,109,109,523,523,523,523, -295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295, -524,295,295,295,295,295,295,301,301,301,295,296,109,109,109,109, +534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534, +534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534, +534,534,534,534,534,534,534,534,534,535,535,535,535,535,535,536, +536,535,535,536,536,535,535,114,114,114,114,114,114,114,114,114, +534,534,534,535,534,534,534,534,534,534,534,534,535,536,114,114, +537,537,537,537,537,537,537,537,537,537,114,114,538,538,538,538, +304,304,304,304,304,304,304,304,304,304,304,304,304,304,304,304, +533,304,304,304,304,304,304,310,310,310,304,305,306,305,304,304, /* block 111 */ -525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525, -525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525, -525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525, -526,525,526,526,526,525,525,526,526,525,525,525,525,525,526,526, -525,526,525,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,525,525,527,528,528, -529,529,529,529,529,529,529,529,529,529,529,530,531,531,530,530, -532,532,529,533,533,530,531,109,109,109,109,109,109,109,109,109, +539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, +539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, +539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, +540,539,540,540,540,539,539,540,540,539,539,539,539,539,540,540, +539,540,539,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,539,539,541,542,542, +543,543,543,543,543,543,543,543,543,543,543,544,545,545,544,544, +546,546,543,547,547,544,545,114,114,114,114,114,114,114,114,114, /* block 112 */ -109,308,308,308,308,308,308,109,109,308,308,308,308,308,308,109, -109,308,308,308,308,308,308,109,109,109,109,109,109,109,109,109, -308,308,308,308,308,308,308,109,308,308,308,308,308,308,308,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,317,317,317,317,317,317,114,114,317,317,317,317,317,317,114, +114,317,317,317,317,317,317,114,114,114,114,114,114,114,114,114, +317,317,317,317,317,317,317,114,317,317,317,317,317,317,317,114, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 14,106,106,106,106, +114,114,114,114, 33,122,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 113 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, -529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, -529,529,529,530,530,531,530,530,531,530,530,532,530,531,109,109, -534,534,534,534,534,534,534,534,534,534,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, +543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, +543,543,543,544,544,545,544,544,545,544,544,546,544,545,114,114, +548,548,548,548,548,548,548,548,548,548,114,114,114,114,114,114, /* block 114 */ -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, /* block 115 */ -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, /* block 116 */ -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, /* block 117 */ -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, /* block 118 */ -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, /* block 119 */ -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, /* block 120 */ -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +549,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,549,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,549,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, /* block 121 */ -536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536, -536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536, -536,536,536,536,109,109,109,109,109,109,109,109,109,109,109,109, -306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306, -306,306,306,306,306,306,306,109,109,109,109,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307, -307,307,307,307,307,307,307,307,307,307,307,307,109,109,109,109, +550,550,550,550,550,550,550,550,549,550,550,550,550,550,550,550, +550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, +550,550,550,550,114,114,114,114,114,114,114,114,114,114,114,114, +315,315,315,315,315,315,315,315,315,315,315,315,315,315,315,315, +315,315,315,315,315,315,315,114,114,114,114,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,316,316,316,316, +316,316,316,316,316,316,316,316,316,316,316,316,114,114,114,114, /* block 122 */ -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, -537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, +551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551, /* block 123 */ -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, /* block 124 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,109,109, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,114,114, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, /* block 125 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 126 */ - 33, 33, 33, 33, 33, 33, 33,109,109,109,109,109,109,109,109,109, -109,109,109,178,178,178,178,178,109,109,109,109,109,184,181,184, -184,184,184,184,184,184,184,184,184,539,184,184,184,184,184,184, -184,184,184,184,184,184,184,109,184,184,184,184,184,109,184,109, -184,184,109,184,184,109,184,184,184,184,184,184,184,184,184,184, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, + 33, 33, 33, 33, 33, 33, 33,114,114,114,114,114,114,114,114,114, +114,114,114,185,185,185,185,185,114,114,114,114,114,192,189,192, +192,192,192,192,192,192,192,192,192,553,192,192,192,192,192,192, +192,192,192,192,192,192,192,114,192,192,192,192,192,114,192,114, +192,192,114,192,192,114,192,192,192,192,192,192,192,192,192,192, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 127 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,540,540,540,540,540,540,540,540,540,540,540,540,540,540, -540,540,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 128 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 129 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191, 6, 7, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199, 7, 6, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, /* block 130 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -109,109,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -191,191,191,191,191,191,191,191,191,191,191,191,188, 19,109,109, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +114,114,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +199,199,199,199,199,199,199,199,199,199,199,199,196,197,114,114, /* block 131 */ -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, - 4, 4, 4, 4, 4, 4, 4, 6, 7, 4,109,109,109,109,109,109, -104,104,104,104,104,104,104,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 4, 4, 4, 4, 4, 4, 4, 6, 7, 4,114,114,114,114,114,114, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,114,114, 4, 9, 9, 15, 15, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 4, 4, 6, 7, 4, 4, 4, 4, 15, 15, 15, - 4, 4, 4,109, 4, 4, 4, 4, 9, 6, 7, 6, 7, 6, 7, 4, - 4, 4, 8, 9, 8, 8, 8,109, 4, 5, 4, 4,109,109,109,109, -191,191,191,191,191,109,191,191,191,191,191,191,191,191,191,191, + 4, 4, 4,114, 4, 4, 4, 4, 9, 6, 7, 6, 7, 6, 7, 4, + 4, 4, 8, 9, 8, 8, 8,114, 4, 5, 4, 4,114,114,114,114, +199,199,199,199,199,114,199,199,199,199,199,199,199,199,199,199, /* block 132 */ -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,109,109, 22, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,114,114, 22, /* block 133 */ -109, 4, 4, 4, 5, 4, 4, 4, 6, 7, 4, 8, 4, 9, 4, 4, +114, 4, 4, 4, 5, 4, 4, 4, 6, 7, 4, 8, 4, 9, 4, 4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 8, 8, 8, 4, 4, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 6, 4, 7, 14, 15, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6, 8, 7, 8, 6, - 7, 4, 6, 7, 4, 4,469,469,469,469,469,469,469,469,469,469, -102,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, + 7, 4, 6, 7, 4, 4,478,478,478,478,478,478,478,478,478,478, +107,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, /* block 134 */ -469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469, -469,469,469,469,469,469,469,469,469,469,469,469,469,469,541,541, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472, -472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,109, -109,109,472,472,472,472,472,472,109,109,472,472,472,472,472,472, -109,109,472,472,472,472,472,472,109,109,472,472,472,109,109,109, - 5, 5, 8, 14, 19, 5, 5,109, 19, 8, 8, 8, 8, 19, 19,109, -426,426,426,426,426,426,426,426,426, 22, 22, 22, 19, 19,109,109, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,478,478, +478,478,478,478,478,478,478,478,478,478,478,478,478,478,555,555, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,481, +481,481,481,481,481,481,481,481,481,481,481,481,481,481,481,114, +114,114,481,481,481,481,481,481,114,114,481,481,481,481,481,481, +114,114,481,481,481,481,481,481,114,114,481,481,481,114,114,114, + 5, 5, 8, 14, 19, 5, 5,114, 19, 8, 8, 8, 8, 19, 19,114, +436,436,436,436,436,436,436,436,436, 22, 22, 22, 19, 19,114,114, /* block 135 */ -542,542,542,542,542,542,542,542,542,542,542,542,109,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,109,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,109,542,542,109,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,109,109, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +556,556,556,556,556,556,556,556,556,556,556,556,114,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,114,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,114,556,556,114,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,114,114, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 136 */ -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542, -542,542,542,542,542,542,542,542,542,542,542,109,109,109,109,109, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,556,556,556,556,556, +556,556,556,556,556,556,556,556,556,556,556,114,114,114,114,114, /* block 137 */ - 4, 4, 4,109,109,109,109, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 4, 4, 4,114,114,114,114, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, -543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, -543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, -543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, -543,543,543,543,543,544,544,544,544,545,545,545,545,545,545,545, + 23, 23, 23, 23,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, +557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557, +557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557, +557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557, +557,557,557,557,557,558,558,558,558,559,559,559,559,559,559,559, /* block 138 */ -545,545,545,545,545,545,545,545,545,545,544,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +559,559,559,559,559,559,559,559,559,559,558,558,559,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114, +559,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,104,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,114,114, /* block 139 */ -546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546, -546,546,546,546,546,546,546,546,546,546,546,546,546,109,109,109, -547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547, -547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547, -547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547, -547,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 140 */ -548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548, -548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,109, -549,549,549,549,109,109,109,109,109,109,109,109,109,109,109,109, -550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550, -550,551,550,550,550,550,550,550,550,550,551,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560, +560,560,560,560,560,560,560,560,560,560,560,560,560,114,114,114, +561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561, +561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561, +561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561, +561,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +109, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,114,114,114,114, /* block 141 */ -552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, -552,552,552,552,552,552,552,552,552,552,552,552,552,552,109,553, -554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, -554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, -554,554,554,554,109,109,109,109,554,554,554,554,554,554,554,554, -555,556,556,556,556,556,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562, +562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562, +563,563,563,563,114,114,114,114,114,114,114,114,114,114,114,114, +564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, +564,565,564,564,564,564,564,564,564,564,565,114,114,114,114,114, +566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566, +566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566, +566,566,566,566,566,566,567,567,567,567,567,114,114,114,114,114, /* block 142 */ -557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557, -557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557, -557,557,557,557,557,557,557,557,558,558,558,558,558,558,558,558, -558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,558, -558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,558, -559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, -559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, -559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, +568,568,568,568,568,568,568,568,568,568,568,568,568,568,568,568, +568,568,568,568,568,568,568,568,568,568,568,568,568,568,114,569, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570, +570,570,570,570,114,114,114,114,570,570,570,570,570,570,570,570, +571,572,572,572,572,572,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 143 */ -560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560, -560,560,560,560,560,560,560,560,560,560,560,560,560,560,109,109, -561,561,561,561,561,561,561,561,561,561,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,574,574,574,574,574,574,574,574, +574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, +574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, +575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575, +575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575, +575,575,575,575,575,575,575,575,575,575,575,575,575,575,575,575, /* block 144 */ -562,562,562,562,562,562,109,109,562,109,562,562,562,562,562,562, -562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562, -562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562, -562,562,562,562,562,562,109,562,562,109,109,109,562,109,109,562, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563,563,563,563,563,563,109,564,565,565,565,565,565,565,565,565, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, +576,576,576,576,576,576,576,576,576,576,576,576,576,576,114,114, +577,577,577,577,577,577,577,577,577,577,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 145 */ -566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566, -566,566,566,566,566,566,567,567,567,567,567,567,109,109,109,568, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,109,109,109,109,109,570, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,114,114,114,114,114,114,114,114, +579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579, +579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579, +579,579,579,579,579,579,579,579,579,579,579,579,579,579,579,579, +579,579,579,579,114,114,114,114,114,114,114,114,114,114,114,580, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 146 */ -571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571, -571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,109,109,109,109,109,109,572,572, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, /* block 147 */ -573,574,574,574,109,574,574,109,109,109,109,109,574,574,574,574, -573,573,573,573,109,573,573,573,109,573,573,573,573,573,573,573, -573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, -573,573,573,573,109,109,109,109,574,574,574,109,109,109,109,574, -575,575,575,575,575,575,575,575,109,109,109,109,109,109,109,109, -576,576,576,576,576,576,576,576,576,109,109,109,109,109,109,109, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,578,578,579, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,114,114,114,114,114,114,114,114,114, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,114,114,114,114,114,114,114,114,114,114, +581,581,581,581,581,581,581,581,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 148 */ -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,109,109,109,581,581,581,581,581,581,581, +582,582,582,582,582,582,114,114,582,114,582,582,582,582,582,582, 582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582, -582,582,582,582,582,582,109,109,583,583,583,583,583,583,583,583, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,109,109,109,109,109,585,585,585,585,585,585,585,585, +582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582, +582,582,582,582,582,582,114,582,582,114,114,114,582,114,114,582, +583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583, +583,583,583,583,583,583,114,584,585,585,585,585,585,585,585,585, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,587,587,588,588,588,588,588,588,588, /* block 149 */ -586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, -586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, -586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, -586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, -586,586,586,586,586,586,586,586,586,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589, +589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,114, +114,114,114,114,114,114,114,590,590,590,590,590,590,590,590,590, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 150 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, -587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,109, +591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,591, +591,591,591,591,591,591,592,592,592,592,592,592,114,114,114,593, +594,594,594,594,594,594,594,594,594,594,594,594,594,594,594,594, +594,594,594,594,594,594,594,594,594,594,114,114,114,114,114,595, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 151 */ -588,589,588,590,590,590,590,590,590,590,590,590,590,590,590,590, -590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590, -590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590, -590,590,590,590,590,590,590,590,589,589,589,589,589,589,589,589, -589,589,589,589,589,589,589,591,591,591,591,591,591,591,109,109, -109,109,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,593,593,593,593,593,593,593,593,593,593, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596, +596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596, +597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,597, +597,597,597,597,597,597,597,597,114,114,114,114,114,114,597,597, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 152 */ -594,594,595,596,596,596,596,596,596,596,596,596,596,596,596,596, -596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596, -596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596, -595,595,595,594,594,594,594,595,595,594,594,597,597,598,597,597, -597,597,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,599, -599,599,599,599,599,599,599,599,599,109,109,109,109,109,109,109, -600,600,600,600,600,600,600,600,600,600,109,109,109,109,109,109, +598,599,599,599,114,599,599,114,114,114,114,114,599,599,599,599, +598,598,598,598,114,598,598,598,114,598,598,598,598,598,598,598, +598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598, +598,598,598,598,114,114,114,114,599,599,599,114,114,114,114,599, +600,600,600,600,600,600,600,600,114,114,114,114,114,114,114,114, +601,601,601,601,601,601,601,601,601,114,114,114,114,114,114,114, +602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,602, +602,602,602,602,602,602,602,602,602,602,602,602,602,603,603,604, /* block 153 */ -601,601,601,602,602,602,602,602,602,602,602,602,602,602,602,602, -602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,602, -602,602,602,602,602,602,602,601,601,601,601,601,603,601,601,601, -601,601,601,601,601,109,604,604,604,604,604,604,604,604,604,604, -605,605,605,605,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +605,605,605,605,605,605,605,605,605,605,605,605,605,605,605,605, +605,605,605,605,605,605,605,605,605,605,605,605,605,606,606,606, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +607,607,607,607,607,607,607,607,608,607,607,607,607,607,607,607, +607,607,607,607,607,607,607,607,607,607,607,607,607,607,607,607, +607,607,607,607,607,609,609,114,114,114,114,610,610,610,610,610, +611,611,611,611,611,611,611,114,114,114,114,114,114,114,114,114, /* block 154 */ -606,606,607,608,608,608,608,608,608,608,608,608,608,608,608,608, -608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,608, -608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,608, -608,608,608,607,607,607,606,606,606,606,606,606,606,606,606,607, -607,608,608,608,608,609,609,609,609,109,109,109,109,109,109,109, -610,610,610,610,610,610,610,610,610,610,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612, +612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612, +612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612, +612,612,612,612,612,612,114,114,114,613,613,613,613,613,613,613, +614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614, +614,614,614,614,614,614,114,114,615,615,615,615,615,615,615,615, +616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, +616,616,616,114,114,114,114,114,617,617,617,617,617,617,617,617, /* block 155 */ -611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611, -611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611, -611,611,611,611,611,611,611,611,611,611,611,612,613,612,613,613, -612,612,612,612,612,612,613,612,109,109,109,109,109,109,109,109, -614,614,614,614,614,614,614,614,614,614,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, +618,618,114,114,114,114,114,114,114,619,619,619,619,114,114,114, +114,114,114,114,114,114,114,114,114,620,620,620,620,620,620,620, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 156 */ -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, +621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621, +621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621, +621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621, +621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621, +621,621,621,621,621,621,621,621,621,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 157 */ -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615, -615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,622, +622,622,622,622,622,622,622,622,622,622,622,622,622,622,622,114, /* block 158 */ -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,109,109,109,109,109,109,109,109,109,109,109,109,109, -617,617,617,617,109,109,109,109,109,109,109,109,109,109,109,109, +623,624,623,625,625,625,625,625,625,625,625,625,625,625,625,625, +625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625, +625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625, +625,625,625,625,625,625,625,625,624,624,624,624,624,624,624,624, +624,624,624,624,624,624,624,626,626,626,626,626,626,626,114,114, +114,114,627,627,627,627,627,627,627,627,627,627,627,627,627,627, +627,627,627,627,627,627,628,628,628,628,628,628,628,628,628,628, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,624, /* block 159 */ -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, +629,629,630,631,631,631,631,631,631,631,631,631,631,631,631,631, +631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631, +631,631,631,631,631,631,631,631,631,631,631,631,631,631,631,631, +630,630,630,629,629,629,629,630,630,629,629,632,632,633,632,632, +632,632,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634, +634,634,634,634,634,634,634,634,634,114,114,114,114,114,114,114, +635,635,635,635,635,635,635,635,635,635,114,114,114,114,114,114, /* block 160 */ -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618, -618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +636,636,636,637,637,637,637,637,637,637,637,637,637,637,637,637, +637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637, +637,637,637,637,637,637,637,636,636,636,636,636,638,636,636,636, +636,636,636,636,636,114,639,639,639,639,639,639,639,639,639,639, +640,640,640,640,114,114,114,114,114,114,114,114,114,114,114,114, +641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641, +641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641, +641,641,641,642,643,643,641,114,114,114,114,114,114,114,114,114, /* block 161 */ -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, +644,644,645,646,646,646,646,646,646,646,646,646,646,646,646,646, +646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646, +646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646, +646,646,646,645,645,645,644,644,644,644,644,644,644,644,644,645, +645,646,646,646,646,647,647,647,647,114,114,114,114,647,114,114, +648,648,648,648,648,648,648,648,648,648,646,114,114,114,114,114, +114,649,649,649,649,649,649,649,649,649,649,649,649,649,649,649, +649,649,649,649,649,114,114,114,114,114,114,114,114,114,114,114, /* block 162 */ -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,488,488,488,488,488,488,488, -488,488,488,488,488,488,488,488,488,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +650,650,650,650,650,650,650,650,650,650,650,650,650,650,650,650, +650,650,114,650,650,650,650,650,650,650,650,650,650,650,650,650, +650,650,650,650,650,650,650,650,650,650,650,650,651,651,651,652, +652,652,651,651,652,651,652,652,653,653,653,653,653,653,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 163 */ -619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619, -619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619, -619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619, -619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619, -619,619,619,619,619,109,109,109,109,109,109,109,109,109,109,109, -619,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620, -620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620, -620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, +654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, +654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,655, +656,656,656,655,655,655,655,655,655,655,655,114,114,114,114,114, +657,657,657,657,657,657,657,657,657,657,114,114,114,114,114,114, /* block 164 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,621, -621,621,621,622,622,622,622,622,622,622,622,622,622,622,622,622, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,658,659,659,114,660,660,660,660,660,660,660,660,114,114,660, +660,114,114,660,660,660,660,660,660,660,660,660,660,660,660,660, +660,660,660,660,660,660,660,660,660,114,660,660,660,660,660,660, +660,114,660,660,114,660,660,660,660,660,114,114,658,660,661,659, +658,659,659,659,659,114,114,659,659,114,114,659,659,659,114,114, +114,114,114,114,114,114,114,661,114,114,114,114,114,660,660,660, +660,660,659,659,114,114,658,658,658,658,658,658,658,114,114,114, +658,658,658,658,658,114,114,114,114,114,114,114,114,114,114,114, /* block 165 */ -469,467,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662, +662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662, +662,662,662,662,662,662,662,662,662,662,662,662,662,662,662,662, +663,664,664,665,665,665,665,665,665,664,665,664,664,663,664,665, +665,664,665,665,662,662,666,662,114,114,114,114,114,114,114,114, +667,667,667,667,667,667,667,667,667,667,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 166 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109, +668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668, +668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668, +668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,669, +670,670,671,671,671,671,114,114,670,670,670,670,671,671,670,671, +671,672,672,672,672,672,672,672,672,672,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 167 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19,109,109, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19,623,395,104,104,104, 19, 19, 19,395,623,623, -623,623,623, 22, 22, 22, 22, 22, 22, 22, 22,104,104,104,104,104, +673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, +673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, +673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, +674,674,674,675,675,675,675,675,675,675,675,674,674,675,674,675, +675,676,676,676,673,114,114,114,114,114,114,114,114,114,114,114, +677,677,677,677,677,677,677,677,677,677,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 168 */ -104,104,104, 19, 19,104,104,104,104,104,104,104, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,104,104,104,104, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,679,680,679,680,680, +679,679,679,679,679,679,680,679,114,114,114,114,114,114,114,114, +681,681,681,681,681,681,681,681,681,681,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 169 */ -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,624,624,624,545,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, +682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, +683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,683, +683,683,683,683,683,683,683,683,683,683,683,683,683,683,683,683, +684,684,684,684,684,684,684,684,684,684,685,685,685,685,685,685, +685,685,685,114,114,114,114,114,114,114,114,114,114,114,114,686, /* block 170 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109,109,109, - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687, +687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687, +687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687, +687,687,687,687,687,687,687,687,687,114,114,114,114,114,114,114, /* block 171 */ -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,429,429, -429,429,429,429,429,109,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, /* block 172 */ -428,428,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,428,109,428,428, -109,109,428,109,109,428,428,109,109,428,428,428,428,109,428,428, -428,428,428,428,428,428,429,429,429,429,109,429,109,429,429,429, -429,429,429,429,109,429,429,429,429,429,429,429,429,429,429,429, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, +688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 173 */ -429,429,429,429,428,428,109,428,428,428,428,109,109,428,428,428, -428,428,428,428,428,109,428,428,428,428,428,428,428,109,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,428,428,109,428,428,428,428,109, -428,428,428,428,428,109,428,109,109,109,428,428,428,428,428,428, -428,109,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,114, +690,690,690,690,690,114,114,114,114,114,114,114,114,114,114,114, /* block 174 */ -428,428,428,428,428,428,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, /* block 175 */ -429,429,429,429,429,429,429,429,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 176 */ -428,428,428,428,428,428,428,428,428,428,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,109,109,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428, 8,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429, 8,429,429,429,429, -429,429,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428, 8,429,429,429,429, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, /* block 177 */ -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429, 8,429,429,429,429,429,429,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428, 8,429,429,429,429,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, 8, -429,429,429,429,429,429,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, 8, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,497,497,497,497,497,497,497, +497,497,497,497,497,497,497,497,497,114,114,114,114,114,114,114, +692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692, +692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,114, +693,693,693,693,693,693,693,693,693,693,114,114,114,114,694,694, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 178 */ -429,429,429,429,429,429,429,429,429, 8,429,429,429,429,429,429, -428,428,428,428,428,428,428,428,428,428,428,428,428,428,428,428, -428,428,428,428,428,428,428,428,428, 8,429,429,429,429,429,429, -429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, -429,429,429, 8,429,429,429,429,429,429,428,429,109,109, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695, +695,695,695,695,695,695,695,695,695,695,695,695,695,695,114,114, +696,696,696,696,696,697,114,114,114,114,114,114,114,114,114,114, /* block 179 */ -191,191,191,191,109,191,191,191,191,191,191,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, -109,191,191,109,191,109,109,191,109,191,191,191,191,191,191,191, -191,191,191,109,191,191,191,191,109,191,109,191,109,109,109,109, -109,109,191,109,109,109,109,191,109,191,109,191,109,191,191,191, -109,191,191,109,191,109,109,191,109,191,109,191,109,191,109,191, -109,191,191,109,191,109,109,191,191,191,191,109,191,191,191,191, -191,191,191,109,191,191,191,191,109,191,191,191,191,109,191,109, +698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, +698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, +698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, +699,699,699,699,699,699,699,700,700,700,700,700,701,701,701,701, +702,702,702,702,700,701,114,114,114,114,114,114,114,114,114,114, +703,703,703,703,703,703,703,703,703,703,114,704,704,704,704,704, +704,704,114,698,698,698,698,698,698,698,698,698,698,698,698,698, +698,698,698,698,698,698,698,698,114,114,114,114,114,698,698,698, /* block 180 */ -191,191,191,191,191,191,191,191,191,191,109,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,109,109,109,109, -109,191,191,191,109,191,191,191,191,191,109,191,191,191,191,191, -191,191,191,191,191,191,191,191,191,191,191,191,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -186,186,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 181 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,705,114,114,114,114,114,114,114,114,114,114,114, +705,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706, +706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706, +706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,114, /* block 182 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109, -109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109, -109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,707, +707,707,707,708,708,708,708,708,708,708,708,708,708,708,708,708, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 183 */ - 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +478,476,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 184 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,625,625,625,625,625,625,625,625,625,625, -625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, +709,709,709,709,709,709,709,709,709,709,709,114,114,114,114,114, +709,709,709,709,709,709,709,709,709,709,709,709,709,114,114,114, /* block 185 */ -626, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109, - 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109, - 19, 19,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +709,709,709,709,709,709,709,709,709,114,114,114,114,114,114,114, +709,709,709,709,709,709,709,709,709,709,114,114,710,711,711,712, + 22, 22, 22, 22,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 186 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, - 19, 19, 19, 19, 19, 19,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114, /* block 187 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19,109, 19, 19, 19, 19, 19,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19,713,405,109,109,109, 19, 19, 19,405,713,713, +713,713,713, 22, 22, 22, 22, 22, 22, 22, 22,109,109,109,109,109, /* block 188 */ +109,109,109, 19, 19,109,109,109,109,109,109,109, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109, - 19,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 189 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19,109, 19, 19, 19, 19,109,109,109, +559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, +559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, +559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, +559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559, +559,559,714,714,714,559,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 190 */ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 191 */ -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109, 19, 19, 19, 19, 19, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,438,438, +438,438,438,438,438,114,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, /* block 192 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19,109,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +437,437,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,437,114,437,437, +114,114,437,114,114,437,437,114,114,437,437,437,437,114,437,437, +437,437,437,437,437,437,438,438,438,438,114,438,114,438,438,438, +438,438,438,438,114,438,438,438,438,438,438,438,438,438,438,438, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, /* block 193 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +438,438,438,438,437,437,114,437,437,437,437,114,114,437,437,437, +437,437,437,437,437,114,437,437,437,437,437,437,437,114,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,437,437,114,437,437,437,437,114, +437,437,437,437,437,114,437,114,114,114,437,437,437,437,437,437, +437,114,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, /* block 194 */ - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109, +437,437,437,437,437,437,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, /* block 195 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +438,438,438,438,438,438,438,438,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, /* block 196 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,109,109,109,109,109,109,109,109,109,109,109, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, +437,437,437,437,437,437,437,437,437,437,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,114,114,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437, 8,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438, 8,438,438,438,438, +438,438,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437, 8,438,438,438,438, /* block 197 */ -475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475, -475,475,475,475,475,475,475,475,475,475,475,475,475,475,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438, 8,438,438,438,438,438,438,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437, 8,438,438,438,438,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, 8, +438,438,438,438,438,438,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, 8, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, /* block 198 */ -426, 22,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, +438,438,438,438,438,438,438,438,438, 8,438,438,438,438,438,438, +437,437,437,437,437,437,437,437,437,437,437,437,437,437,437,437, +437,437,437,437,437,437,437,437,437, 8,438,438,438,438,438,438, +438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, +438,438,438, 8,438,438,438,438,438,438,437,438,114,114, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, /* block 199 */ -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, /* block 200 */ -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,114,114,716,716,716,716,716,716,716,716,716, +717,717,717,717,717,717,717,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, /* block 201 */ -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, +199,199,199,199,114,199,199,199,199,199,199,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,199,199,199,199, +114,199,199,114,199,114,114,199,114,199,199,199,199,199,199,199, +199,199,199,114,199,199,199,199,114,199,114,199,114,114,114,114, +114,114,199,114,114,114,114,199,114,199,114,199,114,199,199,199, +114,199,199,114,199,114,114,199,114,199,114,199,114,199,114,199, +114,199,199,114,199,114,114,199,199,199,199,114,199,199,199,199, +199,199,199,114,199,199,199,199,114,199,199,199,199,114,199,114, /* block 202 */ -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,109,109, +199,199,199,199,199,199,199,199,199,199,114,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,114,114,114,114, +114,199,199,199,114,199,199,199,199,199,114,199,199,199,199,199, +199,199,199,199,199,199,199,199,199,199,199,199,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +194,194,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 203 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + +/* block 204 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, +114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114, + +/* block 205 */ + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + +/* block 206 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,718,718,718,718,718,718,718,718,718,718, +718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,718, + +/* block 207 */ +719, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114, + 19, 19,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 208 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114, + +/* block 209 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, +114,114,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114, + +/* block 210 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, + +/* block 211 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114, 19, 19, 19, 19, 19, + +/* block 212 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + +/* block 213 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19,114,114, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + +/* block 214 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114, + 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 215 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 216 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 217 */ + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + +/* block 218 */ + 19, 19, 19, 19, 19, 19, 19, 19,114,114,114,114,114,114,114,114, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 219 */ +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 220 */ +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,114,114,114,114,114,114,114,114,114,114,114, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, + +/* block 221 */ +484,484,484,484,484,484,484,484,484,484,484,484,484,484,484,484, +484,484,484,484,484,484,484,484,484,484,484,484,484,484,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, +114,114,114,114,114,114,114,114,114,114,114,114,114,114,114,114, + +/* block 222 */ +436, 22,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + +/* block 223 */ +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, + +/* block 224 */ +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, + +/* block 225 */ +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, + +/* block 226 */ +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,114,114, }; diff --git a/pcre/pcrecpp.cc b/pcre/pcrecpp.cc index c0ba9ca14e1..c595cbcab5c 100644 --- a/pcre/pcrecpp.cc +++ b/pcre/pcrecpp.cc @@ -511,7 +511,7 @@ int RE::TryMatch(const StringPiece& text, return 0; } - pcre_extra extra = { 0, 0, 0, 0, 0, 0 }; + pcre_extra extra = { 0, 0, 0, 0, 0, 0, 0, 0 }; if (options_.match_limit() > 0) { extra.flags |= PCRE_EXTRA_MATCH_LIMIT; extra.match_limit = options_.match_limit(); @@ -660,6 +660,8 @@ int RE::NumberOfCapturingGroups() const { /***** Parsers for various types *****/ bool Arg::parse_null(const char* str, int n, void* dest) { + (void)str; + (void)n; // We fail if somebody asked us to store into a non-NULL void* pointer return (dest == NULL); } diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c index 3e8d05dc8ad..4f7fa38491a 100644 --- a/pcre/pcregrep.c +++ b/pcre/pcregrep.c @@ -455,7 +455,7 @@ Arguments: s pattern string to add after if not NULL points to item to insert after -Returns: new pattern block +Returns: new pattern block or NULL on error */ static patstr * @@ -471,6 +471,7 @@ if (strlen(s) > MAXPATLEN) { fprintf(stderr, "pcregrep: pattern is too long (limit is %d bytes)\n", MAXPATLEN); + free(p); return NULL; } p->next = NULL; @@ -2549,7 +2550,11 @@ while (fgets(buffer, PATBUFSIZE, f) != NULL) afterwards, as a precaution against any later code trying to use it. */ *patlastptr = add_pattern(buffer, *patlastptr); - if (*patlastptr == NULL) return FALSE; + if (*patlastptr == NULL) + { + if (f != stdin) fclose(f); + return FALSE; + } if (*patptr == NULL) *patptr = *patlastptr; /* This loop is needed because compiling a "pattern" when -F is set may add @@ -2561,7 +2566,10 @@ while (fgets(buffer, PATBUFSIZE, f) != NULL) { if (!compile_pattern(*patlastptr, pcre_options, popts, TRUE, filename, linenumber)) + { + if (f != stdin) fclose(f); return FALSE; + } (*patlastptr)->string = NULL; /* Insurance */ if ((*patlastptr)->next == NULL) break; *patlastptr = (*patlastptr)->next; @@ -2962,8 +2970,8 @@ if (locale == NULL) locale_from = "LC_CTYPE"; } -/* If a locale has been provided, set it, and generate the tables the PCRE -needs. Otherwise, pcretables==NULL, which causes the use of default tables. */ +/* If a locale is set, use it to generate the tables the PCRE needs. Otherwise, +pcretables==NULL, which causes the use of default tables. */ if (locale != NULL) { @@ -2971,7 +2979,7 @@ if (locale != NULL) { fprintf(stderr, "pcregrep: Failed to set locale %s (obtained from %s)\n", locale, locale_from); - return 2; + goto EXIT2; } pcretables = pcre_maketables(); } @@ -2986,7 +2994,7 @@ if (colour_option != NULL && strcmp(colour_option, "never") != 0) { fprintf(stderr, "pcregrep: Unknown colour setting \"%s\"\n", colour_option); - return 2; + goto EXIT2; } if (do_colour) { @@ -3026,7 +3034,7 @@ else if (strcmp(newline, "anycrlf") == 0 || strcmp(newline, "ANYCRLF") == 0) else { fprintf(stderr, "pcregrep: Invalid newline specifier \"%s\"\n", newline); - return 2; + goto EXIT2; } /* Interpret the text values for -d and -D */ @@ -3039,7 +3047,7 @@ if (dee_option != NULL) else { fprintf(stderr, "pcregrep: Invalid value \"%s\" for -d\n", dee_option); - return 2; + goto EXIT2; } } @@ -3050,7 +3058,7 @@ if (DEE_option != NULL) else { fprintf(stderr, "pcregrep: Invalid value \"%s\" for -D\n", DEE_option); - return 2; + goto EXIT2; } } @@ -3251,7 +3259,8 @@ EXIT: if (jit_stack != NULL) pcre_jit_stack_free(jit_stack); #endif -if (main_buffer != NULL) free(main_buffer); +free(main_buffer); +free((void *)pcretables); free_pattern_chain(patterns); free_pattern_chain(include_patterns); diff --git a/pcre/pcreposix.c b/pcre/pcreposix.c index ed506197a53..f024423b634 100644 --- a/pcre/pcreposix.c +++ b/pcre/pcreposix.c @@ -172,7 +172,8 @@ static const int eint[] = { REG_BADPAT, /* invalid range in character class */ REG_BADPAT, /* group name must start with a non-digit */ /* 85 */ - REG_BADPAT /* parentheses too deeply nested (stack check) */ + REG_BADPAT, /* parentheses too deeply nested (stack check) */ + REG_BADPAT /* missing digits in \x{} or \o{} */ }; /* Table of texts corresponding to POSIX error codes */ diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1 index 7b36360d044..123e3d3cfd4 100644 --- a/pcre/testdata/testinput1 +++ b/pcre/testdata/testinput1 @@ -111,7 +111,7 @@ bababbc babababc -/^\ca\cA\c[\c{\c:/ +/^\ca\cA\c[;\c:/ \x01\x01\e;z /^[ab\]cde]/ @@ -4937,6 +4937,12 @@ however, we need the complication for Perl. ---/ /((?(R1)a+|(?1)b))/ aaaabcde + +/((?(R)a|(?1)))*/ + aaa + +/((?(R)a|(?1)))+/ + aaa /a(*:any name)/K @@ -5666,4 +5672,52 @@ AbcdCBefgBhiBqz /(a\Kb)*/+ ababc +/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ + acb + +'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + +'\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + +/^\w+(?>\s*)(?<=\w)/ + test test + +/(?Pa)(?Pb)/gJ + abbaba + +/(?Pa)(?Pb)(?P=same)/gJ + abbaba + +/(?P=same)?(?Pa)(?Pb)/gJ + abbaba + +/(?:(?P=same)?(?:(?Pa)|(?Pb))(?P=same))+/gJ + bbbaaabaabb + +/(?:(?P=same)?(?:(?P=same)(?Pa)(?P=same)|(?P=same)?(?Pb)(?P=same)){2}(?P=same)(?Pc)(?P=same)){2}(?Pz)?/gJ + bbbaaaccccaaabbbcc + +/(?Pa)?(?Pb)?(?()c|d)*l/ + acl + bdl + adl + bcl + +/\sabc/ + \x{0b}abc + +/[\Qa]\E]+/ + aa]] + +/[\Q]a\E]+/ + aa]] + /-- End of testinput1 --/ diff --git a/pcre/testdata/testinput11 b/pcre/testdata/testinput11 index 391ada7aa8c..7e8e54221d4 100644 --- a/pcre/testdata/testinput11 +++ b/pcre/testdata/testinput11 @@ -132,4 +132,6 @@ is required for these tests. --/ /abc(d|e)(*THEN)x(123(*THEN)4|567(b|q)(*THEN)xx)/B +/(((a\2)|(a*)\g<-1>))*a?/B + /-- End of testinput11 --/ diff --git a/pcre/testdata/testinput16 b/pcre/testdata/testinput16 index e7a05ae0d45..15419e63fa6 100644 --- a/pcre/testdata/testinput16 +++ b/pcre/testdata/testinput16 @@ -32,4 +32,10 @@ /[[:blank:]]/WBZ +/\x{212a}+/i8SI + KKkk\x{212a} + +/s+/i8SI + SSss\x{17f} + /-- End of testinput16 --/ diff --git a/pcre/testdata/testinput19 b/pcre/testdata/testinput19 index 00d80203f00..ce45afcb595 100644 --- a/pcre/testdata/testinput19 +++ b/pcre/testdata/testinput19 @@ -19,4 +19,10 @@ /[[:blank:]]/WBZ +/\x{212a}+/i8SI + KKkk\x{212a} + +/s+/i8SI + SSss\x{17f} + /-- End of testinput19 --/ diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2 index da6e61499cd..c6816bf322c 100644 --- a/pcre/testdata/testinput2 +++ b/pcre/testdata/testinput2 @@ -4035,6 +4035,8 @@ backtracking verbs. --/ /(?(R&6yh)abc)/ +/(((a\2)|(a*)\g<-1>))*a?/BZ + /-- Test the ugly "start or end of word" compatibility syntax --/ /[[:<:]]red[[:>:]]/BZ @@ -4062,4 +4064,18 @@ backtracking verbs. --/ /(((((a)))))/Q +/^\w+(?>\s*)(?<=\w)/BZ + +/\othing/ + +/\o{}/ + +/\o{whatever}/ + +/\xthing/ + +/\x{}/ + +/\x{whatever}/ + /-- End of testinput2 --/ diff --git a/pcre/testdata/testinput6 b/pcre/testdata/testinput6 index 7a6a53f1473..82c3ed5c772 100644 --- a/pcre/testdata/testinput6 +++ b/pcre/testdata/testinput6 @@ -421,8 +421,8 @@ /^[\p{Arabic}]/8 \x{06e9} \x{060b} - \x{061c} ** Failers + \x{061c} X\x{06e9} /^[\P{Yi}]/8 @@ -1493,4 +1493,7 @@ /[q-u]+/8iW Ss\x{17f} +/^s?c/mi8 + scat + /-- End of testinput6 --/ diff --git a/pcre/testdata/testinput7 b/pcre/testdata/testinput7 index 6bd05864411..7a66025434b 100644 --- a/pcre/testdata/testinput7 +++ b/pcre/testdata/testinput7 @@ -835,4 +835,7 @@ of case for anything other than the ASCII letters. --/ /[Q-U]+/8iWBZ +/^s?c/mi8I + scat + /-- End of testinput7 --/ diff --git a/pcre/testdata/testinput8 b/pcre/testdata/testinput8 index bb2747b120d..06334cd36e5 100644 --- a/pcre/testdata/testinput8 +++ b/pcre/testdata/testinput8 @@ -4831,4 +4831,10 @@ /[ab]{2,}?/ aaaa +'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + /-- End of testinput8 --/ diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1 index 4dafc0496ab..5e719002ed6 100644 --- a/pcre/testdata/testoutput1 +++ b/pcre/testdata/testoutput1 @@ -223,7 +223,7 @@ No match babababc No match -/^\ca\cA\c[\c{\c:/ +/^\ca\cA\c[;\c:/ \x01\x01\e;z 0: \x01\x01\x1b;z @@ -8234,6 +8234,16 @@ MK: M aaaabcde 0: aaaab 1: aaaab + +/((?(R)a|(?1)))*/ + aaa + 0: aaa + 1: a + +/((?(R)a|(?1)))+/ + aaa + 0: aaa + 1: a /a(*:any name)/K @@ -9313,4 +9323,92 @@ No match 0+ c 1: ab +/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ + acb +No match + +'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + +'\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + 1: AFTER + 2: + +/^\w+(?>\s*)(?<=\w)/ + test test + 0: tes + +/(?Pa)(?Pb)/gJ + abbaba + 0: ab + 1: a + 2: b + 0: ab + 1: a + 2: b + +/(?Pa)(?Pb)(?P=same)/gJ + abbaba + 0: aba + 1: a + 2: b + +/(?P=same)?(?Pa)(?Pb)/gJ + abbaba + 0: ab + 1: a + 2: b + 0: ab + 1: a + 2: b + +/(?:(?P=same)?(?:(?Pa)|(?Pb))(?P=same))+/gJ + bbbaaabaabb + 0: bbbaaaba + 1: a + 2: b + 0: bb + 1: + 2: b + +/(?:(?P=same)?(?:(?P=same)(?Pa)(?P=same)|(?P=same)?(?Pb)(?P=same)){2}(?P=same)(?Pc)(?P=same)){2}(?Pz)?/gJ + bbbaaaccccaaabbbcc +No match + +/(?Pa)?(?Pb)?(?()c|d)*l/ + acl + 0: acl + 1: a + bdl + 0: bdl + 1: + 2: b + adl + 0: dl + bcl + 0: l + +/\sabc/ + \x{0b}abc + 0: \x0babc + +/[\Qa]\E]+/ + aa]] + 0: aa]] + +/[\Q]a\E]+/ + aa]] + 0: aa]] + /-- End of testinput1 --/ diff --git a/pcre/testdata/testoutput11-16 b/pcre/testdata/testoutput11-16 index f1ad8887b4d..a1db3f34225 100644 --- a/pcre/testdata/testoutput11-16 +++ b/pcre/testdata/testoutput11-16 @@ -709,4 +709,28 @@ Memory allocation (code space): 14 62 End ------------------------------------------------------------------ +/(((a\2)|(a*)\g<-1>))*a?/B +------------------------------------------------------------------ + 0 39 Bra + 2 Brazero + 3 32 SCBra 1 + 6 27 Once + 8 12 CBra 2 + 11 7 CBra 3 + 14 a + 16 \2 + 18 7 Ket + 20 11 Alt + 22 5 CBra 4 + 25 a* + 27 5 Ket + 29 22 Recurse + 31 23 Ket + 33 27 Ket + 35 32 KetRmax + 37 a?+ + 39 39 Ket + 41 End +------------------------------------------------------------------ + /-- End of testinput11 --/ diff --git a/pcre/testdata/testoutput11-32 b/pcre/testdata/testoutput11-32 index 266e55d0672..7b7b030fdca 100644 --- a/pcre/testdata/testoutput11-32 +++ b/pcre/testdata/testoutput11-32 @@ -709,4 +709,28 @@ Memory allocation (code space): 28 62 End ------------------------------------------------------------------ +/(((a\2)|(a*)\g<-1>))*a?/B +------------------------------------------------------------------ + 0 39 Bra + 2 Brazero + 3 32 SCBra 1 + 6 27 Once + 8 12 CBra 2 + 11 7 CBra 3 + 14 a + 16 \2 + 18 7 Ket + 20 11 Alt + 22 5 CBra 4 + 25 a* + 27 5 Ket + 29 22 Recurse + 31 23 Ket + 33 27 Ket + 35 32 KetRmax + 37 a?+ + 39 39 Ket + 41 End +------------------------------------------------------------------ + /-- End of testinput11 --/ diff --git a/pcre/testdata/testoutput11-8 b/pcre/testdata/testoutput11-8 index d4a21334e36..f5ec652af8c 100644 --- a/pcre/testdata/testoutput11-8 +++ b/pcre/testdata/testoutput11-8 @@ -709,4 +709,28 @@ Memory allocation (code space): 10 76 End ------------------------------------------------------------------ +/(((a\2)|(a*)\g<-1>))*a?/B +------------------------------------------------------------------ + 0 57 Bra + 3 Brazero + 4 48 SCBra 1 + 9 40 Once + 12 18 CBra 2 + 17 10 CBra 3 + 22 a + 24 \2 + 27 10 Ket + 30 16 Alt + 33 7 CBra 4 + 38 a* + 40 7 Ket + 43 33 Recurse + 46 34 Ket + 49 40 Ket + 52 48 KetRmax + 55 a?+ + 57 57 Ket + 60 End +------------------------------------------------------------------ + /-- End of testinput11 --/ diff --git a/pcre/testdata/testoutput15 b/pcre/testdata/testoutput15 index 5af369d06d9..bad2807c2fd 100644 --- a/pcre/testdata/testoutput15 +++ b/pcre/testdata/testoutput15 @@ -871,7 +871,7 @@ Options: utf No first char Need char = 'x' Subject length lower bound = 5 -Starting chars: \x09 \x0a \x0c \x0d \x20 \xc2 +Starting chars: \x09 \x0a \x0b \x0c \x0d \x20 \xc2 AB\x{85}xxx\x{a0}XYZ 0: \x{85}xxx\x{a0} AB\x{a0}xxx\x{85}XYZ @@ -883,15 +883,15 @@ Options: utf No first char Need char = ' ' Subject length lower bound = 3 -Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0b \x0e - \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d - \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e - f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \xc0 \xc1 \xc2 \xc3 - \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 - \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 \xe1 - \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef \xf0 - \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff +Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f + \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e + \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C + D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h + i j k l m n o p q r s t u v w x y z { | } ~ \x7f \xc0 \xc1 \xc2 \xc3 \xc4 + \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 + \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 \xe1 \xe2 + \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef \xf0 \xf1 + \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe \xff \x{a2} \x{84} 0: \x{a2} \x{84} A Z diff --git a/pcre/testdata/testoutput16 b/pcre/testdata/testoutput16 index 63e9eb06ae6..fd184cdbeee 100644 --- a/pcre/testdata/testoutput16 +++ b/pcre/testdata/testoutput16 @@ -118,4 +118,24 @@ Starting chars: \x0a \x0b \x0c \x0d \x85 End ------------------------------------------------------------------ +/\x{212a}+/i8SI +Capturing subpattern count = 0 +Options: caseless utf +No first char +No need char +Subject length lower bound = 1 +Starting chars: K k \xe2 + KKkk\x{212a} + 0: KKkk\x{212a} + +/s+/i8SI +Capturing subpattern count = 0 +Options: caseless utf +No first char +No need char +Subject length lower bound = 1 +Starting chars: S s \xc5 + SSss\x{17f} + 0: SSss\x{17f} + /-- End of testinput16 --/ diff --git a/pcre/testdata/testoutput18-16 b/pcre/testdata/testoutput18-16 index a1962057050..1ef87047d64 100644 --- a/pcre/testdata/testoutput18-16 +++ b/pcre/testdata/testoutput18-16 @@ -752,7 +752,7 @@ Options: utf No first char Need char = 'x' Subject length lower bound = 5 -Starting chars: \x09 \x0a \x0c \x0d \x20 \x85 \xa0 +Starting chars: \x09 \x0a \x0b \x0c \x0d \x20 \x85 \xa0 AB\x{85}xxx\x{a0}XYZ 0: \x{85}xxx\x{a0} AB\x{a0}xxx\x{85}XYZ @@ -764,20 +764,20 @@ Options: utf No first char Need char = ' ' Subject length lower bound = 3 -Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0b \x0e - \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d - \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e - f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83 - \x84 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 - \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa1 \xa2 \xa3 - \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 - \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 - \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 - \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf - \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee - \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd - \xfe \xff +Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f + \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e + \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C + D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h + i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 + \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 + \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa1 \xa2 \xa3 \xa4 + \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 \xb3 + \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 \xc2 + \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 + \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 + \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef + \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe + \xff \x{a2} \x{84} 0: \x{a2} \x{84} A Z diff --git a/pcre/testdata/testoutput18-32 b/pcre/testdata/testoutput18-32 index 1525994db98..622ba64aafc 100644 --- a/pcre/testdata/testoutput18-32 +++ b/pcre/testdata/testoutput18-32 @@ -749,7 +749,7 @@ Options: utf No first char Need char = 'x' Subject length lower bound = 5 -Starting chars: \x09 \x0a \x0c \x0d \x20 \x85 \xa0 +Starting chars: \x09 \x0a \x0b \x0c \x0d \x20 \x85 \xa0 AB\x{85}xxx\x{a0}XYZ 0: \x{85}xxx\x{a0} AB\x{a0}xxx\x{85}XYZ @@ -761,20 +761,20 @@ Options: utf No first char Need char = ' ' Subject length lower bound = 3 -Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0b \x0e - \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d - \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ - A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e - f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83 - \x84 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 - \x94 \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa1 \xa2 \xa3 - \xa4 \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 - \xb3 \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 - \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 - \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf - \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee - \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd - \xfe \xff +Starting chars: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f + \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e + \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C + D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h + i j k l m n o p q r s t u v w x y z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 + \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 + \x95 \x96 \x97 \x98 \x99 \x9a \x9b \x9c \x9d \x9e \x9f \xa1 \xa2 \xa3 \xa4 + \xa5 \xa6 \xa7 \xa8 \xa9 \xaa \xab \xac \xad \xae \xaf \xb0 \xb1 \xb2 \xb3 + \xb4 \xb5 \xb6 \xb7 \xb8 \xb9 \xba \xbb \xbc \xbd \xbe \xbf \xc0 \xc1 \xc2 + \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 + \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf \xe0 + \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee \xef + \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd \xfe + \xff \x{a2} \x{84} 0: \x{a2} \x{84} A Z diff --git a/pcre/testdata/testoutput19 b/pcre/testdata/testoutput19 index 21fe677900b..eb8a8f6cd34 100644 --- a/pcre/testdata/testoutput19 +++ b/pcre/testdata/testoutput19 @@ -85,4 +85,24 @@ No starting char list End ------------------------------------------------------------------ +/\x{212a}+/i8SI +Capturing subpattern count = 0 +Options: caseless utf +No first char +No need char +Subject length lower bound = 1 +Starting chars: K k \xff + KKkk\x{212a} + 0: KKkk\x{212a} + +/s+/i8SI +Capturing subpattern count = 0 +Options: caseless utf +No first char +No need char +Subject length lower bound = 1 +Starting chars: S s \xff + SSss\x{17f} + 0: SSss\x{17f} + /-- End of testinput19 --/ diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2 index b6da7df187e..1e87026cc6d 100644 --- a/pcre/testdata/testoutput2 +++ b/pcre/testdata/testoutput2 @@ -5821,13 +5821,13 @@ No match No match /a{11111111111111111111}/I -Failed: number too big in {} quantifier at offset 22 +Failed: number too big in {} quantifier at offset 8 /(){64294967295}/I -Failed: number too big in {} quantifier at offset 14 +Failed: number too big in {} quantifier at offset 9 /(){2,4294967295}/I -Failed: number too big in {} quantifier at offset 15 +Failed: number too big in {} quantifier at offset 11 "(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I Capturing subpattern count = 1 @@ -14093,6 +14093,30 @@ Failed: malformed number or name after (?( at offset 4 /(?(R&6yh)abc)/ Failed: group name must start with a non-digit at offset 5 +/(((a\2)|(a*)\g<-1>))*a?/BZ +------------------------------------------------------------------ + Bra + Brazero + SCBra 1 + Once + CBra 2 + CBra 3 + a + \2 + Ket + Alt + CBra 4 + a* + Ket + Recurse + Ket + Ket + KetRmax + a?+ + Ket + End +------------------------------------------------------------------ + /-- Test the ugly "start or end of word" compatibility syntax --/ /[[:<:]]red[[:>:]]/BZ @@ -14149,4 +14173,37 @@ Failed: parentheses are too deeply nested (stack check) at offset 0 /(((((a)))))/Q ** Missing 0 or 1 after /Q +/^\w+(?>\s*)(?<=\w)/BZ +------------------------------------------------------------------ + Bra + ^ + \w+ + Once_NC + \s*+ + Ket + AssertB + Reverse + \w + Ket + Ket + End +------------------------------------------------------------------ + +/\othing/ +Failed: missing opening brace after \o at offset 1 + +/\o{}/ +Failed: digits missing in \x{} or \o{} at offset 1 + +/\o{whatever}/ +Failed: non-octal character in \o{} (closing brace missing?) at offset 3 + +/\xthing/ + +/\x{}/ +Failed: digits missing in \x{} or \o{} at offset 3 + +/\x{whatever}/ +Failed: non-hex character in \x{} (closing brace missing?) at offset 3 + /-- End of testinput2 --/ diff --git a/pcre/testdata/testoutput6 b/pcre/testdata/testoutput6 index f355e601383..a990ba13eb8 100644 --- a/pcre/testdata/testoutput6 +++ b/pcre/testdata/testoutput6 @@ -719,9 +719,9 @@ No match 0: \x{6e9} \x{060b} 0: \x{60b} - \x{061c} - 0: \x{61c} ** Failers +No match + \x{061c} No match X\x{06e9} No match @@ -2457,4 +2457,8 @@ No match Ss\x{17f} 0: Ss\x{17f} +/^s?c/mi8 + scat + 0: sc + /-- End of testinput6 --/ diff --git a/pcre/testdata/testoutput7 b/pcre/testdata/testoutput7 index c64e0499421..ee46bdbb5a1 100644 --- a/pcre/testdata/testoutput7 +++ b/pcre/testdata/testoutput7 @@ -2287,4 +2287,12 @@ No match End ------------------------------------------------------------------ +/^s?c/mi8I +Capturing subpattern count = 0 +Options: caseless multiline utf +First char at start or follows newline +Need char = 'c' (caseless) + scat + 0: sc + /-- End of testinput7 --/ diff --git a/pcre/testdata/testoutput8 b/pcre/testdata/testoutput8 index 3861ea41fdb..95c4e4db1b2 100644 --- a/pcre/testdata/testoutput8 +++ b/pcre/testdata/testoutput8 @@ -7777,4 +7777,12 @@ Matched, but offsets vector is too small to show all matches 1: aaa 2: aa +'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + +'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' + NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED + 0: NON QUOTED "QUOT""ED" AFTER + /-- End of testinput8 --/ diff --git a/pcre/ucp.h b/pcre/ucp.h index d8b34bfcc5b..2fa00296e42 100644 --- a/pcre/ucp.h +++ b/pcre/ucp.h @@ -192,7 +192,31 @@ enum { ucp_Miao, ucp_Sharada, ucp_Sora_Sompeng, - ucp_Takri + ucp_Takri, + /* New for Unicode 7.0.0: */ + ucp_Bassa_Vah, + ucp_Caucasian_Albanian, + ucp_Duployan, + ucp_Elbasan, + ucp_Grantha, + ucp_Khojki, + ucp_Khudawadi, + ucp_Linear_A, + ucp_Mahajani, + ucp_Manichaean, + ucp_Mende_Kikakui, + ucp_Modi, + ucp_Mro, + ucp_Nabataean, + ucp_Old_North_Arabian, + ucp_Old_Permic, + ucp_Pahawh_Hmong, + ucp_Palmyrene, + ucp_Psalter_Pahlavi, + ucp_Pau_Cin_Hau, + ucp_Siddham, + ucp_Tirhuta, + ucp_Warang_Citi }; #endif diff --git a/plugin/auth_socket/auth_socket.c b/plugin/auth_socket/auth_socket.c index e2fb0b1291b..601b76b6b5c 100644 --- a/plugin/auth_socket/auth_socket.c +++ b/plugin/auth_socket/auth_socket.c @@ -37,7 +37,7 @@ #elif defined HAVE_SOCKPEERCRED #define level SOL_SOCKET -#define ucred socketpeercred +#define ucred sockpeercred #elif defined HAVE_XUCRED #include diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index a15c18a4c70..2d9785df6e2 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -6,6 +6,8 @@ * See COPYRIGHT.txt for details. */ +#include + #include #include #include diff --git a/plugin/handler_socket/handlersocket/handlersocket.cpp b/plugin/handler_socket/handlersocket/handlersocket.cpp index 2595d24a85c..6e4c03fcc24 100644 --- a/plugin/handler_socket/handlersocket/handlersocket.cpp +++ b/plugin/handler_socket/handlersocket/handlersocket.cpp @@ -6,6 +6,8 @@ * See COPYRIGHT.txt for details. */ +#include + #include #include #include diff --git a/plugin/handler_socket/handlersocket/hstcpsvr.cpp b/plugin/handler_socket/handlersocket/hstcpsvr.cpp index 13df7ba0838..925020023bc 100644 --- a/plugin/handler_socket/handlersocket/hstcpsvr.cpp +++ b/plugin/handler_socket/handlersocket/hstcpsvr.cpp @@ -6,6 +6,8 @@ * See COPYRIGHT.txt for details. */ +#include + #include #include #include diff --git a/plugin/handler_socket/libhsclient/hstcpcli.cpp b/plugin/handler_socket/libhsclient/hstcpcli.cpp index c0cb5fb1e97..21c964cb046 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.cpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.cpp @@ -6,6 +6,8 @@ * See COPYRIGHT.txt for details. */ +#include + #include #include "hstcpcli.hpp" diff --git a/plugin/handler_socket/libhsclient/socket.cpp b/plugin/handler_socket/libhsclient/socket.cpp index 0c4816589fa..cf19d4bbe14 100644 --- a/plugin/handler_socket/libhsclient/socket.cpp +++ b/plugin/handler_socket/libhsclient/socket.cpp @@ -6,6 +6,8 @@ * See COPYRIGHT.txt for details. */ +#include + #include #include #include diff --git a/plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.xs b/plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.xs index 04dab6d0a68..8169b3e52a9 100644 --- a/plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.xs +++ b/plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.xs @@ -6,17 +6,14 @@ * See COPYRIGHT.txt for details. */ +#undef VERSION +#include + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" - -/* - below we'll include (indirectly) my_global.h, which defines - VERSION too. Undefine our VERSION here. -*/ -#undef VERSION #include "hstcpcli.hpp" #define DBG(x) diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index b45ea012617..fcfdb59da30 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -14,6 +14,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MYSQL_SERVER 1 +#include "my_config.h" #include "mysql_version.h" #include "mysql/plugin.h" #include "sql_class.h" diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h index 0e801428a56..28577296817 100644 --- a/plugin/semisync/semisync.h +++ b/plugin/semisync/semisync.h @@ -21,12 +21,10 @@ #define MYSQL_SERVER #define HAVE_REPLICATION +#include #include #include #include "unireg.h" -#include -#include -#include #include #include "log.h" /* sql_print_information */ diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index fc1dbf4dde4..7f86d3fc3c3 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -17,6 +17,8 @@ #define PLUGIN_VERSION 0x101 #define PLUGIN_STR_VERSION "1.1.7" +#include + #include #include #include diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 513aa0575c4..fe98751d009 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -15,6 +15,7 @@ # Build comp_sql - used for embedding SQL in C or C++ programs IF(NOT CMAKE_CROSSCOMPILING) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) ADD_EXECUTABLE(comp_sql comp_sql.c) TARGET_LINK_LIBRARIES(comp_sql) ENDIF() diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c index 20dedfdfa14..bcc653a3b7f 100644 --- a/scripts/comp_sql.c +++ b/scripts/comp_sql.c @@ -23,6 +23,7 @@ into other programs */ +#include #include #include #include diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql index 939f15ed45a..15f29c8adc3 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -23,6 +23,8 @@ set names 'utf8'; +set sql_log_bin = 0; + delete from help_topic; delete from help_category; delete from help_keyword; diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index 4909d5d0a87..47010ac087b 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -136,12 +136,12 @@ cflags="$include @CFLAGS@ " #note: end space! for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ DEXTRA_DEBUG DHAVE_valgrind O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \ 'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \ - Xa xstrconst "xc99=none" AC99 \ + Xa xstrconst "xc99=none" AC99 'W[-A-Za-z]*=[-A-Za-z0-9]*' \ unroll2 ip mp restrict do # The first option we might strip will always have a space before it because # we set -I$pkgincludedir as the first option - cflags=`echo "$cflags"|sed -e "s/ -$remove */ /g"` + cflags=`echo "$cflags"|sed -e ':again' -e "s/ -$remove */ /g" -e 't again'` done cflags=`echo "$cflags"|sed -e 's/ *\$//'` diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index 9e9bce9fa87..8eca327028e 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -182,7 +182,7 @@ else fi mysql_command=`find_in_basedir mysql $bindir` -if test -z "$print_defaults" +if test -z "$mysql_command" then cannot_find_file mysql $bindir exit 1 @@ -204,7 +204,7 @@ prepare() { do_query() { echo "$1" >$command #sed 's,^,> ,' < $command # Debugging - $bindir/mysql --defaults-file=$config <$command + $mysql_command --defaults-file=$config <$command return $? } @@ -376,7 +376,6 @@ clean_and_exit() { # The actual script starts here prepare -find_mysql_client set_echo_compat echo diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 49a9062e13e..b81eb4e8e40 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -645,6 +645,23 @@ INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now( INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0; DROP TABLE tmp_proxies_priv; +-- Checking for any duplicate hostname and username combination are exists. +-- If exits we will throw error. +DROP PROCEDURE IF EXISTS mysql.count_duplicate_host_names; +DELIMITER // +CREATE PROCEDURE mysql.count_duplicate_host_names() +BEGIN + SET @duplicate_hosts=(SELECT count(*) FROM mysql.user GROUP BY user, lower(host) HAVING count(*) > 1 LIMIT 1); + IF @duplicate_hosts > 1 THEN + SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Multiple accounts exist for @user_name, @host_name that differ only in Host lettercase; remove all except one of them'; + END IF; +END // +DELIMITER ; +CALL mysql.count_duplicate_host_names(); +-- Get warnings (if any) +SHOW WARNINGS; +DROP PROCEDURE mysql.count_duplicate_host_names; + # Convering the host name to lower case for existing users UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host; @@ -685,3 +702,10 @@ alter table tables_priv modify Grantor char(141) COLLATE utf8_bin not null flush privileges; +-- +-- Upgrade help tables +-- + +ALTER TABLE help_category MODIFY url TEXT NOT NULL; +ALTER TABLE help_topic MODIFY url TEXT NOT NULL; + diff --git a/sql-common/client.c b/sql-common/client.c index c7065925198..89f6a8434a5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1964,6 +1964,12 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c DBUG_RETURN(1); } + if (X509_V_OK != SSL_get_verify_result(ssl)) + { + *errptr= "Failed to verify the server certificate"; + X509_free(server_cert); + DBUG_RETURN(1); + } /* We already know that the certificate exchanged was valid; the SSL library handled that. Now we need to verify that the contents of the certificate diff --git a/sql/datadict.cc b/sql/datadict.cc index deeedcd512d..62d60ed15a1 100644 --- a/sql/datadict.cc +++ b/sql/datadict.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "datadict.h" #include "sql_priv.h" #include "sql_class.h" diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index 35b838d7c3d..2980ecd7dbf 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -15,6 +15,7 @@ /* see include/mysql/service_debug_sync.h for debug sync documentation */ +#include #include "debug_sync.h" #if defined(ENABLED_DEBUG_SYNC) diff --git a/sql/derror.cc b/sql/derror.cc index 74e8209496b..f19f73238fb 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -21,6 +21,7 @@ Read language depeneded messagefile */ +#include #include "sql_priv.h" #include "unireg.h" #include "derror.h" diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index b6b6f4536bc..ede2e9fa9d4 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -13,7 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "my_global.h" // HAVE_* +#include // HAVE_* #include "sql_priv.h" #include "des_key_file.h" // st_des_keyschedule, st_des_keyblock #include "log.h" // sql_print_error diff --git a/sql/discover.cc b/sql/discover.cc index 9351cf034ab..82648e94bc5 100644 --- a/sql/discover.cc +++ b/sql/discover.cc @@ -21,6 +21,7 @@ Functions for discover of frm file from handler */ +#include #include "sql_priv.h" #include "unireg.h" #include "discover.h" diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 3c5a4a7909b..e7bdc42b2e6 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -15,7 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define MYSQL_LEX 1 -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_parse.h" // parse_sql diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index b20269b8304..30dffc30edd 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_base.h" // close_thread_tables diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index 7647419aff9..56c6c3cc13c 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sp_head.h" diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 0324e05fb27..35187af23ac 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "event_queue.h" diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index 6091977cc8d..f2b3a77f414 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "event_scheduler.h" @@ -353,14 +354,7 @@ Event_scheduler::Event_scheduler(Event_queue *queue_arg) mysql_mutex_init(key_event_scheduler_LOCK_scheduler_state, &LOCK_scheduler_state, MY_MUTEX_INIT_FAST); mysql_cond_init(key_event_scheduler_COND_state, &COND_state, NULL); - -#ifdef SAFE_MUTEX - /* Ensure right mutex order */ - mysql_mutex_lock(&LOCK_scheduler_state); - mysql_mutex_lock(&LOCK_global_system_variables); - mysql_mutex_unlock(&LOCK_global_system_variables); - mysql_mutex_unlock(&LOCK_scheduler_state); -#endif + mysql_mutex_record_order(&LOCK_scheduler_state, &LOCK_global_system_variables); } diff --git a/sql/events.cc b/sql/events.cc index a14f1a6c384..b675dafe01f 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_parse.h" // check_access diff --git a/sql/field.cc b/sql/field.cc index 103a8920d7e..ad59b4a63bd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -27,6 +27,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "sql_select.h" #include "rpl_rli.h" // Pull in Relay_log_info @@ -41,7 +42,6 @@ #include "filesort.h" // change_double_for_sort #include "log_event.h" // class Table_map_log_event #include -#include // Maximum allowed exponent value for converting string to decimal #define MAX_EXPONENT 1024 @@ -5442,6 +5442,21 @@ String *Field_time::val_str(String *str, } +bool Field_time::check_zero_in_date_with_warn(ulonglong fuzzydate) +{ + if (!(fuzzydate & TIME_TIME_ONLY) && (fuzzydate & TIME_NO_ZERO_IN_DATE)) + { + THD *thd= get_thd(); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_DATA_OUT_OF_RANGE, + ER(ER_WARN_DATA_OUT_OF_RANGE), field_name, + thd->get_stmt_da()->current_row_for_warning()); + return true; + } + return false; +} + + /** @note Normally we would not consider 'time' as a valid date, but we allow @@ -5451,16 +5466,8 @@ String *Field_time::val_str(String *str, bool Field_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { - if (!(fuzzydate & TIME_TIME_ONLY) && - (fuzzydate & TIME_NO_ZERO_IN_DATE)) - { - THD *thd= get_thd(); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_DATA_OUT_OF_RANGE, - ER(ER_WARN_DATA_OUT_OF_RANGE), field_name, - thd->get_stmt_da()->current_row_for_warning()); - return 1; - } + if (check_zero_in_date_with_warn(fuzzydate)) + return true; long tmp=(long) sint3korr(ptr); ltime->neg=0; if (tmp < 0) @@ -5565,6 +5572,8 @@ double Field_time_with_dec::val_real(void) bool Field_time_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { + if (check_zero_in_date_with_warn(fuzzydate)) + return true; uint32 len= pack_length(); longlong packed= read_bigendian(ptr, len); @@ -5578,7 +5587,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) ltime->time_type= MYSQL_TIMESTAMP_TIME; ltime->hour+= (ltime->month*32+ltime->day)*24; ltime->month= ltime->day= 0; - return !(fuzzydate & TIME_TIME_ONLY) && (fuzzydate & TIME_NO_ZERO_IN_DATE); + return false; } @@ -5623,6 +5632,8 @@ void Field_timef::store_TIME(MYSQL_TIME *ltime) bool Field_timef::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { + if (check_zero_in_date_with_warn(fuzzydate)) + return true; longlong tmp= my_time_packed_from_binary(ptr, dec); TIME_from_longlong_time_packed(ltime, tmp); return false; diff --git a/sql/field.h b/sql/field.h index 06e7429c812..dd603d41bf7 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1885,6 +1885,7 @@ protected: virtual void store_TIME(MYSQL_TIME *ltime); int store_TIME_with_warning(MYSQL_TIME *ltime, const ErrConv *str, int was_cut, int have_smth_to_conv); + bool check_zero_in_date_with_warn(ulonglong fuzzydate); public: Field_time(uchar *ptr_arg, uint length_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, diff --git a/sql/field_conv.cc b/sql/field_conv.cc index f13694e2a13..e31f7c5f005 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -27,6 +27,7 @@ gives much more speed. */ +#include #include "sql_priv.h" #include "sql_class.h" // THD #include @@ -791,6 +792,10 @@ Copy_field::get_copy_func(Field *to,Field *from) else if (to->real_type() != from->real_type() || to_length != from_length) { + if ((to->real_type() == MYSQL_TYPE_ENUM || + to->real_type() == MYSQL_TYPE_SET) && + from->real_type() == MYSQL_TYPE_NEWDECIMAL) + return do_field_decimal; if (to->real_type() == MYSQL_TYPE_DECIMAL || to->result_type() == STRING_RESULT) return do_field_string; @@ -837,7 +842,10 @@ bool memcpy_field_possible(Field *to,Field *from) { const enum_field_types to_real_type= to->real_type(); const enum_field_types from_real_type= from->real_type(); - const enum_field_types to_type= from->type(); + /* + Warning: Calling from->type() may be unsafe in some (unclear) circumstances + related to SPs. See MDEV-6799. + */ return (to_real_type == from_real_type && !(to->flags & BLOB_FLAG && to->table->copy_blobs) && to->pack_length() == from->pack_length() && @@ -850,8 +858,8 @@ bool memcpy_field_possible(Field *to,Field *from) to->field_length == from->field_length) && from->charset() == to->charset() && (!sql_mode_for_dates(to->table->in_use) || - (to_type != MYSQL_TYPE_DATE && - to_type != MYSQL_TYPE_DATETIME)) && + (from->type()!= MYSQL_TYPE_DATE && + from->type()!= MYSQL_TYPE_DATETIME)) && (from_real_type != MYSQL_TYPE_VARCHAR || ((Field_varstring*)from)->length_bytes == ((Field_varstring*)to)->length_bytes)); diff --git a/sql/filesort.cc b/sql/filesort.cc index 23cfd6a1817..509a7f8e9b3 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -22,6 +22,7 @@ Sorts a database */ +#include #include "sql_priv.h" #include "filesort.h" #include "unireg.h" // REQUIRED by other includes @@ -39,7 +40,6 @@ #include "sql_select.h" #include "log_slow.h" #include "debug_sync.h" -#include "sql_base.h" /// How to write record_ref. #define WRITE_REF(file,from) \ diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc index f8f6d5c9420..1cef30b6a56 100644 --- a/sql/filesort_utils.cc +++ b/sql/filesort_utils.cc @@ -125,7 +125,8 @@ void Filesort_buffer::free_sort_buffer() void Filesort_buffer::sort_buffer(const Sort_param *param, uint count) { - if (count <= 1) + size_t size= param->sort_length; + if (count <= 1 || size == 0) return; uchar **keys= get_sort_keys(); uchar **buffer= NULL; @@ -138,6 +139,5 @@ void Filesort_buffer::sort_buffer(const Sort_param *param, uint count) return; } - size_t size= param->sort_length; my_qsort2(keys, count, sizeof(uchar*), get_ptr_compare(size), &size); } diff --git a/sql/gstream.cc b/sql/gstream.cc index 3a9e478c376..adb46083621 100644 --- a/sql/gstream.cc +++ b/sql/gstream.cc @@ -18,6 +18,7 @@ NOTE: These functions assumes that the string is end \0 terminated! */ +#include #include "sql_priv.h" #include "gstream.h" #include "m_string.h" // LEX_STRING diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9524a0366d3..ed05521a473 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -25,6 +25,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_table.h" // build_table_filename, diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 531211eb175..73513ac9f40 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -15,6 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_show.h" diff --git a/sql/ha_ndbcluster_cond.cc b/sql/ha_ndbcluster_cond.cc index fd80304d400..f39e72e1549 100644 --- a/sql/ha_ndbcluster_cond.cc +++ b/sql/ha_ndbcluster_cond.cc @@ -22,6 +22,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "sql_class.h" // set_var.h: THD #include "my_global.h" // WITH_* diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e53d8bace6f..929acda2716 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -46,6 +46,7 @@ if this file. */ +#include #include "sql_priv.h" #include "sql_parse.h" // append_file_to_dir #include "create_options.h" diff --git a/sql/handler.cc b/sql/handler.cc index 2e0a10609db..85129f11c63 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -20,6 +20,7 @@ Handler-calling-functions */ +#include #include "sql_priv.h" #include "unireg.h" #include "rpl_handler.h" @@ -1346,10 +1347,7 @@ int ha_commit_trans(THD *thd, bool all) Free resources and perform other cleanup even for 'empty' transactions. */ if (is_real_trans) - { thd->transaction.cleanup(); - thd->wakeup_subsequent_commits(error); - } DBUG_RETURN(0); } @@ -1388,7 +1386,6 @@ int ha_commit_trans(THD *thd, bool all) thd->variables.lock_wait_timeout)) { ha_rollback_trans(thd, all); - thd->wakeup_subsequent_commits(1); DBUG_RETURN(1); } @@ -1509,7 +1506,6 @@ done: err: error= 1; /* Transaction was rolled back */ ha_rollback_trans(thd, all); - thd->wakeup_subsequent_commits(error); end: if (rw_trans && mdl_request.ticket) @@ -1603,10 +1599,7 @@ commit_one_phase_2(THD *thd, bool all, THD_TRANS *trans, bool is_real_trans) } /* Free resources and perform other cleanup even for 'empty' transactions. */ if (is_real_trans) - { - thd->wakeup_subsequent_commits(error); thd->transaction.cleanup(); - } DBUG_RETURN(error); } diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc index 7c275ffc617..fc89bb83a9d 100644 --- a/sql/hash_filo.cc +++ b/sql/hash_filo.cc @@ -23,6 +23,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "hash_filo.h" diff --git a/sql/hostname.cc b/sql/hostname.cc index c6c58a0db92..1879d056623 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -24,6 +24,7 @@ Hostnames are checked with reverse name lookup and checked that they doesn't resemble an IP address. */ +#include #include "sql_priv.h" #include "hostname.h" #include "my_global.h" diff --git a/sql/init.cc b/sql/init.cc index 86915b7aa01..91b4b220bf3 100644 --- a/sql/init.cc +++ b/sql/init.cc @@ -21,6 +21,7 @@ Init and dummy functions for interface with unireg */ +#include #include "sql_priv.h" #include "init.h" #include "my_sys.h" diff --git a/sql/item.cc b/sql/item.cc index 447137a1f68..1dd4fc2909f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab + Copyright (c) 2000, 2014, Oracle and/or its affiliates. + Copyright (c) 2010, 2014, Monty Program 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 @@ -19,7 +19,7 @@ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include @@ -5579,6 +5579,18 @@ enum_field_types Item::field_type() const } +/** + Verifies that the input string is well-formed according to its character set. + @param send_error If true, call my_error if string is not well-formed. + + Will truncate input string if it is not well-formed. + + @return + If well-formed: input string. + If not well-formed: + if strict mode: NULL pointer and we set this Item's value to NULL + if not strict mode: input string truncated up to last good character + */ String *Item::check_well_formed_result(String *str, bool send_error) { /* Check whether we got a well-formed string */ @@ -9000,17 +9012,11 @@ bool Item_cache_temporal::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) int Item_cache_temporal::save_in_field(Field *field, bool no_conversions) { - int error; - if (!has_value()) - return set_field_to_null_with_conversions(field, no_conversions); - - field->set_notnull(); - MYSQL_TIME ltime; - unpack_time(value, <ime); - ltime.time_type= mysql_type_to_time_type(field_type()); - error= field->store_time_dec(<ime, decimals); - + if (get_date(<ime, 0)) + return set_field_to_null_with_conversions(field, no_conversions); + field->set_notnull(); + int error= field->store_time_dec(<ime, decimals); return error ? error : field->table->in_use->is_error() ? 1 : 0; } diff --git a/sql/item.h b/sql/item.h index 22d147028ef..f337db92ef3 100644 --- a/sql/item.h +++ b/sql/item.h @@ -164,6 +164,12 @@ public: default: return "UNKNOWN"; } } + int sortcmp(const String *s, const String *t) const + { + return collation->coll->strnncollsp(collation, + (uchar *) s->ptr(), s->length(), + (uchar *) t->ptr(), t->length(), 0); + } }; /*************************************************************************/ @@ -4353,6 +4359,7 @@ public: return arg->walk(processor, walk_subquery, args) || (this->*processor)(args); } + bool check_partition_func_processor(uchar *int_arg) {return TRUE;} bool check_vcol_func_processor(uchar *arg) { return trace_unsupported_by_check_vcol_func_processor("values"); diff --git a/sql/item_buff.cc b/sql/item_buff.cc index a08ae8d8403..d1134525f7b 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -22,6 +22,7 @@ Buffers to save and compare item values */ +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 289668f24ca..62f63501d86 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -26,6 +26,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include #include "sql_select.h" @@ -1969,14 +1970,14 @@ longlong Item_func_lt::val_int() longlong Item_func_strcmp::val_int() { DBUG_ASSERT(fixed == 1); - String *a=args[0]->val_str(&cmp.value1); - String *b=args[1]->val_str(&cmp.value2); + String *a= args[0]->val_str(&value1); + String *b= args[1]->val_str(&value2); if (!a || !b) { null_value=1; return 0; } - int value= sortcmp(a,b,cmp.cmp_collation.collation); + int value= cmp_collation.sortcmp(a, b); null_value=0; return !value ? 0 : (value < 0 ? (longlong) -1 : (longlong) 1); } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 71674c61d47..d4a1c6b1384 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -695,21 +695,18 @@ public: }; -class Item_func_strcmp :public Item_bool_func2 +class Item_func_strcmp :public Item_int_func { + String value1, value2; + DTCollation cmp_collation; public: - Item_func_strcmp(Item *a,Item *b) :Item_bool_func2(a,b) {} + Item_func_strcmp(Item *a,Item *b) :Item_int_func(a,b) {} longlong val_int(); - optimize_type select_optimize() const { return OPTIMIZE_NONE; } + uint decimal_precision() const { return 1; } const char *func_name() const { return "strcmp"; } - - virtual inline void print(String *str, enum_query_type query_type) - { - Item_func::print(str, query_type); - } void fix_length_and_dec() { - Item_bool_func2::fix_length_and_dec(); + agg_arg_charsets_for_comparison(cmp_collation, args, 2); fix_char_length(2); // returns "1" or "0" or "-1" } }; @@ -803,6 +800,7 @@ public: Item_func_nullif(Item *a,Item *b) :Item_bool_func2(a,b), cached_result_type(INT_RESULT) {} + bool is_bool_func() { return false; } double val_real(); longlong val_int(); String *val_str(String *str); diff --git a/sql/item_create.cc b/sql/item_create.cc index fa8249c3321..852891f7743 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -22,6 +22,7 @@ Functions to create an item. Used by sql_yac.yy */ +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/item_func.h b/sql/item_func.h index 18265f672dd..e40f2d771c6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1740,6 +1740,7 @@ public: bool register_field_in_bitmap(uchar *arg); bool set_entry(THD *thd, bool create_if_not_exists); void cleanup(); + bool check_vcol_func_processor(uchar *int_arg) {return TRUE;} }; @@ -1779,6 +1780,7 @@ public: { return this; } + bool check_vcol_func_processor(uchar *int_arg) { return TRUE;} }; @@ -1861,6 +1863,7 @@ public: bool eq(const Item *item, bool binary_cmp) const; void cleanup(); + bool check_vcol_func_processor(uchar *int_arg) { return TRUE;} }; @@ -2159,7 +2162,6 @@ public: longlong val_int(); void fix_length_and_dec() { max_length= 21; unsigned_flag=1; } - bool check_partition_func_processor(uchar *int_arg) {return FALSE;} bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index d9200b3e8d3..6d7a6a5e6ff 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -27,6 +27,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc index 627ef728a2e..6a09747fa1a 100644 --- a/sql/item_inetfunc.cc +++ b/sql/item_inetfunc.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "item_inetfunc.h" #include "my_net.h" diff --git a/sql/item_row.cc b/sql/item_row.cc index 6345eaa864b..3548a6b9b75 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 01ff2d412f2..32a19341895 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -31,10 +31,10 @@ #pragma implementation // gcc: Class implementation #endif -/* May include caustic 3rd-party defs. Use early, so it can override nothing. */ -#include "sha2.h" -#include "my_global.h" // HAVE_* +#include // HAVE_* +/* May include caustic 3rd-party defs. Use early, so it can override nothing */ +#include "sha2.h" #include "sql_priv.h" /* @@ -1379,12 +1379,15 @@ bool Item_func_regexp_replace::append_replacement(String *str, break; /* End of line */ beg+= cnv; - if ((n= ((int) wc) - '0') >= 0 && n <= 9 && n < re.nsubpatterns()) + if ((n= ((int) wc) - '0') >= 0 && n <= 9) { - /* A valid sub-pattern reference found */ - int pbeg= re.subpattern_start(n), plength= re.subpattern_end(n) - pbeg; - if (str->append(source->str + pbeg, plength, cs)) - return true; + if (n < re.nsubpatterns()) + { + /* A valid sub-pattern reference found */ + int pbeg= re.subpattern_start(n), plength= re.subpattern_end(n) - pbeg; + if (str->append(source->str + pbeg, plength, cs)) + return true; + } } else { @@ -4192,7 +4195,7 @@ String *Item_func_uncompress::val_str(String *str) goto err; if ((err= uncompress((Byte*)buffer.ptr(), &new_size, - ((const Bytef*)res->ptr())+4,res->length())) == Z_OK) + ((const Bytef*)res->ptr())+4,res->length()-4)) == Z_OK) { buffer.length((uint32) new_size); return &buffer; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7db7b014d28..a0fca36452c 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -29,6 +29,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 2dadf8b8835..21f14ae8435 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -26,6 +26,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "sql_select.h" diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 4a8bb4cc77d..389d9d5380c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -30,6 +30,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there @@ -450,16 +451,14 @@ err: Create a formated date/time value in a string. */ -bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, - timestamp_type type, String *str) +static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, + timestamp_type type, MY_LOCALE *locale, String *str) { char intbuff[15]; uint hours_i; uint weekday; ulong length; const char *ptr, *end; - THD *thd= current_thd; - MY_LOCALE *locale= thd->variables.lc_time_names; str->length(0); @@ -1801,6 +1800,8 @@ overflow: void Item_func_date_format::fix_length_and_dec() { THD* thd= current_thd; + locale= thd->variables.lc_time_names; + /* Must use this_item() in case it's a local SP variable (for ->max_length and ->str_value) @@ -1964,7 +1965,7 @@ String *Item_func_date_format::val_str(String *str) if (!make_date_time(&date_time_format, &l_time, is_time_format ? MYSQL_TIMESTAMP_TIME : MYSQL_TIMESTAMP_DATE, - str)) + locale, str)) return str; null_date: @@ -1975,8 +1976,9 @@ null_date: void Item_func_from_unixtime::fix_length_and_dec() { - thd= current_thd; + THD *thd= current_thd; thd->time_zone_used= 1; + tz= thd->variables.time_zone; decimals= args[0]->decimals; Item_temporal_func::fix_length_and_dec(); } @@ -1997,7 +1999,7 @@ bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime, if (args[0]->null_value || sign || sec > TIMESTAMP_MAX_VALUE) return (null_value= 1); - thd->variables.time_zone->gmt_sec_to_TIME(ltime, (my_time_t)sec); + tz->gmt_sec_to_TIME(ltime, (my_time_t)sec); ltime->second_part= sec_part; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index cb8b59501a4..839a5a4845d 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -736,6 +736,7 @@ public: class Item_func_date_format :public Item_str_func { + MY_LOCALE *locale; int fixed_length; const bool is_time_format; String value; @@ -753,7 +754,7 @@ public: class Item_func_from_unixtime :public Item_temporal_func { - THD *thd; + Time_zone *tz; public: Item_func_from_unixtime(Item *a) :Item_temporal_func(a) {} const char *func_name() const { return "from_unixtime"; } @@ -1088,10 +1089,4 @@ public: bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date); }; - -/* Function prototypes */ - -bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, - timestamp_type type, String *str); - #endif /* ITEM_TIMEFUNC_INCLUDED */ diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 932f4245c27..f8bf7cbf93a 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -17,6 +17,7 @@ #pragma implementation #endif +#include #include "sql_priv.h" /* It is necessary to include set_var.h instead of item.h because there diff --git a/sql/key.cc b/sql/key.cc index 3556ecf82d7..e3787ea7869 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -16,6 +16,7 @@ /* Functions to handle keys and fields in forms */ +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: by includes later #include "key.h" // key_rec_cmp diff --git a/sql/lock.cc b/sql/lock.cc index 082a5827908..4d7afc697ef 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -74,6 +74,7 @@ we are forced to use mysql_lock_merge. */ +#include #include "sql_priv.h" #include "debug_sync.h" #include "unireg.h" // REQUIRED: for other includes @@ -82,7 +83,6 @@ #include "sql_parse.h" // is_log_table_write_query #include "sql_acl.h" // SUPER_ACL #include -#include #ifdef WITH_WSREP #include "wsrep_mysqld.h" diff --git a/sql/log.cc b/sql/log.cc index a5fda53ccea..7a8531b5f46 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -25,7 +25,7 @@ Abort logging when we get an error in reading or writing log files */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "log.h" #include "sql_base.h" // open_log_table @@ -2651,6 +2651,7 @@ bool MYSQL_LOG::open( const char *new_name, enum cache_type io_cache_type_arg) { char buff[FN_REFLEN]; + MY_STAT f_stat; File file= -1; int open_flags= O_CREAT | O_BINARY; DBUG_ENTER("MYSQL_LOG::open"); @@ -2668,6 +2669,10 @@ bool MYSQL_LOG::open( log_type_arg, io_cache_type_arg)) goto err; + /* File is regular writable file */ + if (my_stat(log_file_name, &f_stat, MYF(0)) && !MY_S_ISREG(f_stat.st_mode)) + goto err; + if (io_cache_type == SEQ_READ_APPEND) open_flags |= O_RDWR | O_APPEND; else @@ -6028,7 +6033,10 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate) if (direct) { + int res; DBUG_PRINT("info", ("direct is set")); + if ((res= thd->wait_for_prior_commit())) + DBUG_RETURN(res); file= &log_file; my_org_b_tell= my_b_tell(file); mysql_mutex_lock(&LOCK_log); @@ -6961,6 +6969,10 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, to commit. If so, we add those to the queue as well, transitively for all waiters. + And if a transaction is marked to wait for a prior transaction, but that + prior transaction is already queued for group commit, then we can queue the + new transaction directly to participate in the group commit. + @retval < 0 Error @retval > 0 If queued as the first entry in the queue (meaning this is the leader) @@ -6970,8 +6982,8 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, int MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) { - group_commit_entry *entry, *orig_queue; - wait_for_commit *cur, *last; + group_commit_entry *entry, *orig_queue, *last; + wait_for_commit *cur; wait_for_commit *wfc; DBUG_ENTER("MYSQL_BIN_LOG::queue_for_group_commit"); @@ -6988,8 +7000,17 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) if (wfc && wfc->waitee) { mysql_mutex_lock(&wfc->LOCK_wait_commit); - /* Do an extra check here, this time safely under lock. */ - if (wfc->waitee) + /* + Do an extra check here, this time safely under lock. + + If waitee->commit_started is set, it means that the transaction we need + to wait for has already queued up for group commit. In this case it is + safe for us to queue up immediately as well, increasing the opprtunities + for group commit. Because waitee has taken the LOCK_prepare_ordered + before setting the flag, so there is no risk that we can queue ahead of + it. + */ + if (wfc->waitee && !wfc->waitee->commit_started) { PSI_stage_info old_stage; wait_for_commit *loc_waitee; @@ -7002,6 +7023,11 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) This other transaction may then take over the commit process for us to get us included in its own group commit. If this happens, the queued_by_other flag is set. + + Setting this flag may or may not be seen by the other thread, but we + are safe in any case: The other thread will set queued_by_other under + its LOCK_wait_commit, and we will not check queued_by_other only after + we have been woken up. */ wfc->opaque_pointer= orig_entry; DEBUG_SYNC(orig_entry->thd, "group_commit_waiting_for_prior"); @@ -7074,41 +7100,41 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) /* Iteratively process everything added to the queue, looking for waiters, and their waiters, and so on. If a waiter is ready to commit, we - immediately add it to the queue; if not we just wake it up. + immediately add it to the queue, and mark it as queued_by_other. This would be natural to do with recursion, but we want to avoid potentially unbounded recursion blowing the C stack, so we use the list approach instead. - We keep a list of all the waiters that need to be processed in `list', - linked through the next_subsequent_commit pointer. Initially this list - contains only the entry passed into this function. + We keep a list of the group_commit_entry of all the waiters that need to + be processed. Initially this list contains only the entry passed into this + function. We process entries in the list one by one. The element currently being - processed is pointed to by `cur`, and the element at the end of the list + processed is pointed to by `entry`, and the element at the end of the list is pointed to by `last` (we do not use NULL to terminate the list). - As we process an element, it is first added to the group_commit_queue. - Then any waiters for that element are added at the end of the list, to - be processed in subsequent iterations. This continues until the list - is exhausted, with all elements ever added eventually processed. + As we process an entry, any waiters for that entry are added at the end of + the list, to be processed in subsequent iterations. The the entry is added + to the group_commit_queue. This continues until the list is exhausted, + with all entries ever added eventually processed. The end result is a breath-first traversal of the tree of waiters, - re-using the next_subsequent_commit pointers in place of extra stack - space in a recursive traversal. + re-using the `next' pointers of the group_commit_entry objects in place of + extra stack space in a recursive traversal. - The temporary list created in next_subsequent_commit is not - used by the caller or any other function. + The temporary list linked through these `next' pointers is not used by the + caller or any other function; it only exists while doing the iterative + tree traversal. After, all the processed entries are linked into the + group_commit_queue. */ cur= wfc; - last= wfc; + last= orig_entry; entry= orig_entry; for (;;) { - /* Add the entry to the group commit queue. */ - entry->next= group_commit_queue; - group_commit_queue= entry; + group_commit_entry *next_entry; if (entry->cache_mngr->using_xa) { @@ -7117,135 +7143,95 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry) DEBUG_SYNC(entry->thd, "commit_after_prepare_ordered"); } - if (!cur) - break; // Can happen if initial entry has no wait_for_commit - - /* - Check if this transaction has other transaction waiting for it to commit. - - If so, process the waiting transactions, and their waiters and so on, - transitively. - */ - if (cur->subsequent_commits_list) + if (cur) { - wait_for_commit *waiter; - wait_for_commit *wakeup_list= NULL; - wait_for_commit **wakeup_next_ptr= &wakeup_list; - - mysql_mutex_lock(&cur->LOCK_wait_commit); /* - Grab the list, now safely under lock, and process it if still - non-empty. + Now that we have taken LOCK_prepare_ordered and will queue up in the + group commit queue, it is safe for following transactions to queue + themselves. We will grab here any transaction that is now ready to + queue up, but after that, more transactions may become ready while the + leader is waiting to start the group commit. So set the flag + `commit_started', so that later transactions can still participate in + the group commit.. */ - waiter= cur->subsequent_commits_list; - cur->subsequent_commits_list= NULL; - while (waiter) + cur->commit_started= true; + + /* + Check if this transaction has other transaction waiting for it to + commit. + + If so, process the waiting transactions, and their waiters and so on, + transitively. + */ + if (cur->subsequent_commits_list) { - wait_for_commit *next= waiter->next_subsequent_commit; - group_commit_entry *entry2= - (group_commit_entry *)waiter->opaque_pointer; - if (entry2) - { - /* - This is another transaction ready to be written to the binary - log. We can put it into the queue directly, without needing a - separate context switch to the other thread. We just set a flag - so that the other thread will know when it wakes up that it was - already processed. + wait_for_commit *waiter, **waiter_ptr; - So put it at the end of the list to be processed in a subsequent - iteration of the outer loop. - */ - entry2->queued_by_other= true; - last->next_subsequent_commit= waiter; - last= waiter; - /* - As a small optimisation, we do not actually need to set - waiter->next_subsequent_commit to NULL, as we can use the - pointer `last' to check for end-of-list. - */ - } - else - { - /* - Wake up the waiting transaction. - - For this, we need to set the "wakeup running" flag and release - the waitee lock to avoid a deadlock, see comments on - THD::wakeup_subsequent_commits2() for details. - - So we need to put these on a list and delay the wakeup until we - have released the lock. - */ - *wakeup_next_ptr= waiter; - wakeup_next_ptr= &waiter->next_subsequent_commit; - } - waiter= next; - } - if (wakeup_list) - { - /* Now release our lock and do the wakeups that were delayed above. */ - cur->wakeup_subsequent_commits_running= true; - mysql_mutex_unlock(&cur->LOCK_wait_commit); - for (;;) - { - wait_for_commit *next; - - /* - ToDo: We wakeup the waiter here, so that it can have the chance to - reach its own commit state and queue up for this same group commit, - if it is still pending. - - One problem with this is that if the waiter does not reach its own - commit state before this group commit starts, and then the group - commit fails (binlog write failure), we do not get to propagate - the error to the waiter. - - A solution for this could be to delay the wakeup until commit is - successful. But then we need to set a flag in the waitee that it is - already queued for group commit, so that the waiter can check this - flag and queue itself if it _does_ reach the commit state in time. - - (But error handling in case of binlog write failure is currently - broken in other ways, as well). - */ - if (&wakeup_list->next_subsequent_commit == wakeup_next_ptr) - { - /* The last one in the list. */ - wakeup_list->wakeup(0); - break; - } - /* - Important: don't access wakeup_list->next after the wakeup() call, - it may be invalidated by the other thread. - */ - next= wakeup_list->next_subsequent_commit; - wakeup_list->wakeup(0); - wakeup_list= next; - } + mysql_mutex_lock(&cur->LOCK_wait_commit); /* - We need a full memory barrier between walking the list and clearing - the flag wakeup_subsequent_commits_running. This barrier is needed - to ensure that no other thread will start to modify the list - pointers before we are done traversing the list. - - But wait_for_commit::wakeup(), which was called above, does a full - memory barrier already (it locks a mutex). + Grab the list, now safely under lock, and process it if still + non-empty. */ - cur->wakeup_subsequent_commits_running= false; - } - else + waiter= cur->subsequent_commits_list; + waiter_ptr= &cur->subsequent_commits_list; + while (waiter) + { + wait_for_commit *next_waiter= waiter->next_subsequent_commit; + group_commit_entry *entry2= + (group_commit_entry *)waiter->opaque_pointer; + if (entry2) + { + /* + This is another transaction ready to be written to the binary + log. We can put it into the queue directly, without needing a + separate context switch to the other thread. We just set a flag + so that the other thread will know when it wakes up that it was + already processed. + + So remove it from the list of our waiters, and instead put it at + the end of the list to be processed in a subsequent iteration of + the outer loop. + */ + *waiter_ptr= next_waiter; + entry2->queued_by_other= true; + last->next= entry2; + last= entry2; + /* + As a small optimisation, we do not actually need to set + entry2->next to NULL, as we can use the pointer `last' to check + for end-of-list. + */ + } + else + { + /* + This transaction is not ready to participate in the group commit + yet, so leave it in the waiter list. It might join the group + commit later, if it completes soon enough to do so (it will see + our wfc->commit_started flag set), or it might commit later in a + later group commit. + */ + waiter_ptr= &waiter->next_subsequent_commit; + } + waiter= next_waiter; + } mysql_mutex_unlock(&cur->LOCK_wait_commit); + } } - if (cur == last) + + /* Add the entry to the group commit queue. */ + next_entry= entry->next; + entry->next= group_commit_queue; + group_commit_queue= entry; + if (entry == last) break; /* Move to the next entry in the flattened list of waiting transactions that still need to be processed transitively. */ - cur= cur->next_subsequent_commit; - entry= (group_commit_entry *)cur->opaque_pointer; + entry= next_entry; DBUG_ASSERT(entry != NULL); + cur= entry->thd->wait_for_commit_ptr; } if (opt_binlog_commit_wait_count > 0) @@ -7301,6 +7287,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry) DEBUG_SYNC(entry->thd, "commit_after_group_run_commit_ordered"); } mysql_mutex_unlock(&LOCK_commit_ordered); + entry->thd->wakeup_subsequent_commits(entry->error); if (next) { @@ -7334,7 +7321,7 @@ MYSQL_BIN_LOG::write_transaction_to_binlog_events(group_commit_entry *entry) } if (likely(!entry->error)) - return 0; + return entry->thd->wait_for_prior_commit(); switch (entry->error) { @@ -7392,10 +7379,15 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) LINT_INIT(binlog_id); { + DBUG_EXECUTE_IF("inject_binlog_commit_before_get_LOCK_log", + DBUG_ASSERT(!debug_sync_set_action(leader->thd, STRING_WITH_LEN + ("commit_before_get_LOCK_log SIGNAL waiting WAIT_FOR cont TIMEOUT 1"))); + ); /* Lock the LOCK_log(), and once we get it, collect any additional writes that queued up while we were waiting. */ + DEBUG_SYNC(leader->thd, "commit_before_get_LOCK_log"); mysql_mutex_lock(&LOCK_log); DEBUG_SYNC(leader->thd, "commit_after_get_LOCK_log"); @@ -7602,6 +7594,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) if (current->cache_mngr->using_xa && !current->error && DBUG_EVALUATE_IF("skip_commit_ordered", 0, 1)) run_commit_ordered(current->thd, current->all); + current->thd->wakeup_subsequent_commits(current->error); /* Careful not to access current->next after waking up the other thread! As @@ -7642,7 +7635,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, write_cache(entry->thd, mngr->get_binlog_cache_log(FALSE))) { entry->error_cache= &mngr->stmt_cache.cache_log; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } @@ -7663,7 +7655,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, if (write_cache(entry->thd, mngr->get_binlog_cache_log(TRUE))) { entry->error_cache= &mngr->trx_cache.cache_log; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } } @@ -7671,14 +7662,13 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, DBUG_EXECUTE_IF("inject_error_writing_xid", { entry->error_cache= NULL; - entry->commit_errno= 28; + errno= 28; DBUG_RETURN(ER_ERROR_ON_WRITE); }); if (entry->end_event->write(&log_file)) { entry->error_cache= NULL; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } status_var_add(entry->thd->status_var.binlog_bytes_written, @@ -7689,7 +7679,6 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, if (entry->incident_event->write(&log_file)) { entry->error_cache= NULL; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } } @@ -7697,13 +7686,11 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, if (mngr->get_binlog_cache_log(FALSE)->error) // Error on read { entry->error_cache= &mngr->stmt_cache.cache_log; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } if (mngr->get_binlog_cache_log(TRUE)->error) // Error on read { entry->error_cache= &mngr->trx_cache.cache_log; - entry->commit_errno= errno; DBUG_RETURN(ER_ERROR_ON_WRITE); } diff --git a/sql/log_event.cc b/sql/log_event.cc index 0b2807669fa..525aa65bc8e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -16,12 +16,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "mysqld_error.h" #ifndef MYSQL_CLIENT -#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h -#include "sql_priv.h" #include "unireg.h" #include "log_event.h" #include "sql_base.h" // close_thread_tables @@ -92,23 +91,6 @@ TYPELIB binlog_checksum_typelib= */ #define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1) -/* - Explicit instantiation to unsigned int of template available_buffer - function. -*/ -template unsigned int available_buffer(const char*, - const char*, - unsigned int); - -/* - Explicit instantiation to unsigned int of template valid_buffer_range - function. -*/ -template bool valid_buffer_range(unsigned int, - const char*, - const char*, - unsigned int); - /* replication event checksum is introduced in the following "checksum-home" version. The checksum-aware servers extract FD's version to decide whether the FD event @@ -3228,7 +3210,10 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, thd->in_multi_stmt_transaction_mode()) || trx_cache; break; case SQLCOM_SET_OPTION: - use_cache= trx_cache= (lex->autocommit ? FALSE : TRUE); + if (lex->autocommit) + use_cache= trx_cache= FALSE; + else + use_cache= TRUE; break; case SQLCOM_RELEASE_SAVEPOINT: case SQLCOM_ROLLBACK_TO_SAVEPOINT: @@ -7580,9 +7565,9 @@ User_var_log_event(const char* buf, uint event_len, #endif { bool error= false; - const char* buf_start= buf; + const char* buf_start= buf, *buf_end= buf + event_len; + /* The Post-Header is empty. The Variable Data part begins immediately. */ - const char *start= buf; buf+= description_event->common_header_len + description_event->post_header_len[USER_VAR_EVENT-1]; name_len= uint4korr(buf); @@ -7593,8 +7578,7 @@ User_var_log_event(const char* buf, uint event_len, may have the bigger value possible, is_null= True and there is no payload for val, or even that name_len is 0. */ - if (!valid_buffer_range(name_len, buf_start, name, - event_len - UV_VAL_IS_NULL)) + if (name + name_len + UV_VAL_IS_NULL > buf_end) { error= true; goto err; @@ -7612,9 +7596,10 @@ User_var_log_event(const char* buf, uint event_len, } else { - if (!valid_buffer_range(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE - + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE, - buf_start, buf, event_len)) + val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); + + if (val > buf_end) { error= true; goto err; @@ -7624,10 +7609,8 @@ User_var_log_event(const char* buf, uint event_len, charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE); val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + UV_CHARSET_NUMBER_SIZE); - val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + - UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE); - if (!valid_buffer_range(val_len, buf_start, val, event_len)) + if (val + val_len > buf_end) { error= true; goto err; @@ -7644,7 +7627,7 @@ User_var_log_event(const char* buf, uint event_len, Old events will not have this extra byte, thence, we keep the flags set to UNDEF_F. */ - uint bytes_read= ((val + val_len) - start); + uint bytes_read= ((val + val_len) - buf_start); #ifndef DBUG_OFF bool old_pre_checksum_fd= description_event->is_version_before_checksum( &description_event->server_version_split); diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 4bff12ce039..181d950bf59 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -13,11 +13,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #ifndef MYSQL_CLIENT #include "unireg.h" #endif -#include "my_global.h" // REQUIRED by log_event.h > m_string.h > my_bitmap.h #include "log_event.h" #ifndef MYSQL_CLIENT #include "sql_cache.h" // QUERY_CACHE_FLAGS_SIZE diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc index 3ed9261f630..6535f16445b 100644 --- a/sql/mf_iocache.cc +++ b/sql/mf_iocache.cc @@ -32,6 +32,7 @@ flush_io_cache(). */ +#include #include "sql_priv.h" #include "sql_class.h" // THD #ifdef HAVE_REPLICATION diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index b63db9ecea2..3f55ff3684d 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -426,6 +426,7 @@ bool Mrr_ordered_index_reader::set_interruption_temp_buffer(uint rowid_length, *space_start += key_len; have_saved_rowid= FALSE; + read_was_interrupted= FALSE; return FALSE; } @@ -434,6 +435,7 @@ void Mrr_ordered_index_reader::set_no_interruption_temp_buffer() support_scan_interruptions= FALSE; saved_key_tuple= saved_rowid= saved_primary_key= NULL; /* safety */ have_saved_rowid= FALSE; + read_was_interrupted= FALSE; } void Mrr_ordered_index_reader::interrupt_read() @@ -451,6 +453,7 @@ void Mrr_ordered_index_reader::interrupt_read() &table->key_info[table->s->primary_key], table->key_info[table->s->primary_key].key_length); } + read_was_interrupted= TRUE; /* Save the last rowid */ memcpy(saved_rowid, file->ref, file->ref_length); @@ -468,6 +471,10 @@ void Mrr_ordered_index_reader::position() void Mrr_ordered_index_reader::resume_read() { TABLE *table= file->get_table(); + + if (!read_was_interrupted) + return; + KEY *used_index= &table->key_info[file->active_index]; key_restore(table->record[0], saved_key_tuple, used_index, used_index->key_length); @@ -557,8 +564,7 @@ int Mrr_ordered_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION); mrr_funcs= *seq_funcs; source_exhausted= FALSE; - if (support_scan_interruptions) - bzero(saved_key_tuple, key_info->key_length); + read_was_interrupted= false; have_saved_rowid= FALSE; return 0; } @@ -678,8 +684,19 @@ int Mrr_ordered_rndpos_reader::refill_from_index_reader() rowid_buffer->write_ptr2= (uchar*)&range_info; rowid_buffer->write(); } - - index_reader->interrupt_read(); + + /* + When index_reader_needs_refill=TRUE, this means we've got all of index + tuples for lookups keys that index_reader had. We are not in the middle + of an index read, so there is no need to call interrupt_read. + + Actually, we must not call interrupt_read(), because it could be that we + haven't read a single row (because all index lookups returned + HA_ERR_KEY_NOT_FOUND). In this case, interrupt_read() will cause [harmless] + valgrind warnings when trying to save garbage from table->record[0]. + */ + if (!index_reader_needs_refill) + index_reader->interrupt_read(); /* Sort the buffer contents by rowid */ rowid_buffer->sort((qsort2_cmp)rowid_cmp_reverse, (void*)file); diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h index 3b5375293de..ffae6d63124 100644 --- a/sql/multi_range_read.h +++ b/sql/multi_range_read.h @@ -339,6 +339,12 @@ private: uchar *saved_key_tuple; /* Saved current key tuple */ uchar *saved_primary_key; /* Saved current primary key tuple */ + + /* + TRUE<=> saved_key_tuple (and saved_primary_key when applicable) have + valid values. + */ + bool read_was_interrupted; static int compare_keys(void* arg, uchar* key1, uchar* key2); static int compare_keys_reverse(void* arg, uchar* key1, uchar* key2); diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index 6f28760c055..50454f0f66a 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 59dbc4d607b..84e2ae56fa4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "sql_plugin.h" +#include "sql_plugin.h" // Includes my_global.h #include "sql_priv.h" #include "unireg.h" #include @@ -121,7 +121,6 @@ ulong wsrep_running_threads = 0; // # of currently running wsrep threads #endif extern "C" { // Because of SCO 3.2V4.2 -#include #include #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ // Skip warnings in getopt.h @@ -3398,9 +3397,6 @@ static void init_signals(void) sa.sa_flags = 0; sa.sa_handler = print_signal_warning; sigaction(SIGHUP, &sa, (struct sigaction*) 0); -#ifdef SIGTSTP - sigaddset(&set,SIGTSTP); -#endif if (thd_lib_detected != THD_LIB_LT) sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) @@ -3410,7 +3406,12 @@ static void init_signals(void) sigdelset(&set, SIGINT); } else + { sigaddset(&set,SIGINT); +#ifdef SIGTSTP + sigaddset(&set,SIGTSTP); +#endif + } sigprocmask(SIG_SETMASK,&set,NULL); pthread_sigmask(SIG_SETMASK,&set,NULL); @@ -4436,7 +4437,15 @@ static int init_common_variables() global_system_variables.collation_database= default_charset_info; global_system_variables.collation_connection= default_charset_info; global_system_variables.character_set_results= default_charset_info; - global_system_variables.character_set_client= default_charset_info; + if (default_charset_info->mbminlen > 1) + { + global_system_variables.character_set_client= &my_charset_latin1; + sql_print_warning("Cannot use %s as character_set_client, %s will be used instead", + default_charset_info->csname, + global_system_variables.character_set_client->csname); + } + else + global_system_variables.character_set_client= default_charset_info; if (!(character_set_filesystem= get_charset_by_csname(character_set_filesystem_name, @@ -9166,6 +9175,9 @@ mysqld_get_one_option(int optid, test_flags= argument ? (uint) atoi(argument) : 0; opt_endinfo=1; break; + case OPT_THREAD_CONCURRENCY: + WARN_DEPRECATED_NO_REPLACEMENT(NULL, "THREAD_CONCURRENCY"); + break; case (int) OPT_ISAM_LOG: opt_myisam_log=1; break; @@ -10288,7 +10300,8 @@ PSI_stage_info stage_binlog_waiting_background_tasks= { 0, "Waiting for backgrou PSI_stage_info stage_binlog_processing_checkpoint_notify= { 0, "Processing binlog checkpoint notification", 0}; PSI_stage_info stage_binlog_stopping_background_thread= { 0, "Stopping binlog background thread", 0}; PSI_stage_info stage_waiting_for_work_from_sql_thread= { 0, "Waiting for work from SQL thread", 0}; -PSI_stage_info stage_waiting_for_prior_transaction_to_commit= { 0, "Waiting for prior transaction to start commit before starting next transaction", 0}; +PSI_stage_info stage_waiting_for_prior_transaction_to_commit= { 0, "Waiting for prior transaction to commit", 0}; +PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit= { 0, "Waiting for prior transaction to start commit before starting next transaction", 0}; PSI_stage_info stage_waiting_for_room_in_worker_thread= { 0, "Waiting for room in worker thread event queue", 0}; PSI_stage_info stage_master_gtid_wait_primary= { 0, "Waiting in MASTER_GTID_WAIT() (primary waiter)", 0}; PSI_stage_info stage_master_gtid_wait= { 0, "Waiting in MASTER_GTID_WAIT()", 0}; @@ -10403,6 +10416,7 @@ PSI_stage_info *all_server_stages[]= & stage_waiting_for_master_to_send_event, & stage_waiting_for_master_update, & stage_waiting_for_prior_transaction_to_commit, + & stage_waiting_for_prior_transaction_to_start_commit, & stage_waiting_for_query_cache_lock, & stage_waiting_for_relay_log_space, & stage_waiting_for_room_in_worker_thread, diff --git a/sql/mysqld.h b/sql/mysqld.h index 8458d335ea0..860800cb725 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -453,6 +453,7 @@ extern PSI_stage_info stage_binlog_processing_checkpoint_notify; extern PSI_stage_info stage_binlog_stopping_background_thread; extern PSI_stage_info stage_waiting_for_work_from_sql_thread; extern PSI_stage_info stage_waiting_for_prior_transaction_to_commit; +extern PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit; extern PSI_stage_info stage_waiting_for_room_in_worker_thread; extern PSI_stage_info stage_master_gtid_wait_primary; extern PSI_stage_info stage_master_gtid_wait; @@ -597,6 +598,7 @@ enum options_mysqld OPT_SSL_CRL, OPT_SSL_CRLPATH, OPT_SSL_KEY, + OPT_THREAD_CONCURRENCY, OPT_WANT_CORE, OPT_MYSQL_COMPATIBILITY, OPT_MYSQL_TO_BE_IMPLEMENTED, diff --git a/sql/net_serv.cc b/sql/net_serv.cc index eb34fcc2d77..29b8417c698 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -43,7 +43,6 @@ #include #include #include -#include #include "probes_mysql.h" #ifdef EMBEDDED_LIBRARY diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b38b048c344..a5c27fa66e2 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -108,6 +108,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "key.h" // is_key_used, key_copy, key_cmp, key_restore #include "sql_parse.h" // check_stack_overrun @@ -3486,6 +3487,8 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) my_bitmap_init(&handled_columns, buf, table->s->fields, FALSE); /* + Calculate the selectivity of the range conditions supported by indexes. + First, take into account possible range accesses. range access estimates are the most precise, we prefer them to any other estimate sources. @@ -3531,6 +3534,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) break; bitmap_set_bit(&handled_columns, key_part->fieldnr-1); } + double selectivity_mult; if (i) { /* @@ -3546,8 +3550,34 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) */ double f1= key_info->actual_rec_per_key(i-1); double f2= key_info->actual_rec_per_key(i); - table->cond_selectivity*= f1 / f2; + if (f1 > 0 && f2 > 0) + selectivity_mult= f1 / f2; + else + { + /* + No statistics available, assume the selectivity is proportional + to the number of key parts. + (i=0 means 1 keypart, i=1 means 2 keyparts, so use i+1) + */ + selectivity_mult= ((double)(i+1)) / i; + } + table->cond_selectivity*= selectivity_mult; } + /* + We need to set selectivity for fields supported by indexes. + For single-component indexes and for some first components + of other indexes we do it here. For the remaining fields + we do it later in this function, in the same way as for the + fields not used in any indexes. + */ + if (i == 1) + { + uint fieldnr= key_info->key_part[0].fieldnr; + table->field[fieldnr-1]->cond_selectivity= quick_cond_selectivity; + if (i != used_key_parts) + table->field[fieldnr-1]->cond_selectivity*= selectivity_mult; + bitmap_clear_bit(used_fields, fieldnr-1); + } } } } @@ -3555,10 +3585,9 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) /* Second step: calculate the selectivity of the range conditions not - supported by any index + supported by any index and selectivity of the range condition + over the fields whose selectivity has not been set yet. */ - bitmap_subtract(used_fields, &handled_columns); - /* no need to do: my_bitmap_free(&handled_columns); */ if (thd->variables.optimizer_use_condition_selectivity > 2 && !bitmap_is_clear_all(used_fields)) @@ -3634,9 +3663,12 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) for (Field **field_ptr= table->field; *field_ptr; field_ptr++) { Field *table_field= *field_ptr; - if (bitmap_is_set(table->read_set, table_field->field_index) && + if (bitmap_is_set(used_fields, table_field->field_index) && table_field->cond_selectivity < 1.0) - table->cond_selectivity*= table_field->cond_selectivity; + { + if (!bitmap_is_set(&handled_columns, table_field->field_index)) + table->cond_selectivity*= table_field->cond_selectivity; + } } free_alloc: @@ -3645,10 +3677,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) } - /* Calculate the selectivity of the range conditions supported by indexes */ - - bitmap_clear_all(used_fields); - + bitmap_union(used_fields, &handled_columns); /* Check if we can improve selectivity estimates by using sampling */ ulong check_rows= @@ -3736,6 +3765,11 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item *cond) field Field which key image should be stored ptr Field value in key format len Length of the value, in bytes + + ATTENTION + len is the length of the value not counting the NULL-byte (at the same + time, ptr points to the key image, which starts with NULL-byte for + nullable columns) DESCRIPTION Copy the field value from its key image to the table record. The source @@ -8218,6 +8252,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, !(conf_func->compare_collation()->state & MY_CS_BINSORT && (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC))) goto end; + if (value->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT) + goto end; if (key_part->image_type == Field::itMBR) { @@ -12765,11 +12801,11 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) uint cur_used_key_parts; /* - Check (B1) - if current index is covering. Exclude UNIQUE indexes, because - loose scan may still be chosen for them due to imperfect cost calculations. + Check (B1) - if current index is covering. + (was also: "Exclude UNIQUE indexes ..." but this was removed because + there are cases Loose Scan over a multi-part index is useful). */ - if (!table->covering_keys.is_set(cur_index) || - cur_index_info->flags & HA_NOSAME) + if (!table->covering_keys.is_set(cur_index)) goto next_index; /* @@ -12907,6 +12943,16 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) min_max_arg_part= cur_index_info->key_part + key_part_nr - 1; } + /* + Aplly a heuristic: there is no point to use loose index scan when we're + using the whole unique index. + */ + if (cur_index_info->flags & HA_NOSAME && + cur_group_key_parts == cur_index_info->user_defined_key_parts) + { + goto next_index; + } + /* Check (NGA1, NGA2) and extract a sequence of constants to be used as part of all search keys. @@ -13284,16 +13330,31 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, DBUG_RETURN(FALSE); /* Check for compatible string comparisons - similar to get_mm_leaf. */ - if (args[0] && args[1] && !args[2] && // this is a binary function - min_max_arg_item->result_type() == STRING_RESULT && - /* - Don't use an index when comparing strings of different collations. - */ - ((args[1]->result_type() == STRING_RESULT && - image_type == Field::itRAW && - min_max_arg_item->field->charset() != - pred->compare_collation()) - || + if (args[0] && args[1] && !args[2]) // this is a binary function + { + if (args[1]->cmp_type() == TIME_RESULT && + min_max_arg_item->field->cmp_type() != TIME_RESULT) + DBUG_RETURN(FALSE); + + /* + Can't use GROUP_MIN_MAX optimization for ENUM and SET, + because the values are stored as numbers in index, + while MIN() and MAX() work as strings. + It would return the records with min and max enum numeric indexes. + "Bug#45300 MAX() and ENUM type" should be fixed first. + */ + if (min_max_arg_item->field->real_type() == MYSQL_TYPE_ENUM || + min_max_arg_item->field->real_type() == MYSQL_TYPE_SET) + DBUG_RETURN(FALSE); + + if (min_max_arg_item->result_type() == STRING_RESULT && + /* + Don't use an index when comparing strings of different collations. + */ + ((args[1]->result_type() == STRING_RESULT && + image_type == Field::itRAW && + min_max_arg_item->field->charset() != + pred->compare_collation()) || /* We can't always use indexes when comparing a string index to a number. @@ -13301,6 +13362,7 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item, (args[1]->result_type() != STRING_RESULT && min_max_arg_item->field->cmp_type() != args[1]->result_type()))) DBUG_RETURN(FALSE); + } } else has_other= true; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 6e65b5ea177..7d1f6dfbf9d 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -26,6 +26,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_base.h" #include "sql_select.h" #include "filesort.h" diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 4e8fcefa6d2..fc3ce09dd8e 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -48,6 +48,7 @@ (assuming a index for column d of table t2 is defined) */ +#include #include "sql_priv.h" #include "key.h" // key_cmp_if_same #include "sql_select.h" diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 2ef565517b5..6434c36aaf2 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -1486,6 +1486,8 @@ void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod, left->real_item()->type() == Item::FIELD_ITEM) { Field *field= ((Item_field*)left->real_item())->field; + if (right->cmp_type() == TIME_RESULT && field->cmp_type() != TIME_RESULT) + return; if (field->result_type() == STRING_RESULT) { if (right->result_type() != STRING_RESULT) @@ -1499,7 +1501,9 @@ void check_equality(Dep_analysis_context *ctx, Dep_module_expr **eq_mod, We can't assume there's a functional dependency if the effective collation of the operation differ from the field collation. */ - if (field->cmp_type() == STRING_RESULT && + if ((field->cmp_type() == STRING_RESULT || + field->real_type() == MYSQL_TYPE_ENUM || + field->real_type() == MYSQL_TYPE_SET) && field->charset() != cond->compare_collation()) return; } diff --git a/sql/parse_file.cc b/sql/parse_file.cc index a6e3aa7ed66..ee031c1bbc2 100644 --- a/sql/parse_file.cc +++ b/sql/parse_file.cc @@ -20,11 +20,11 @@ Text .frm files management routines */ +#include #include "sql_priv.h" #include "parse_file.h" #include "unireg.h" // CREATE_MODE #include "sql_table.h" // build_table_filename -#include #include #include #include diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 98e796879ad..73b88d64224 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -19,6 +19,7 @@ #pragma implementation #endif +#include #include "sql_priv.h" // Required to get server definitions for mysql/plugin.h right #include "sql_plugin.h" diff --git a/sql/procedure.cc b/sql/procedure.cc index bdaced20586..8f9d6c0a7f3 100644 --- a/sql/procedure.cc +++ b/sql/procedure.cc @@ -20,6 +20,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "procedure.h" #include "sql_analyse.h" // Includes procedure diff --git a/sql/protocol.cc b/sql/protocol.cc index af2accfd146..b2561f9ca11 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -25,6 +25,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "protocol.h" diff --git a/sql/records.cc b/sql/records.cc index cce6272a4e3..bfce2f83967 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -25,6 +25,7 @@ Functions for easy reading of records, possible through a cache */ +#include #include "records.h" #include "sql_priv.h" #include "records.h" diff --git a/sql/records.h b/sql/records.h index 57467d665d4..21477d4a30b 100644 --- a/sql/records.h +++ b/sql/records.h @@ -18,7 +18,6 @@ #ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif -#include /* for uint typedefs */ struct st_join_table; class handler; diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 334de1337d6..3c99becf304 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -24,6 +24,7 @@ functions like register_slave()) are working. */ +#include #include "sql_priv.h" #include "sql_parse.h" // check_access #ifdef HAVE_REPLICATION diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 2b4a3093e0f..28859c2eb85 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "mysqld.h" // system_charset_info #include "rpl_filter.h" diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index c8d5e2a2db0..e5620ec41a2 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -16,7 +16,7 @@ /* Definitions for MariaDB global transaction ID (GTID). */ - +#include #include "sql_priv.h" #include "my_sys.h" #include "unireg.h" diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 34d3df23435..09e221e9bd5 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index a4b04d2e047..19b193729fd 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED by later includes #include "rpl_injector.h" diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index cda224ff01b..7c273d51a19 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -8,6 +8,15 @@ Code for optional parallel execution of replicated events on the slave. */ + +/* + Maximum number of queued events to accumulate in a local free list, before + moving them to the global free list. There is additional a limit of how much + to accumulate based on opt_slave_parallel_max_queued. +*/ +#define QEV_BATCH_FREE 200 + + struct rpl_parallel_thread_pool global_rpl_thread_pool; static void signal_error_to_sql_driver_thread(THD *thd, rpl_group_info *rgi, @@ -290,6 +299,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt, THD *thd= rgi->thd; rpl_parallel_entry *entry= rgi->parallel_entry; ulong retries= 0; + Format_description_log_event *description_event= NULL; do_retry: event_count= 0; @@ -355,6 +365,14 @@ do_retry: goto err; } cur_offset= rgi->retry_start_offset; + delete description_event; + description_event= + read_relay_log_description_event(&rlog, cur_offset, &errmsg); + if (!description_event) + { + err= 1; + goto err; + } my_b_seek(&rlog, cur_offset); do @@ -367,8 +385,7 @@ do_retry: for (;;) { old_offset= cur_offset; - ev= Log_event::read_log_event(&rlog, 0, - rli->relay_log.description_event_for_exec /* ToDo: this needs fixing */, + ev= Log_event::read_log_event(&rlog, 0, description_event, opt_slave_sql_verify_checksum); cur_offset= my_b_tell(&rlog); @@ -416,7 +433,12 @@ do_retry: } event_type= ev->get_type_code(); - if (!Log_event::is_group_event(event_type)) + if (event_type == FORMAT_DESCRIPTION_EVENT) + { + delete description_event; + description_event= (Format_description_log_event *)ev; + continue; + } else if (!Log_event::is_group_event(event_type)) { delete ev; continue; @@ -424,7 +446,7 @@ do_retry: ev->thd= thd; mysql_mutex_lock(&rpt->LOCK_rpl_thread); - qev= rpt->retry_get_qev(ev, orig_qev, log_name, cur_offset, + qev= rpt->retry_get_qev(ev, orig_qev, log_name, old_offset, cur_offset - old_offset); mysql_mutex_unlock(&rpt->LOCK_rpl_thread); if (!qev) @@ -472,6 +494,8 @@ do_retry: err: + if (description_event) + delete description_event; if (fd >= 0) { end_io_cache(&rlog); @@ -495,14 +519,8 @@ handle_rpl_parallel_thread(void *arg) rpl_group_info *group_rgi= NULL; group_commit_orderer *gco, *tmp_gco; uint64 event_gtid_sub_id= 0; - rpl_parallel_thread::queued_event *qevs_to_free; - rpl_group_info *rgis_to_free; - group_commit_orderer *gcos_to_free; rpl_sql_thread_info sql_info(NULL); - size_t total_event_size; int err; - inuse_relaylog *last_ir; - uint64 accumulated_ir_count; struct rpl_parallel_thread *rpt= (struct rpl_parallel_thread *)arg; @@ -544,6 +562,8 @@ handle_rpl_parallel_thread(void *arg) while (!rpt->stop) { + rpl_parallel_thread::queued_event *qev, *next_qev; + thd->ENTER_COND(&rpt->COND_rpl_thread, &rpt->LOCK_rpl_thread, &stage_waiting_for_work_from_sql_thread, &old_stage); /* @@ -565,28 +585,21 @@ handle_rpl_parallel_thread(void *arg) thd->EXIT_COND(&old_stage); more_events: - qevs_to_free= NULL; - rgis_to_free= NULL; - gcos_to_free= NULL; - total_event_size= 0; - while (events) + for (qev= events; qev; qev= next_qev) { - struct rpl_parallel_thread::queued_event *next= events->next; Log_event_type event_type; - rpl_group_info *rgi= events->rgi; + rpl_group_info *rgi= qev->rgi; rpl_parallel_entry *entry= rgi->parallel_entry; bool end_of_group, group_ending; - total_event_size+= events->event_size; - if (events->typ == rpl_parallel_thread::queued_event::QUEUED_POS_UPDATE) + next_qev= qev->next; + if (qev->typ == rpl_parallel_thread::queued_event::QUEUED_POS_UPDATE) { - handle_queued_pos_update(thd, events); - events->next= qevs_to_free; - qevs_to_free= events; - events= next; + handle_queued_pos_update(thd, qev); + rpt->loc_free_qev(qev); continue; } - else if (events->typ == + else if (qev->typ == rpl_parallel_thread::queued_event::QUEUED_MASTER_RESTART) { if (in_event_group) @@ -598,24 +611,21 @@ handle_rpl_parallel_thread(void *arg) group_rgi->cleanup_context(thd, 1); in_event_group= false; finish_event_group(thd, group_rgi->gtid_sub_id, - events->entry_for_queued, group_rgi); + qev->entry_for_queued, group_rgi); - group_rgi->next= rgis_to_free; - rgis_to_free= group_rgi; + rpt->loc_free_rgi(group_rgi); thd->rgi_slave= group_rgi= NULL; } - events->next= qevs_to_free; - qevs_to_free= events; - events= next; + rpt->loc_free_qev(qev); continue; } - DBUG_ASSERT(events->typ==rpl_parallel_thread::queued_event::QUEUED_EVENT); + DBUG_ASSERT(qev->typ==rpl_parallel_thread::queued_event::QUEUED_EVENT); thd->rgi_slave= group_rgi= rgi; gco= rgi->gco; /* Handle a new event group, which will be initiated by a GTID event. */ - if ((event_type= events->ev->get_type_code()) == GTID_EVENT) + if ((event_type= qev->ev->get_type_code()) == GTID_EVENT) { bool did_enter_cond= false; PSI_stage_info old_stage; @@ -628,7 +638,7 @@ handle_rpl_parallel_thread(void *arg) similar), without any terminating COMMIT/ROLLBACK/XID. */ group_standalone= - (0 != (static_cast(events->ev)->flags2 & + (0 != (static_cast(qev->ev)->flags2 & Gtid_log_event::FL_STANDALONE)); event_gtid_sub_id= rgi->gtid_sub_id; @@ -656,7 +666,7 @@ handle_rpl_parallel_thread(void *arg) DEBUG_SYNC(thd, "rpl_parallel_start_waiting_for_prior"); thd->ENTER_COND(&gco->COND_group_commit_orderer, &entry->LOCK_parallel_entry, - &stage_waiting_for_prior_transaction_to_commit, + &stage_waiting_for_prior_transaction_to_start_commit, &old_stage); did_enter_cond= true; do @@ -689,8 +699,7 @@ handle_rpl_parallel_thread(void *arg) */ DBUG_ASSERT(!tmp_gco->prev_gco); gco->prev_gco= NULL; - tmp_gco->next_gco= gcos_to_free; - gcos_to_free= tmp_gco; + rpt->loc_free_gco(tmp_gco); } if (entry->force_abort && wait_count > entry->stop_count) @@ -751,7 +760,7 @@ handle_rpl_parallel_thread(void *arg) } } - group_ending= is_group_ending(events->ev, event_type); + group_ending= is_group_ending(qev->ev, event_type); if (group_ending && likely(!rgi->worker_error)) { DEBUG_SYNC(thd, "rpl_parallel_before_mark_start_commit"); @@ -767,20 +776,32 @@ handle_rpl_parallel_thread(void *arg) if (likely(!rgi->worker_error) && !skip_event_group) { ++rgi->retry_event_count; - err= rpt_handle_event(events, rpt); - delete_or_keep_event_post_apply(rgi, event_type, events->ev); +#ifndef DBUG_OFF + err= 0; + DBUG_EXECUTE_IF("rpl_parallel_simulate_temp_err_xid", + if (event_type == XID_EVENT) + { + thd->clear_error(); + thd->get_stmt_da()->reset_diagnostics_area(); + my_error(ER_LOCK_DEADLOCK, MYF(0)); + err= 1; + }); + if (!err) +#endif + err= rpt_handle_event(qev, rpt); + delete_or_keep_event_post_apply(rgi, event_type, qev->ev); DBUG_EXECUTE_IF("rpl_parallel_simulate_temp_err_gtid_0_x_100", err= dbug_simulate_tmp_error(rgi, thd);); if (err) { convert_kill_to_deadlock_error(rgi); if (has_temporary_error(thd) && slave_trans_retries > 0) - err= retry_event_group(rgi, rpt, events); + err= retry_event_group(rgi, rpt, qev); } } else { - delete events->ev; + delete qev->ev; err= thd->wait_for_prior_commit(); } @@ -789,8 +810,7 @@ handle_rpl_parallel_thread(void *arg) ((group_standalone && !Log_event::is_part_of_group(event_type)) || group_ending); - events->next= qevs_to_free; - qevs_to_free= events; + rpt->loc_free_qev(qev); if (unlikely(err)) { @@ -805,61 +825,20 @@ handle_rpl_parallel_thread(void *arg) { in_event_group= false; finish_event_group(thd, event_gtid_sub_id, entry, rgi); - rgi->next= rgis_to_free; - rgis_to_free= rgi; + rpt->loc_free_rgi(rgi); thd->rgi_slave= group_rgi= rgi= NULL; skip_event_group= false; DEBUG_SYNC(thd, "rpl_parallel_end_of_group"); } - - events= next; } mysql_mutex_lock(&rpt->LOCK_rpl_thread); - /* Signal that our queue can now accept more events. */ - rpt->dequeue2(total_event_size); - mysql_cond_signal(&rpt->COND_rpl_thread_queue); - /* We need to delay the free here, to when we have the lock. */ - while (gcos_to_free) - { - group_commit_orderer *next= gcos_to_free->next_gco; - rpt->free_gco(gcos_to_free); - gcos_to_free= next; - } - while (rgis_to_free) - { - rpl_group_info *next= rgis_to_free->next; - rpt->free_rgi(rgis_to_free); - rgis_to_free= next; - } - last_ir= NULL; - accumulated_ir_count= 0; - while (qevs_to_free) - { - rpl_parallel_thread::queued_event *next= qevs_to_free->next; - inuse_relaylog *ir= qevs_to_free->ir; - /* Batch up refcount update to reduce use of synchronised operations. */ - if (last_ir != ir) - { - if (last_ir) - { - my_atomic_rwlock_wrlock(&last_ir->inuse_relaylog_atomic_lock); - my_atomic_add64(&last_ir->dequeued_count, accumulated_ir_count); - my_atomic_rwlock_wrunlock(&last_ir->inuse_relaylog_atomic_lock); - accumulated_ir_count= 0; - } - last_ir= ir; - } - ++accumulated_ir_count; - rpt->free_qev(qevs_to_free); - qevs_to_free= next; - } - if (last_ir) - { - my_atomic_rwlock_wrlock(&last_ir->inuse_relaylog_atomic_lock); - my_atomic_add64(&last_ir->dequeued_count, accumulated_ir_count); - my_atomic_rwlock_wrunlock(&last_ir->inuse_relaylog_atomic_lock); - } + /* + Now that we have the lock, we can move everything from our local free + lists to the real free lists that are also accessible from the SQL + driver thread. + */ + rpt->batch_free(); if ((events= rpt->event_queue) != NULL) { @@ -872,6 +851,7 @@ handle_rpl_parallel_thread(void *arg) mysql_mutex_unlock(&rpt->LOCK_rpl_thread); goto more_events; } + rpt->inuse_relaylog_refcount_update(); if (in_event_group && group_rgi->parallel_entry->force_abort) { @@ -1107,6 +1087,51 @@ err: } +void +rpl_parallel_thread::batch_free() +{ + mysql_mutex_assert_owner(&LOCK_rpl_thread); + if (loc_qev_list) + { + *loc_qev_last_ptr_ptr= qev_free_list; + qev_free_list= loc_qev_list; + loc_qev_list= NULL; + dequeue2(loc_qev_size); + /* Signal that our queue can now accept more events. */ + mysql_cond_signal(&COND_rpl_thread_queue); + loc_qev_size= 0; + qev_free_pending= 0; + } + if (loc_rgi_list) + { + *loc_rgi_last_ptr_ptr= rgi_free_list; + rgi_free_list= loc_rgi_list; + loc_rgi_list= NULL; + } + if (loc_gco_list) + { + *loc_gco_last_ptr_ptr= gco_free_list; + gco_free_list= loc_gco_list; + loc_gco_list= NULL; + } +} + + +void +rpl_parallel_thread::inuse_relaylog_refcount_update() +{ + inuse_relaylog *ir= accumulated_ir_last; + if (ir) + { + my_atomic_rwlock_wrlock(&ir->rli->inuse_relaylog_atomic_lock); + my_atomic_add64(&ir->dequeued_count, accumulated_ir_count); + my_atomic_rwlock_wrunlock(&ir->rli->inuse_relaylog_atomic_lock); + accumulated_ir_count= 0; + accumulated_ir_last= NULL; + } +} + + rpl_parallel_thread::queued_event * rpl_parallel_thread::get_qev_common(Log_event *ev, ulonglong event_size) { @@ -1160,6 +1185,43 @@ rpl_parallel_thread::retry_get_qev(Log_event *ev, queued_event *orig_qev, } +void +rpl_parallel_thread::loc_free_qev(rpl_parallel_thread::queued_event *qev) +{ + inuse_relaylog *ir= qev->ir; + inuse_relaylog *last_ir= accumulated_ir_last; + if (ir != last_ir) + { + if (last_ir) + inuse_relaylog_refcount_update(); + accumulated_ir_last= ir; + } + ++accumulated_ir_count; + if (!loc_qev_list) + loc_qev_last_ptr_ptr= &qev->next; + else + qev->next= loc_qev_list; + loc_qev_list= qev; + loc_qev_size+= qev->event_size; + /* + We want to release to the global free list only occasionally, to avoid + having to take the LOCK_rpl_thread muted too many times. + + However, we do need to release regularly. If we let the unreleased part + grow too large, then the SQL driver thread may go to sleep waiting for + the queue to drop below opt_slave_parallel_max_queued, and this in turn + can stall all other worker threads for more stuff to do. + */ + if (++qev_free_pending >= QEV_BATCH_FREE || + loc_qev_size >= opt_slave_parallel_max_queued/3) + { + mysql_mutex_lock(&LOCK_rpl_thread); + batch_free(); + mysql_mutex_unlock(&LOCK_rpl_thread); + } +} + + void rpl_parallel_thread::free_qev(rpl_parallel_thread::queued_event *qev) { @@ -1208,6 +1270,19 @@ rpl_parallel_thread::get_rgi(Relay_log_info *rli, Gtid_log_event *gtid_ev, } +void +rpl_parallel_thread::loc_free_rgi(rpl_group_info *rgi) +{ + DBUG_ASSERT(rgi->commit_orderer.waitee == NULL); + rgi->free_annotate_event(); + if (!loc_rgi_list) + loc_rgi_last_ptr_ptr= &rgi->next; + else + rgi->next= loc_rgi_list; + loc_rgi_list= rgi; +} + + void rpl_parallel_thread::free_rgi(rpl_group_info *rgi) { @@ -1242,12 +1317,14 @@ rpl_parallel_thread::get_gco(uint64 wait_count, group_commit_orderer *prev) void -rpl_parallel_thread::free_gco(group_commit_orderer *gco) +rpl_parallel_thread::loc_free_gco(group_commit_orderer *gco) { - mysql_mutex_assert_owner(&LOCK_rpl_thread); DBUG_ASSERT(!gco->prev_gco /* Must not free until wait has completed. */); - gco->next_gco= gco_free_list; - gco_free_list= gco; + if (!loc_gco_list) + loc_gco_last_ptr_ptr= &gco->next_gco; + else + gco->next_gco= loc_gco_list; + loc_gco_list= gco; } @@ -1683,6 +1760,7 @@ rpl_parallel_entry::queue_master_restart(rpl_group_info *rgi, qev->ir= rli->last_inuse_relaylog; ++qev->ir->queued_count; thr->enqueue(qev); + mysql_cond_signal(&thr->COND_rpl_thread); mysql_mutex_unlock(&thr->LOCK_rpl_thread); return 0; } diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index b114ee4ebcb..239818855b8 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -96,9 +96,28 @@ struct rpl_parallel_thread { size_t event_size; } *event_queue, *last_in_queue; uint64 queued_size; + /* These free lists are protected by LOCK_rpl_thread. */ queued_event *qev_free_list; rpl_group_info *rgi_free_list; group_commit_orderer *gco_free_list; + /* + These free lists are local to the thread, so need not be protected by any + lock. They are moved to the global free lists in batches in the function + batch_free(), to reduce LOCK_rpl_thread contention. + + The lists are not NULL-terminated (as we do not need to traverse them). + Instead, if they are non-NULL, the loc_XXX_last_ptr_ptr points to the + `next' pointer of the last element, which is used to link into the front + of the global freelists. + */ + queued_event *loc_qev_list, **loc_qev_last_ptr_ptr; + size_t loc_qev_size; + uint64 qev_free_pending; + rpl_group_info *loc_rgi_list, **loc_rgi_last_ptr_ptr; + group_commit_orderer *loc_gco_list, **loc_gco_last_ptr_ptr; + /* These keep track of batch update of inuse_relaylog refcounts. */ + inuse_relaylog *accumulated_ir_last; + uint64 accumulated_ir_count; void enqueue(queued_event *qev) { @@ -127,12 +146,41 @@ struct rpl_parallel_thread { queued_event *retry_get_qev(Log_event *ev, queued_event *orig_qev, const char *relay_log_name, ulonglong event_pos, ulonglong event_size); + /* + Put a qev on the local free list, to be later released to the global free + list by batch_free(). + */ + void loc_free_qev(queued_event *qev); + /* + Release an rgi immediately to the global free list. Requires holding the + LOCK_rpl_thread mutex. + */ void free_qev(queued_event *qev); rpl_group_info *get_rgi(Relay_log_info *rli, Gtid_log_event *gtid_ev, rpl_parallel_entry *e, ulonglong event_size); + /* + Put an gco on the local free list, to be later released to the global free + list by batch_free(). + */ + void loc_free_rgi(rpl_group_info *rgi); + /* + Release an rgi immediately to the global free list. Requires holding the + LOCK_rpl_thread mutex. + */ void free_rgi(rpl_group_info *rgi); group_commit_orderer *get_gco(uint64 wait_count, group_commit_orderer *prev); - void free_gco(group_commit_orderer *gco); + /* + Put a gco on the local free list, to be later released to the global free + list by batch_free(). + */ + void loc_free_gco(group_commit_orderer *gco); + /* + Move all local free lists to the global ones. Requires holding + LOCK_rpl_thread. + */ + void batch_free(); + /* Update inuse_relaylog refcounts with what we have accumulated so far. */ + void inuse_relaylog_refcount_update(); }; diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 991c918ea7f..633e71a963c 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "rpl_rli.h" diff --git a/sql/rpl_record_old.cc b/sql/rpl_record_old.cc index 8b43b268c17..061fab78dbd 100644 --- a/sql/rpl_record_old.cc +++ b/sql/rpl_record_old.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED by other includes #include "rpl_rli.h" diff --git a/sql/rpl_reporting.cc b/sql/rpl_reporting.cc index eb362941f3e..49708df40f7 100644 --- a/sql/rpl_reporting.cc +++ b/sql/rpl_reporting.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "rpl_reporting.h" #include "log.h" // sql_print_error, sql_print_warning, diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 754b877f654..d21ebd494c1 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ +#include #include "sql_priv.h" #include "unireg.h" // HAVE_* #include "rpl_mi.h" @@ -517,6 +518,90 @@ void Relay_log_info::clear_until_condition() } +/* + Read the correct format description event for starting to replicate from + a given position in a relay log file. +*/ +Format_description_log_event * +read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos, + const char **errmsg) +{ + Log_event *ev; + Format_description_log_event *fdev; + bool found= false; + + /* + By default the relay log is in binlog format 3 (4.0). + Even if format is 4, this will work enough to read the first event + (Format_desc) (remember that format 4 is just lenghtened compared to format + 3; format 3 is a prefix of format 4). + */ + fdev= new Format_description_log_event(3); + + while (!found) + { + Log_event_type typ; + + /* + Read the possible Format_description_log_event; if position + was 4, no need, it will be read naturally. + */ + DBUG_PRINT("info",("looking for a Format_description_log_event")); + + if (my_b_tell(cur_log) >= start_pos) + break; + + if (!(ev= Log_event::read_log_event(cur_log, 0, fdev, + opt_slave_sql_verify_checksum))) + { + DBUG_PRINT("info",("could not read event, cur_log->error=%d", + cur_log->error)); + if (cur_log->error) /* not EOF */ + { + *errmsg= "I/O error reading event at position 4"; + delete fdev; + return NULL; + } + break; + } + typ= ev->get_type_code(); + if (typ == FORMAT_DESCRIPTION_EVENT) + { + DBUG_PRINT("info",("found Format_description_log_event")); + delete fdev; + fdev= (Format_description_log_event*) ev; + /* + As ev was returned by read_log_event, it has passed is_valid(), so + my_malloc() in ctor worked, no need to check again. + */ + /* + Ok, we found a Format_description event. But it is not sure that this + describes the whole relay log; indeed, one can have this sequence + (starting from position 4): + Format_desc (of slave) + Rotate (of master) + Format_desc (of master) + So the Format_desc which really describes the rest of the relay log + is the 3rd event (it can't be further than that, because we rotate + the relay log when we queue a Rotate event from the master). + But what describes the Rotate is the first Format_desc. + So what we do is: + go on searching for Format_description events, until you exceed the + position (argument 'pos') or until you find another event than Rotate + or Format_desc. + */ + } + else + { + DBUG_PRINT("info",("found event of another type=%d", typ)); + found= (typ != ROTATE_EVENT); + delete ev; + } + } + return fdev; +} + + /* Open the given relay log @@ -640,68 +725,13 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log, */ if (pos > BIN_LOG_HEADER_SIZE) /* If pos<=4, we stay at 4 */ { - Log_event* ev; - while (look_for_description_event) + if (look_for_description_event) { - /* - Read the possible Format_description_log_event; if position - was 4, no need, it will be read naturally. - */ - DBUG_PRINT("info",("looking for a Format_description_log_event")); - - if (my_b_tell(rli->cur_log) >= pos) - break; - - /* - Because of we have rli->data_lock and log_lock, we can safely read an - event - */ - if (!(ev= Log_event::read_log_event(rli->cur_log, 0, - rli->relay_log.description_event_for_exec, - opt_slave_sql_verify_checksum))) - { - DBUG_PRINT("info",("could not read event, rli->cur_log->error=%d", - rli->cur_log->error)); - if (rli->cur_log->error) /* not EOF */ - { - *errmsg= "I/O error reading event at position 4"; - goto err; - } - break; - } - else if (ev->get_type_code() == FORMAT_DESCRIPTION_EVENT) - { - DBUG_PRINT("info",("found Format_description_log_event")); - delete rli->relay_log.description_event_for_exec; - rli->relay_log.description_event_for_exec= (Format_description_log_event*) ev; - /* - As ev was returned by read_log_event, it has passed is_valid(), so - my_malloc() in ctor worked, no need to check again. - */ - /* - Ok, we found a Format_description event. But it is not sure that this - describes the whole relay log; indeed, one can have this sequence - (starting from position 4): - Format_desc (of slave) - Rotate (of master) - Format_desc (of master) - So the Format_desc which really describes the rest of the relay log - is the 3rd event (it can't be further than that, because we rotate - the relay log when we queue a Rotate event from the master). - But what describes the Rotate is the first Format_desc. - So what we do is: - go on searching for Format_description events, until you exceed the - position (argument 'pos') or until you find another event than Rotate - or Format_desc. - */ - } - else - { - DBUG_PRINT("info",("found event of another type=%d", - ev->get_type_code())); - look_for_description_event= (ev->get_type_code() == ROTATE_EVENT); - delete ev; - } + Format_description_log_event *fdev; + if (!(fdev= read_relay_log_description_event(rli->cur_log, pos, errmsg))) + goto err; + delete rli->relay_log.description_event_for_exec; + rli->relay_log.description_event_for_exec= fdev; } my_b_seek(rli->cur_log,(off_t)pos); #ifndef DBUG_OFF @@ -1360,6 +1390,7 @@ Relay_log_info::alloc_inuse_relaylog(const char *name) my_error(ER_OUTOFMEMORY, MYF(0), (int)sizeof(*ir)); return 1; } + ir->rli= this; strmake_buf(ir->name, name); if (!inuse_relaylog_list) diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 3a8d87030ad..9885417aa3f 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -496,6 +496,7 @@ private: */ struct inuse_relaylog { inuse_relaylog *next; + Relay_log_info *rli; /* Number of events in this relay log queued for worker threads. */ int64 queued_count; /* Number of events completed by worker threads. */ diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc index 7b55911d887..4c521cf0c16 100644 --- a/sql/rpl_tblmap.cc +++ b/sql/rpl_tblmap.cc @@ -13,8 +13,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" -#include "my_global.h" // HAVE_REPLICATION #ifdef HAVE_REPLICATION diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 25dff72090c..9067f1e4253 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "rpl_utility.h" #include "log_event.h" diff --git a/sql/set_var.cc b/sql/set_var.cc index d1121741821..7ad528f0eae 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -16,7 +16,7 @@ /* variable declarations are in sys_vars.cc now !!! */ -#include "sql_plugin.h" +#include "sql_plugin.h" // Includes my_global.h #include "sql_class.h" // set_var.h: session_var_ptr #include "set_var.h" #include "sql_priv.h" diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 76cf33c231f..4980ba06604 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6440,11 +6440,11 @@ ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT ER_BINLOG_UNSAFE_UPDATE_IGNORE eng "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." -ER_PLUGIN_NO_UNINSTALL - eng "Plugin '%s' is marked as not dynamically uninstallable. You have to stop the server to uninstall it." +ER_UNUSED_13 + eng "You should never see it" -ER_PLUGIN_NO_INSTALL - eng "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it." +ER_UNUSED_14 + eng "You should never see it" ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT eng "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave." diff --git a/sql/slave.cc b/sql/slave.cc index 0f2d9f1d3d4..c569499fdcf 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -25,8 +25,8 @@ replication slave. */ +#include #include "sql_priv.h" -#include "my_global.h" #include "slave.h" #include "sql_parse.h" // execute_init_command #include "sql_table.h" // mysql_rm_table diff --git a/sql/slave.h b/sql/slave.h index e65b4a589a1..e16f801b577 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -220,6 +220,10 @@ void end_relay_log_info(Relay_log_info* rli); void lock_slave_threads(Master_info* mi); void unlock_slave_threads(Master_info* mi); void init_thread_mask(int* mask,Master_info* mi,bool inverse); +Format_description_log_event * +read_relay_log_description_event(IO_CACHE *cur_log, ulonglong start_pos, + const char **errmsg); + int init_relay_log_pos(Relay_log_info* rli,const char* log,ulonglong pos, bool need_data_lock, const char** errmsg, bool look_for_description_event); diff --git a/sql/sp.cc b/sql/sp.cc index b5b543ead0e..bd318d28b02 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sp.h" diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index 14f49ecc077..bafd0f34ab6 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #ifdef USE_PRAGMA_IMPLEMENTATION diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 13f7facedea..d59e0aec541 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_prepare.h" diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 7c44e675811..11954921e06 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #ifdef USE_PRAGMA_IMPLEMENTATION diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index 42476f7a596..a5a6a61f73c 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #ifdef USE_PRAGMA_IMPLEMENTATION diff --git a/sql/spatial.cc b/sql/spatial.cc index 34d2417f632..bfe302f332e 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -15,8 +15,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" -#include "my_global.h" // REQUIRED for HAVE_* below #include "spatial.h" #include "gstream.h" // Gis_read_stream #include "sql_string.h" // String @@ -1237,11 +1237,15 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const trn->start_ring(); get_point(&first_x, &first_y, data); data+= POINT_DATA_SIZE; - n_points--; + prev_x= first_x; prev_y= first_y; if (trn->add_point(first_x, first_y)) return 1; + + if (--n_points == 0) + goto single_point_ring; + while (--n_points) { double x, y; @@ -1266,6 +1270,8 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const return 1; } data+= POINT_DATA_SIZE; + +single_point_ring: trn->complete_ring(); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a67828ac680..0cc71083613 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -25,7 +25,7 @@ in the relevant fields. Empty strings comes last. */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "sql_acl.h" // MYSQL_DB_FIELD_COUNT, ACL_ACCESS #include "sql_base.h" // close_mysql_tables @@ -8684,7 +8684,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, int elements; const char *UNINIT_VAR(user); const char *UNINIT_VAR(host); - const char *UNINIT_VAR(role); ACL_USER *acl_user= NULL; ACL_ROLE *acl_role= NULL; ACL_DB *acl_db= NULL; @@ -8824,7 +8823,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, role_grant_pair= (ROLE_GRANT_PAIR *) my_hash_element(roles_mappings_hash, idx); user= role_grant_pair->u_uname; host= role_grant_pair->u_hname; - role= role_grant_pair->r_uname; break; default: @@ -8834,8 +8832,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, user= ""; if (! host) host= ""; - if (! role) - role= ""; #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan struct: %u index: %u user: '%s' host: '%s'", @@ -8844,6 +8840,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop, if (struct_no == ROLES_MAPPINGS_HASH) { + const char* role= role_grant_pair->r_uname? role_grant_pair->r_uname: ""; if (user_from->is_role() ? strcmp(user_from->user.str, role) : (strcmp(user_from->user.str, user) || my_strcasecmp(system_charset_info, user_from->host.str, host))) @@ -12174,12 +12171,13 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) mpvio.auth_info.authenticated_as); if (!acl_proxy_user) { + mysql_mutex_unlock(&acl_cache->lock); + Host_errors errors; errors.m_proxy_user_acl= 1; inc_host_errors(mpvio.thd->security_ctx->ip, &errors); if (!thd->is_error()) login_failed_error(thd); - mysql_mutex_unlock(&acl_cache->lock); DBUG_RETURN(1); } acl_user= acl_proxy_user->copy(thd->mem_root); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 4a4ecc74d7c..be2d5ef9c52 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sql_class.h" // THD +#include "sql_class.h" // THD and my_global.h #include "keycaches.h" // get_key_cache #include "sql_base.h" // Open_table_context #include "lock.h" // MYSQL_OPEN_* diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 9b7ea58bee6..32b447797cf 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -29,6 +29,7 @@ #define MYSQL_LEX 1 +#include #include "sql_priv.h" #include "procedure.h" #include "sql_analyse.h" diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index 84f2d95c5da..b659054a50b 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "sql_audit.h" diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 44a4ee67699..000a20e0421 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -17,8 +17,8 @@ /* Basic functions needed by many modules */ +#include #include "sql_base.h" // setup_table_map -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "debug_sync.h" @@ -8470,7 +8470,6 @@ bool setup_on_expr(THD *thd, TABLE_LIST *table, bool is_update) do { embedded= embedding; - DBUG_PRINT("XXX", ("check: %s", table->alias)); if (embedded->on_expr) { thd->where="on clause"; diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index fef959c37ca..f0465cdf5bf 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "sql_binlog.h" #include "sql_parse.h" // check_global_access diff --git a/sql/sql_bootstrap.cc b/sql/sql_bootstrap.cc index 8e632a02ace..30d03029ce6 100644 --- a/sql/sql_bootstrap.cc +++ b/sql/sql_bootstrap.cc @@ -14,8 +14,7 @@ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include -#include +#include #include #include #include "sql_bootstrap.h" diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 6001517b0c7..e1efb1e85d6 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -328,7 +328,7 @@ TODO list: (This could be done with almost no speed penalty) */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "sql_cache.h" #include "sql_parse.h" // check_table_access @@ -3339,7 +3339,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used, There are not callback function for for VIEWs */ if (!insert_table(key_length, key, (*block_table), - tables_used->view_db.length + 1, 0, + tables_used->view_db.length, 0, HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE)) DBUG_RETURN(0); /* diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e8c4d98cde3..c10eff73962 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -28,7 +28,7 @@ #pragma implementation // gcc: Class implementation #endif -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_class.h" @@ -4634,6 +4634,7 @@ thd_need_ordering_with(const MYSQL_THD thd, const MYSQL_THD other_thd) return 1; if (!rgi->commit_id || rgi->commit_id != other_rgi->commit_id) return 1; + DBUG_EXECUTE_IF("thd_need_ordering_with_force", return 1;); /* Otherwise, these two threads are doing parallel replication within the same replication domain. Their commit order is already fixed, so we do not need @@ -6667,6 +6668,19 @@ wait_for_commit::reinit() opaque_pointer= NULL; wakeup_error= 0; wakeup_subsequent_commits_running= false; + commit_started= false; +#ifdef SAFE_MUTEX + /* + When using SAFE_MUTEX, the ordering between taking the LOCK_wait_commit + mutexes is checked. This causes a problem when we re-use a mutex, as then + the expected locking order may change. + + So in this case, do a re-init of the mutex. In release builds, we want to + avoid the overhead of a re-init though. + */ + mysql_mutex_destroy(&LOCK_wait_commit); + mysql_mutex_init(key_LOCK_wait_commit, &LOCK_wait_commit, MY_MUTEX_INIT_FAST); +#endif } diff --git a/sql/sql_class.h b/sql/sql_class.h index 7eacf9d347c..41639ea352f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1731,6 +1731,16 @@ struct wait_for_commit on that function for details. */ bool wakeup_subsequent_commits_running; + /* + This flag can be set when a commit starts, but has not completed yet. + It is used by binlog group commit to allow a waiting transaction T2 to + join the group commit of an earlier transaction T1. When T1 has queued + itself for group commit, it will set the commit_started flag. Then when + T2 becomes ready to commit and needs to wait for T1 to commit first, T2 + can queue itself before waiting, and thereby participate in the same + group commit as T1. + */ + bool commit_started; void register_wait_for_prior_commit(wait_for_commit *waitee); int wait_for_prior_commit(THD *thd) diff --git a/sql/sql_client.cc b/sql/sql_client.cc index e7c555b5947..efac01f9894 100644 --- a/sql/sql_client.cc +++ b/sql/sql_client.cc @@ -18,6 +18,7 @@ This files defines some MySQL C API functions that are server specific */ +#include #include "sql_priv.h" #include "sql_class.h" // system_variables diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 91b3281e231..fc47e562514 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -20,7 +20,7 @@ Functions to autenticate and handle reqests for a connection */ -#include "my_global.h" +#include #include "sql_priv.h" #ifndef __WIN__ #include // getservbyname, servent @@ -840,14 +840,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number) Use server character set and collation if - opt_character_set_client_handshake is not set - client has not specified a character set - - client character set is the same as the servers - client character set doesn't exists in server */ if (!opt_character_set_client_handshake || - !(cs= get_charset(cs_number, MYF(0))) || - !my_strcasecmp(&my_charset_latin1, - global_system_variables.character_set_client->name, - cs->name)) + !(cs= get_charset(cs_number, MYF(0)))) { thd->variables.character_set_client= global_system_variables.character_set_client; diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc index bcc8ad0b10f..2460a16551d 100644 --- a/sql/sql_crypt.cc +++ b/sql/sql_crypt.cc @@ -26,6 +26,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "sql_crypt.h" #include "password.h" diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index a38077c40cb..99b7b1e58d0 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -17,6 +17,7 @@ #pragma implementation /* gcc class implementation */ #endif +#include #include "sql_priv.h" #include "unireg.h" #include "sql_cursor.h" diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 063b90a6780..06e6d738db1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -18,7 +18,7 @@ /* create and drop of databases */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_db.h" diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 08605bf2c85..4ab387d22e4 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -20,6 +20,7 @@ Multi-table deletes were introduced by Monty and Sinisa */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_delete.h" diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 8e8dbfc71d4..14e26fbefa6 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -21,7 +21,7 @@ */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_derived.h" @@ -465,8 +465,6 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) } } - if (!derived->merged_for_insert) - dt_select->first_cond_optimization= FALSE; // consider it optimized exit_merge: if (arena) thd->restore_active_arena(arena, &backup); diff --git a/sql/sql_do.cc b/sql/sql_do.cc index 4ba887b5ab2..468b1bc33da 100644 --- a/sql/sql_do.cc +++ b/sql/sql_do.cc @@ -16,6 +16,7 @@ /* Execute DO statement */ +#include #include "sql_priv.h" #include "transaction.h" #include "unireg.h" diff --git a/sql/sql_error.cc b/sql/sql_error.cc index fb1bb811c9d..3e18b701031 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -41,6 +41,7 @@ This file contains the implementation of error and warnings related ***********************************************************************/ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_error.h" diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 2b523b323a4..75f6689ab98 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -18,6 +18,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "sql_select.h" diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index 1e64bc10a7c..824d21eea20 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "sql_base.h" #include "sql_select.h" #include "sql_expression_cache.h" diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index a6c471f67d5..110bca96530 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -52,6 +52,7 @@ cursor points at the first record). */ +#include #include "sql_priv.h" #include "sql_handler.h" #include "unireg.h" // REQUIRED: for other includes diff --git a/sql/sql_help.cc b/sql/sql_help.cc index 8f458ea0b9f..afeb9395a55 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_help.h" diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 12854124b02..c842bed9ac2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -56,7 +56,7 @@ */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_insert.h" @@ -868,6 +868,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, table_list->prepare_check_option(thd)) error= 1; + table->reset_default_fields(); + while ((values= its++)) { if (fields.elements || !value_count) @@ -1665,6 +1667,13 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) DBUG_ASSERT(table->insert_values != NULL); store_record(table,insert_values); restore_record(table,record[1]); + + /* + in INSERT ... ON DUPLICATE KEY UPDATE the set of modified fields can + change per row. Thus, we have to do reset_default_fields() per row. + Twice (before insert and before update). + */ + table->reset_default_fields(); DBUG_ASSERT(info->update_fields->elements == info->update_values->elements); if (fill_record_n_invoke_before_triggers(thd, table, *info->update_fields, @@ -1692,6 +1701,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) if (res) goto err; } + table->reset_default_fields(); /* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */ if (info->view && @@ -3483,6 +3493,7 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) table->file->ha_start_bulk_insert((ha_rows) 0); } restore_record(table,s->default_values); // Get empty record + table->reset_default_fields(); table->next_number_field=table->found_next_number_field; #ifdef HAVE_REPLICATION diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 3bd23692487..11547a2ee70 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -18,6 +18,7 @@ /* A lexical scanner on a temporary buffer with a yacc interface */ #define MYSQL_LEX 1 +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_class.h" // sql_lex.h: SQLCOM_END diff --git a/sql/sql_lex.h b/sql/sql_lex.h index e15901a9c54..88491743d39 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -104,6 +104,15 @@ struct sys_var_with_base LEX_STRING base_name; }; +struct LEX_TYPE +{ + enum enum_field_types type; + char *length, *dec; + CHARSET_INFO *charset; + void set(int t, char *l, char *d, CHARSET_INFO *cs) + { type= (enum_field_types)t; length= l; dec= d; charset= cs; } +}; + #ifdef MYSQL_SERVER /* The following hack is needed because mysql_yacc.cc does not define diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 534a8fa5484..6ecdddc3008 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -19,6 +19,7 @@ /* Copy data from a textfile to table */ /* 2006-12 Erik Wetterberg : LOAD XML added */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_load.h" @@ -147,14 +148,8 @@ static int read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, bool ignore_check_option_errors); #ifndef EMBEDDED_LIBRARY -static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, - const char* db_arg, /* table's database */ - const char* table_name_arg, - bool is_concurrent, - enum enum_duplicates duplicates, - bool ignore, - bool transactional_table, - int errocode); +static bool write_execute_load_query_log_event(THD *, sql_exchange*, const + char*, const char*, bool, enum enum_duplicates, bool, bool, int); #endif /* EMBEDDED_LIBRARY */ /* @@ -283,9 +278,15 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (!fields_vars.elements) { - Field **field; - for (field=table->field; *field ; field++) - fields_vars.push_back(new Item_field(*field)); + Field_iterator_table_ref field_iterator; + field_iterator.set(table_list); + for (; !field_iterator.end_of_fields(); field_iterator.next()) + { + Item *item; + if (!(item= field_iterator.create_item(thd))) + DBUG_RETURN(TRUE); + fields_vars.push_back(item->real_item()); + } bitmap_set_all(table->write_set); /* Let us also prepare SET clause, altough it is probably empty @@ -477,6 +478,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, thd_proc_info(thd, "reading file"); if (!(error= MY_TEST(read_info.error))) { + table->reset_default_fields(); table->next_number_field=table->found_next_number_field; if (ignore || handle_duplicates == DUP_REPLACE) @@ -722,7 +724,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, { if (n++) query_str.append(", "); - if (item->type() == Item::FIELD_ITEM) + if (item->real_type() == Item::FIELD_ITEM) append_identifier(thd, &query_str, item->name, strlen(item->name)); else { diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index c7d21ffd424..d918d5c9cf4 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -20,6 +20,7 @@ !! This file is built from my_locale.pl !! */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_locale.h" diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index f13448ca46e..c6c465aa4e2 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -21,6 +21,7 @@ * o Berkeley DB: removing unneeded log files. */ +#include #include "sql_priv.h" #include "sql_manager.h" #include "unireg.h" // REQUIRED: for other includes diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ca116ccabaa..eb87139e6f6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -15,7 +15,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define MYSQL_LEX 1 -#include "my_global.h" +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_parse.h" // sql_kill, *_precheck, *_prepare @@ -362,6 +362,7 @@ void init_update_queries(void) */ sql_command_flags[SQLCOM_SET_OPTION]= CF_REEXECUTION_FRAGILE | CF_AUTO_COMMIT_TRANS | + CF_CAN_GENERATE_ROW_EVENTS | CF_OPTIMIZER_TRACE; // (1) // (1) so that subquery is traced when doing "DO @var := (subquery)" sql_command_flags[SQLCOM_DO]= CF_REEXECUTION_FRAGILE | @@ -426,21 +427,15 @@ void init_update_queries(void) sql_command_flags[SQLCOM_REVOKE]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_REVOKE_ROLE]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_OPTIMIZE]= CF_CHANGES_DATA; - /* - @todo SQLCOM_CREATE_FUNCTION should have CF_AUTO_COMMIT_TRANS - set. this currently is binlogged *before* the transaction if - executed inside a transaction because it does not have an implicit - pre-commit and is written to the statement cache. /Sven - */ - sql_command_flags[SQLCOM_CREATE_FUNCTION]= CF_CHANGES_DATA; + sql_command_flags[SQLCOM_CREATE_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_SPFUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_ALTER_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_ALTER_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_INSTALL_PLUGIN]= CF_CHANGES_DATA; - sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]= CF_CHANGES_DATA; + sql_command_flags[SQLCOM_INSTALL_PLUGIN]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; + sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]= CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS; /* The following is used to preserver CF_ROW_COUNT during the @@ -485,15 +480,12 @@ void init_update_queries(void) sql_command_flags[SQLCOM_RENAME_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_ROLE]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_ROLE]|= CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_REVOKE_ALL]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_REVOKE]|= CF_AUTO_COMMIT_TRANS; + sql_command_flags[SQLCOM_REVOKE_ALL]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_REVOKE_ROLE]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_GRANT]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_GRANT_ROLE]|= CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_ASSIGN_TO_KEYCACHE]= CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_PRELOAD_KEYS]= CF_AUTO_COMMIT_TRANS; - sql_command_flags[SQLCOM_FLUSH]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_RESET]= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_SERVER]= CF_AUTO_COMMIT_TRANS; @@ -1976,6 +1968,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, } MYSQL_COMMAND_DONE(res); } + DEBUG_SYNC(thd,"dispatch_command_end"); /* Check that some variables are reset properly */ DBUG_ASSERT(thd->abort_on_warning == 0); @@ -3347,7 +3340,6 @@ end_with_restore_list: break; } case SQLCOM_CREATE_INDEX: - /* Fall through */ case SQLCOM_DROP_INDEX: /* CREATE INDEX and DROP INDEX are implemented by calling ALTER diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 18e49d878cd..239d793c633 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -47,6 +47,7 @@ /* Some general useful functions */ #define MYSQL_LEX 1 +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_partition.h" @@ -55,7 +56,6 @@ #include "sql_cache.h" // query_cache_invalidate3 #include "lock.h" // mysql_lock_remove #include "sql_show.h" // append_identifier -#include #include #include "my_md5.h" #include "transaction.h" diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index fb9bb05bcb4..34ad2ff2615 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "sql_plugin.h" +#include "sql_plugin.h" // Includes my_global.h #include "sql_priv.h" // SHOW_MY_BOOL #include "unireg.h" #include "sql_class.h" // set_var.h: THD diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7fa284b235d..27d37d9fb83 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -84,7 +84,7 @@ When one supplies long data for a placeholder: at statement execute. */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_class.h" // set_var.h: THD diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 5dc19181e9b..09a22ba0444 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab. +/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. + Copyright (c) 2010, 2014, Monty Program 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 @@ -60,6 +60,33 @@ (Old), (New)); \ } while(0) + +/* + Generates a warning that a feature is deprecated and there is no replacement. + + Using it as + + WARN_DEPRECATED_NO_REPLACEMENT(thd, "BAD"); + + Will result in a warning + + "'BAD' is deprecated and will be removed in a future release." + + Note that in macro arguments BAD is not quoted. +*/ + +#define WARN_DEPRECATED_NO_REPLACEMENT(Thd,Old) \ + do { \ + if (((THD *) Thd) != NULL) \ + push_warning_printf(((THD *) Thd), Sql_condition::WARN_LEVEL_WARN, \ + ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT, \ + ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), \ + (Old)); \ + else \ + sql_print_warning("'%s' is deprecated and will be removed " \ + "in a future release.", (Old)); \ + } while(0) + /*************************************************************************/ #endif @@ -155,41 +182,6 @@ #define OPTION_ALLOW_BATCH (1ULL << 36) // THD, intern (slave) #define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user -/* - Check how many bytes are available on buffer. - - @param buf_start Pointer to buffer start. - @param buf_current Pointer to the current position on buffer. - @param buf_len Buffer length. - - @return Number of bytes available on event buffer. -*/ -template T available_buffer(const char* buf_start, - const char* buf_current, - T buf_len) -{ - return buf_len - (buf_current - buf_start); -} - -/* - Check if jump value is within buffer limits. - - @param jump Number of positions we want to advance. - @param buf_start Pointer to buffer start - @param buf_current Pointer to the current position on buffer. - @param buf_len Buffer length. - - @return True If jump value is within buffer limits. - False Otherwise. -*/ -template bool valid_buffer_range(T jump, - const char* buf_start, - const char* buf_current, - T buf_len) -{ - return (jump <= available_buffer(buf_start, buf_current, buf_len)); -} - /* The rest of the file is included in the server only */ #ifndef MYSQL_CLIENT diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index dc7aacb3d94..26d515842ed 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -29,11 +29,11 @@ - "profiling_history_size", integer, session + global, "Num queries stored?" */ - +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_profile.h" -#include "my_sys.h" +#include #include "sql_show.h" // schema_table_store_record #include "sql_class.h" // THD diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index e2b3b482ffe..f064146e7fc 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_reload.h" #include "sql_priv.h" #include "mysqld.h" // select_errors diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 897aa183b60..2c17898f07c 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -19,6 +19,7 @@ Atomic rename of table; RENAME TABLE t1 to t2, tmp to t1 [,...] */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_rename.h" diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0af3bdd4e14..dc1c1a9ecaa 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -14,6 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_base.h" diff --git a/sql/sql_select.cc b/sql/sql_select.cc index eff1c382945..8f68c929a9e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -29,6 +29,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "unireg.h" #include "sql_select.h" @@ -632,7 +633,7 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, res= setup_conds(thd, tables, leaves, conds); if (thd->lex->current_select->first_cond_optimization) { - if (!res && *conds) + if (!res && *conds && ! thd->lex->current_select->merged_into) (*reserved)= (*conds)->exists2in_reserved_items(); else (*reserved)= 0; @@ -3833,6 +3834,7 @@ make_join_statistics(JOIN *join, List &tables_list, join->impossible_where= false; if (conds && const_count) { + COND_EQUAL *orig_cond_equal = join->cond_equal; conds->update_used_tables(); conds= remove_eq_conds(join->thd, conds, &join->cond_value); if (conds && conds->type() == Item::COND_ITEM && @@ -3859,7 +3861,21 @@ make_join_statistics(JOIN *join, List &tables_list, join->cond_equal->current_level.empty(); join->cond_equal->current_level.push_back((Item_equal*) conds); } - } + } + + if (orig_cond_equal != join->cond_equal) + { + /* + If join->cond_equal has changed all references to it from COND_EQUAL + objects associated with ON expressions must be updated. + */ + for (JOIN_TAB **pos=stat_vector+const_count ; (s= *pos) ; pos++) + { + if (*s->on_expr_ref && s->cond_equal && + s->cond_equal->upper_levels == orig_cond_equal) + s->cond_equal->upper_levels= join->cond_equal; + } + } } /* Calc how many (possible) matched records in each table */ @@ -4406,8 +4422,7 @@ add_key_field(JOIN *join, if (is_const) { stat[0].const_keys.merge(possible_keys); - if (possible_keys.is_clear_all()) - bitmap_set_bit(&field->table->cond_set, field->field_index); + bitmap_set_bit(&field->table->cond_set, field->field_index); } else if (!eq_func) { @@ -4425,6 +4440,32 @@ add_key_field(JOIN *join, if (!eq_func) // eq_func is NEVER true when num_values > 1 return; + if ((*value)->cmp_type() == TIME_RESULT && + field->cmp_type() != TIME_RESULT) + return; + + /* + Note, for ITEM/ENUM columns: + - field->cmp_type() returns INT_RESULT + - field->result_type() returns STRING_RESULT + - field->type() returns MYSQL_TYPE_STRING + + Using field->real_type() to detect ENUM/SET, + as they need a special handling: + - Conditions between a ENUM/SET filter and a TIME expression + cannot be optimized. They were filtered out in the previous if block. + - It's Ok to use ref access for an ENUM/SET field compared to an + INT/REAL/DECIMAL expression. + - It's Ok to use ref for an ENUM/SET field compared to a STRING + expression if the collation of the field and the collation of + the condition match. + */ + if ((field->real_type() == MYSQL_TYPE_ENUM || + field->real_type() == MYSQL_TYPE_SET) && + (*value)->cmp_type () == STRING_RESULT && + field->charset() != cond->compare_collation()) + return; + /* We can't use indexes when comparing a string index to a number or two strings if the effective collation @@ -7199,17 +7240,20 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, uint i; KEYUSE *keyuse= pos->key; uint key= keyuse->key; - for (i= 0; i < keyparts; i++) { + if (i > 0) + keyuse+= ref_keyuse_steps[i-1]; uint fldno; if (is_hash_join_key_no(key)) fldno= keyuse->keypart; else - fldno= table->key_info[key].key_part[keyparts-1].fieldnr - 1; + fldno= table->key_info[key].key_part[i].fieldnr - 1; if (fld->field_index == fldno) break; } + keyuse= pos->key; + if (i == keyparts) { /* @@ -7372,6 +7416,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, already taken into account in table->cond_selectivity. */ keyuse= pos->key; + keyparts=0; while (keyuse->table == table && keyuse->key == key) { if (!(keyuse->used_tables & (rem_tables | table->map))) @@ -8858,6 +8903,9 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, } else j->type=JT_EQ_REF; + + j->read_record.unlock_row= (j->type == JT_EQ_REF)? + join_read_key_unlock_row : rr_unlock_row; DBUG_RETURN(0); } @@ -10544,6 +10592,19 @@ uint check_join_cache_usage(JOIN_TAB *tab, cache_level--; } + /* + Don't use BKA for materialized tables. We could actually have a + meaningful use of BKA when linked join buffers are used. + + The problem is, the temp.table is not filled (actually not even opened + properly) yet, and this doesn't let us call + handler->multi_range_read_info(). It is possible to come up with + estimates, etc. without acessing the table, but it seems not to worth the + effort now. + */ + if (tab->table->pos_in_table_list->is_materialized_derived()) + no_bka_cache= true; + /* Don't use join buffering if we're dictated not to by no_jbuf_after (This is not meaningfully used currently) @@ -10609,8 +10670,8 @@ uint check_join_cache_usage(JOIN_TAB *tab, goto no_join_cache; if (tab->ref.is_access_triggered()) goto no_join_cache; - - if (!tab->is_ref_for_hash_join()) + + if (!tab->is_ref_for_hash_join() && !no_bka_cache) { flags= HA_MRR_NO_NULL_ENDPOINTS | HA_MRR_SINGLE_POINT; if (tab->table->covering_keys.is_set(tab->ref.key)) @@ -13168,10 +13229,18 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, if (upper) { TABLE_LIST *native_sjm= embedding_sjm(item_equal->context_field); - if (item_const && upper->get_const()) + Item *upper_const= upper->get_const(); + if (item_const && upper_const) { - /* Upper item also has "field_item=const". Don't produce equality here */ - item= 0; + /* + Upper item also has "field_item=const". + Don't produce equality if const is equal to item_const. + */ + Item_func_eq *func= new Item_func_eq(item_const, upper_const); + func->set_cmp_func(); + func->quick_fix_field(); + if (func->val_int()) + item= 0; } else { @@ -21176,7 +21245,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, order_item_type == Item::REF_ITEM) { from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables, - NULL, &view_ref, IGNORE_ERRORS, TRUE, + NULL, &view_ref, IGNORE_ERRORS, FALSE, FALSE); if (!from_field) from_field= (Field*) not_found_field; diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 637ee78e314..2b0576ffba9 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -33,6 +33,7 @@ currently running transactions etc will not be disrupted. */ +#include #include "sql_priv.h" #include "sql_servers.h" #include "unireg.h" diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c6889648a09..6f1860d902d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -17,7 +17,7 @@ /* Function with list databases, tables or fields */ -#include "sql_plugin.h" +#include "sql_plugin.h" // Includes my_global.h #include "sql_priv.h" #include "unireg.h" #include "sql_acl.h" // fill_schema_*_privileges @@ -3092,12 +3092,11 @@ static bool show_status_array(THD *thd, const char *wild, char *value=var->value; const char *pos, *end; // We assign a lot of const's - mysql_mutex_lock(&LOCK_global_system_variables); - if (show_type == SHOW_SYS) { sys_var *var= ((sys_var *) value); show_type= var->show_type(); + mysql_mutex_lock(&LOCK_global_system_variables); value= (char*) var->value_ptr(thd, value_type, &null_lex_str); charset= var->charset(thd); } @@ -3198,7 +3197,8 @@ static bool show_status_array(THD *thd, const char *wild, thd->count_cuted_fields= CHECK_FIELD_IGNORE; table->field[1]->set_notnull(); - mysql_mutex_unlock(&LOCK_global_system_variables); + if (var->type == SHOW_SYS) + mysql_mutex_unlock(&LOCK_global_system_variables); if (schema_table_store_record(thd, table)) { @@ -5322,13 +5322,10 @@ err: const char *error= thd->is_error() ? thd->get_stmt_da()->message() : ""; table->field[20]->store(error, strlen(error), cs); - if (thd->is_error()) - { - push_warning(thd, Sql_condition::WARN_LEVEL_WARN, - thd->get_stmt_da()->sql_errno(), - thd->get_stmt_da()->message()); - thd->clear_error(); - } + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + thd->get_stmt_da()->sql_errno(), + thd->get_stmt_da()->message()); + thd->clear_error(); } DBUG_RETURN(schema_table_store_record(thd, table)); @@ -5489,10 +5486,9 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS rather than in SHOW COLUMNS */ - if (thd->is_error()) - push_warning(thd, Sql_condition::WARN_LEVEL_WARN, - thd->get_stmt_da()->sql_errno(), - thd->get_stmt_da()->message()); + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + thd->get_stmt_da()->sql_errno(), + thd->get_stmt_da()->message()); thd->clear_error(); res= 0; } diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index a0a47b77591..374a24f75e5 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sql_priv.h" #include "sp_head.h" #include "sp_pcontext.h" diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index 9acd3d98322..d368145ca73 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -23,6 +23,7 @@ @{ */ +#include #include "sql_base.h" #include "key.h" #include "sql_statistics.h" @@ -2467,6 +2468,8 @@ int collect_statistics_for_table(THD *thd, TABLE *table) table_field->collected_stats->init(thd, table_field); } + restore_record(table, s->default_values); + /* Perform a full table scan to collect statistics on 'table's columns */ if (!(rc= file->ha_rnd_init(TRUE))) { @@ -3501,7 +3504,12 @@ double get_column_range_cardinality(Field *field, !(range_flag & NEAR_MIN); if (col_non_nulls < 1) - res= 0; + { + if (nulls_incl) + res= col_nulls; + else + res= 0; + } else if (min_endp && max_endp && min_endp->length == max_endp->length && !memcmp(min_endp->key, max_endp->key, min_endp->length)) { @@ -3514,6 +3522,15 @@ double get_column_range_cardinality(Field *field, { double avg_frequency= col_stats->get_avg_frequency(); res= avg_frequency; + /* + psergey-todo: what does check for min_value, max_value mean? + min/max_value are set to NULL in alloc_statistics_for_table() and + alloc_statistics_for_table_share(). Both functions will immediately + call create_min_max_statistical_fields_for_table and + create_min_max_statistical_fields_for_table_share() respectively, + which will set min/max_value to be valid pointers, unless OOM + occurs. + */ if (avg_frequency > 1.0 + 0.000001 && col_stats->min_value && col_stats->max_value) { @@ -3521,7 +3538,7 @@ double get_column_range_cardinality(Field *field, if (hist->is_available()) { store_key_image_to_rec(field, (uchar *) min_endp->key, - min_endp->length); + field->key_length()); double pos= field->pos_in_interval(col_stats->min_value, col_stats->max_value); res= col_non_nulls * @@ -3529,6 +3546,11 @@ double get_column_range_cardinality(Field *field, avg_frequency / col_non_nulls); } } + else if (avg_frequency == 0.0) + { + /* This actually means there is no statistics data */ + res= tab_records; + } } } else @@ -3540,7 +3562,7 @@ double get_column_range_cardinality(Field *field, if (min_endp && !(field->null_ptr && min_endp->key[0])) { store_key_image_to_rec(field, (uchar *) min_endp->key, - min_endp->length); + field->key_length()); min_mp_pos= field->pos_in_interval(col_stats->min_value, col_stats->max_value); } @@ -3549,7 +3571,7 @@ double get_column_range_cardinality(Field *field, if (max_endp) { store_key_image_to_rec(field, (uchar *) max_endp->key, - max_endp->length); + field->key_length()); max_mp_pos= field->pos_in_interval(col_stats->min_value, col_stats->max_value); } diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index c399951b828..46e5cef22d1 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -280,7 +280,14 @@ public: }; -/* Statistical data on a column */ +/* + Statistical data on a column + + Note: objects of this class may be "empty", where they have almost all fields + as zeros, for example, get_avg_frequency() will return 0. + + objects are allocated in alloc_statistics_for_table[_share]. +*/ class Column_statistics { @@ -296,7 +303,8 @@ public: are available for the column */ uint32 column_stat_nulls; - + + /* For the below two, see comments in get_column_range_cardinality() */ /* Minimum value for the column */ Field *min_value; /* Maximum value for the column */ diff --git a/sql/sql_string.h b/sql/sql_string.h index 8c7e69edf4b..c287f051d98 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -253,7 +253,9 @@ public: */ inline void chop() { - Ptr[str_length--]= '\0'; + str_length--; + Ptr[str_length]= '\0'; + DBUG_ASSERT(strlen(Ptr) == str_length); } inline void free() diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 606c33aeed9..34515d655e5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -18,6 +18,7 @@ /* drop and alter of tables */ +#include #include "sql_priv.h" #include "unireg.h" #include "debug_sync.h" @@ -3046,10 +3047,6 @@ int prepare_create_field(Create_field *sql_field, (sql_field->decimals << FIELDFLAG_DEC_SHIFT)); break; } - if (sql_field->flags & NOT_NULL_FLAG) - DBUG_PRINT("info", ("1")); - if (sql_field->vcol_info) - DBUG_PRINT("info", ("2")); if (!(sql_field->flags & NOT_NULL_FLAG) || (sql_field->vcol_info)) /* Make virtual columns allow NULL values */ sql_field->pack_flag|= FIELDFLAG_MAYBE_NULL; @@ -8800,6 +8797,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, */ altered_table->column_bitmaps_set_no_signal(&altered_table->s->all_set, &altered_table->s->all_set); + restore_record(altered_table, s->default_values); // Create empty record + if (altered_table->default_field && altered_table->update_default_fields()) + goto err_new_table_cleanup; // Ask storage engine whether to use copy or in-place enum_alter_inplace_result inplace_supported= @@ -9442,14 +9442,14 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, to->use_all_columns(); to->mark_virtual_columns_for_write(TRUE); if (init_read_record(&info, thd, from, (SQL_SELECT *) 0, 1, 1, FALSE)) - { - error= 1; goto err; - } + if (ignore && !alter_ctx->fk_error_if_delete_row) to->file->extra(HA_EXTRA_IGNORE_DUP_KEY); thd->get_stmt_da()->reset_current_row_for_warning(); restore_record(to, s->default_values); // Create empty record + if (to->default_field && to->update_default_fields()) + goto err; thd->progress.max_counter= from->file->records(); time_to_report_progress= MY_HOW_OFTEN_TO_WRITE/10; @@ -9492,11 +9492,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, prev_insert_id= to->file->next_insert_id; if (to->vfield) update_virtual_fields(thd, to, VCOL_UPDATE_FOR_WRITE); - if (to->default_field && to->update_default_fields()) - { - error= 1; - break; - } if (thd->is_error()) { error= 1; diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc index 48eeb94f7c9..2991b16350c 100644 --- a/sql/sql_tablespace.cc +++ b/sql/sql_tablespace.cc @@ -15,6 +15,7 @@ /* drop and alter of tablespaces */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_tablespace.h" diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 60e9b2cc54c..8992ff24a1e 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -16,7 +16,7 @@ /* Write some debug info */ - +#include #include "sql_priv.h" #include "unireg.h" #include "sql_test.h" diff --git a/sql/sql_time.cc b/sql/sql_time.cc index cc824298bc5..ca689d55a2b 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -17,6 +17,7 @@ /* Functions to handle date and time */ +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED by other includes #include "sql_time.h" diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index c3188305092..cf5b4a39b1f 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -16,7 +16,7 @@ #define MYSQL_LEX 1 -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sp_head.h" diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index fdc932957b2..bd5732c3696 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -31,6 +31,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "unireg.h" #include "sql_base.h" // close_mysql_tables diff --git a/sql/sql_union.cc b/sql/sql_union.cc index fe8bb7a6620..77a3b1eec8f 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -20,7 +20,7 @@ UNION's were introduced by Monty and Sinisa */ - +#include #include "sql_priv.h" #include "unireg.h" #include "sql_union.h" @@ -315,18 +315,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, can_skip_order_by= is_union_select && !(sl->braces && sl->explicit_limit); - /* - Remove all references from the select_lex_units to the subqueries that - are inside the ORDER BY clause. - */ - if (can_skip_order_by) - { - for (ORDER *ord= (ORDER *)sl->order_list.first; ord; ord= ord->next) - { - (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); - } - } - saved_error= join->prepare(&sl->ref_pointer_array, sl->table_list.first, sl->with_wild, @@ -349,6 +337,18 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, if (saved_error || (saved_error= thd_arg->is_fatal_error)) goto err; + /* + Remove all references from the select_lex_units to the subqueries that + are inside the ORDER BY clause. + */ + if (can_skip_order_by) + { + for (ORDER *ord= (ORDER *)sl->order_list.first; ord; ord= ord->next) + { + (*ord->item)->walk(&Item::eliminate_subselect_processor, FALSE, NULL); + } + } + /* Use items list of underlaid select for derived tables to preserve information about fields lengths and exact types diff --git a/sql/sql_update.cc b/sql/sql_update.cc index db6fe42db1c..c9aafbf622c 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -20,7 +20,7 @@ Multi-table updates were introduced by Sinisa & Monty */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_update.h" @@ -717,6 +717,8 @@ int mysql_update(THD *thd, if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) table->prepare_for_position(); + table->reset_default_fields(); + /* We can use compare_record() to optimize away updates if the table handler is returning all columns OR if @@ -1697,6 +1699,7 @@ int multi_update::prepare(List ¬_used_values, table->covering_keys.clear_all(); table->pos_in_table_list= tl; table->prepare_triggers_for_update_stmt_or_event(); + table->reset_default_fields(); } } @@ -2051,8 +2054,7 @@ int multi_update::send_data(List ¬_used_values) store_record(table,record[1]); if (fill_record_n_invoke_before_triggers(thd, table, *fields_for_table[offset], *values_for_table[offset], 0, - TRG_EVENT_UPDATE) || - (table->default_field && table->update_default_fields())) + TRG_EVENT_UPDATE)) DBUG_RETURN(1); /* @@ -2064,6 +2066,10 @@ int multi_update::send_data(List ¬_used_values) if (!can_compare_record || compare_record(table)) { int error; + + if (table->default_field && table->update_default_fields()) + DBUG_RETURN(1); + if ((error= cur_table->view_check_option(thd, ignore)) != VIEW_CHECK_OK) { diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 07169f299d7..6a81301a6d9 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -16,7 +16,7 @@ */ #define MYSQL_LEX 1 -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" #include "sql_view.h" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b52fce9394e..8716e39a94f 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -33,6 +33,7 @@ #define Lex (thd->lex) #define Select Lex->current_select +#include #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "sql_parse.h" /* comp_*_creator */ @@ -901,6 +902,7 @@ static bool sp_create_assignment_instr(THD *thd, bool no_lookahead) LEX_STRING lex_str; LEX_STRING *lex_str_ptr; LEX_SYMBOL symbol; + LEX_TYPE lex_type; Table_ident *table; char *simple_string; Item *item; @@ -1668,13 +1670,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type text_string hex_or_bin_String opt_gconcat_separator +%type field_def + %type type type_with_opt_collate int_type real_type order_dir lock_option udf_type opt_if_exists opt_local opt_table_options table_options table_option opt_if_not_exists create_or_replace opt_no_write_to_binlog opt_temporary all_or_any opt_distinct opt_ignore_leaves fulltext_options spatial_type union_option - field_def union_opt select_derived_init transaction_access_mode_types opt_natural_language_mode opt_query_expansion opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment @@ -1834,7 +1837,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); opt_column_list grant_privileges grant_ident grant_list grant_option object_privilege object_privilege_list user_list user_and_role_list rename_list - clear_privileges flush_options flush_option + clear_privileges flush_options flush_option table_or_tables opt_flush_lock flush_lock flush_options_list equal optional_braces opt_mi_check_type opt_to mi_check_types @@ -6015,11 +6018,11 @@ field_spec: field_def { LEX *lex=Lex; - if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3, - lex->length,lex->dec,lex->type, + if (add_field_to_list(lex->thd, &$1, $3.type, + $3.length, $3.dec, lex->type, lex->default_value, lex->on_update_value, &lex->comment, - lex->change,&lex->interval_list,lex->charset, + lex->change, &lex->interval_list, $3.charset, lex->uint_geom_type, lex->vcol_info, lex->option_list)) MYSQL_YYABORT; @@ -6027,13 +6030,15 @@ field_spec: ; field_def: - type opt_attribute {} - | type opt_generated_always AS '(' virtual_column_func ')' - vcol_opt_specifier - vcol_opt_attribute + type opt_attribute + { $$.set($1, Lex->length, Lex->dec, Lex->charset); } + | type opt_generated_always AS + { $$.set($1, Lex->length, Lex->dec, Lex->charset); } + '(' virtual_column_func ')' vcol_opt_specifier vcol_opt_attribute { - $$= (enum enum_field_types)MYSQL_TYPE_VIRTUAL; - Lex->vcol_info->set_field_type((enum enum_field_types) $1); + $$= $4; + Lex->vcol_info->set_field_type($$.type); + $$.type= (enum enum_field_types)MYSQL_TYPE_VIRTUAL; } ; @@ -7534,11 +7539,11 @@ alter_list_item: { LEX *lex=Lex; if (add_field_to_list(lex->thd,&$4, - (enum enum_field_types) $6, - lex->length,lex->dec,lex->type, + $6.type, + $6.length, $6.dec, lex->type, lex->default_value, lex->on_update_value, &lex->comment, - $4.str, &lex->interval_list, lex->charset, + $4.str, &lex->interval_list, $6.charset, lex->uint_geom_type, lex->vcol_info, lex->option_list)) MYSQL_YYABORT; @@ -12822,7 +12827,7 @@ flush_lock: MYSQL_YYABORT; } Lex->type|= REFRESH_FOR_EXPORT; - } EXPORT_SYM + } EXPORT_SYM {} ; flush_options_list: @@ -14835,8 +14840,8 @@ lock: ; table_or_tables: - TABLE_SYM - | TABLES + TABLE_SYM {} + | TABLES {} ; table_lock_list: diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9d81cd51461..dbbf16e07c1 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -31,7 +31,7 @@ (for example in storage/myisam/ha_myisam.cc) ! */ -#include "sql_plugin.h" +#include "sql_plugin.h" // Includes my_global.h #include "sql_priv.h" #include "sql_class.h" // set_var.h: THD #include "sys_vars.h" @@ -2510,7 +2510,8 @@ static Sys_var_ulong Sys_thread_concurrency( "the desired number of threads that should be run at the same time." "This variable has no effect, and is deprecated. " "It will be removed in a future release.", - READ_ONLY GLOBAL_VAR(concurrency), CMD_LINE(REQUIRED_ARG), + READ_ONLY GLOBAL_VAR(concurrency), + CMD_LINE(REQUIRED_ARG, OPT_THREAD_CONCURRENCY), VALID_RANGE(1, 512), DEFAULT(DEFAULT_CONCURRENCY), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0), DEPRECATED("")); diff --git a/sql/table.cc b/sql/table.cc index bf84f1b282e..69b0faf0a9e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -17,7 +17,7 @@ /* Some general useful functions */ -#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */ +#include /* NO_EMBEDDED_ACCESS_CHECKS */ #include "sql_priv.h" #include "unireg.h" // REQUIRED: for other includes #include "table.h" @@ -949,10 +949,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, size_t length= *extra2++; if (!length) { - if (extra2 + 258 >= e2end) + if (extra2 + 2 >= e2end) goto err; length= uint2korr(extra2); - extra2+=2; + extra2+= 2; if (length < 256) goto err; } @@ -1669,10 +1669,44 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (key_parts) { uint add_first_key_parts= 0; - uint primary_key=(uint) (find_type(primary_key_name, &share->keynames, - FIND_TYPE_NO_PREFIX) - 1); longlong ha_option= handler_file->ha_table_flags(); keyinfo= share->key_info; + uint primary_key= my_strcasecmp(system_charset_info, share->keynames.type_names[0], + primary_key_name) ? MAX_KEY : 0; + + if (primary_key >= MAX_KEY && keyinfo->flags & HA_NOSAME) + { + /* + If the UNIQUE key doesn't have NULL columns and is not a part key + declare this as a primary key. + */ + primary_key= 0; + key_part= keyinfo->key_part; + for (i=0 ; i < keyinfo->user_defined_key_parts ;i++) + { + DBUG_ASSERT(key_part[i].fieldnr > 0); + // Table field corresponding to the i'th key part. + Field *table_field= share->field[key_part[i].fieldnr - 1]; + + /* + If the key column is of NOT NULL BLOB type, then it + will definitly have key prefix. And if key part prefix size + is equal to the BLOB column max size, then we can promote + it to primary key. + */ + if (!table_field->real_maybe_null() && + table_field->type() == MYSQL_TYPE_BLOB && + table_field->field_length == key_part[i].length) + continue; + + if (table_field->real_maybe_null() || + table_field->key_length() != key_part[i].length) + { + primary_key= MAX_KEY; // Can't be used + break; + } + } + } if (share->use_ext_keys) { @@ -1767,40 +1801,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (share->key_info[key].flags & HA_FULLTEXT) share->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT; - if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME)) - { - /* - If the UNIQUE key doesn't have NULL columns and is not a part key - declare this as a primary key. - */ - primary_key=key; - key_part= keyinfo->key_part; - for (i=0 ; i < keyinfo->user_defined_key_parts ;i++) - { - DBUG_ASSERT(key_part[i].fieldnr > 0); - // Table field corresponding to the i'th key part. - Field *table_field= share->field[key_part[i].fieldnr - 1]; - - /* - If the key column is of NOT NULL BLOB type, then it - will definitly have key prefix. And if key part prefix size - is equal to the BLOB column max size, then we can promote - it to primary key. - */ - if (!table_field->real_maybe_null() && - table_field->type() == MYSQL_TYPE_BLOB && - table_field->field_length == key_part[i].length) - continue; - - if (table_field->real_maybe_null() || - table_field->key_length() != key_part[i].length) - { - primary_key= MAX_KEY; // Can't be used - break; - } - } - } - key_part= keyinfo->key_part; uint key_parts= share->use_ext_keys ? keyinfo->ext_key_parts : keyinfo->user_defined_key_parts; @@ -6070,11 +6070,19 @@ bool TABLE::alloc_keys(uint key_count) } +/* + Given a field, fill key_part_info + @param keyinfo Key to where key part is added (we will + only adjust key_length there) + @param field IN Table field for which key part is needed + @param key_part_info OUT key part structure to be filled. + @param fieldnr Field's number. +*/ void TABLE::create_key_part_by_field(KEY *keyinfo, KEY_PART_INFO *key_part_info, Field *field, uint fieldnr) -{ - field->flags|= PART_KEY_FLAG; +{ + DBUG_ASSERT(field->field_index + 1 == (int)fieldnr); key_part_info->null_bit= field->null_bit; key_part_info->null_offset= (uint) (field->null_ptr - (uchar*) record[0]); @@ -6231,6 +6239,7 @@ bool TABLE::add_tmp_key(uint key, uint key_parts, (*reg_field)->key_start.set_bit(key); (*reg_field)->part_of_key.set_bit(key); create_key_part_by_field(keyinfo, key_part_info, *reg_field, fld_idx+1); + (*reg_field)->flags|= PART_KEY_FLAG; key_start= FALSE; key_part_info++; } @@ -6730,7 +6739,7 @@ int TABLE::update_default_fields() DBUG_ASSERT(default_field); - /* Iterate over virtual fields in the table */ + /* Iterate over fields with default functions in the table */ for (dfield_ptr= default_field; *dfield_ptr; dfield_ptr++) { dfield= (*dfield_ptr); @@ -6747,12 +6756,16 @@ int TABLE::update_default_fields() if (res) DBUG_RETURN(res); } - /* Unset the explicit default flag for the next record. */ - dfield->flags&= ~HAS_EXPLICIT_VALUE; } DBUG_RETURN(res); } +void TABLE::reset_default_fields() +{ + if (default_field) + for (Field **df= default_field; *df; df++) + (*df)->flags&= ~HAS_EXPLICIT_VALUE; +} /* Prepare triggers for INSERT-like statement. diff --git a/sql/table.h b/sql/table.h index 8e31c0e2600..58b78af6836 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1377,6 +1377,7 @@ public: uint actual_n_key_parts(KEY *keyinfo); ulong actual_key_flags(KEY *keyinfo); int update_default_fields(); + void reset_default_fields(); inline ha_rows stat_records() { return used_stat_records; } void prepare_triggers_for_insert_stmt_or_event(); diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index a14ed36837b..9786f1a6942 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -17,6 +17,7 @@ /* Mallocs for used in threads */ +#include #include "sql_priv.h" #include "unireg.h" #include "thr_malloc.h" diff --git a/sql/transaction.cc b/sql/transaction.cc index 8418ef304b0..64aab3403a4 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -18,6 +18,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include "transaction.h" #include "rpl_handler.h" diff --git a/sql/uniques.cc b/sql/uniques.cc index 0990182dbdb..912a38f8927 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -30,6 +30,7 @@ deletes in disk order. */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_sort.h" diff --git a/sql/unireg.cc b/sql/unireg.cc index c60a13e5f44..12d3c265a86 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -25,6 +25,7 @@ str is a (long) to record position where 0 is the first position. */ +#include #include "sql_priv.h" #include "unireg.h" #include "sql_partition.h" // struct partition_info @@ -32,7 +33,6 @@ #include "create_options.h" #include "discover.h" #include -#include #define FCOMP 17 /* Bytes for a packed field */ diff --git a/sql/unireg.h b/sql/unireg.h index 5f133da674f..2d51aa39fd4 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -18,8 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "my_global.h" /* ulonglong */ -#include "mysql_version.h" /* FRM_VER */ +#include /* FRM_VER */ /* Extra functions used by unireg library */ diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index 6b2b419e63a..28ad4cc17bc 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -16,6 +16,7 @@ #ifndef WSREP_SST_H #define WSREP_SST_H +#include #include // my_bool #define WSREP_SST_OPT_ROLE "--role" diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 6c308e7eef1..c1acef4596f 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -21,7 +21,7 @@ #pragma implementation // gcc: Class implementation #endif -#include "sql_class.h" // SSV +#include "sql_class.h" // SSV and my_global.h #include "sql_table.h" // build_table_filename #include // T_EXTEND diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 91a2c70cb9f..56d8000d64d 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -19,6 +19,7 @@ #endif #define MYSQL_SERVER 1 +#include #include "sql_priv.h" #include "unireg.h" #include "ha_blackhole.h" diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index 7e2d7efe87d..9b30445fcd2 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -18,6 +18,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include #include "ha_cassandra.h" #include "sql_class.h" diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 40d38fdc3b5..40b2a84d87d 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -23,15 +23,15 @@ array.cpp blkfil.cpp colblk.cpp csort.cpp filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp filter.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp table.cpp tabmul.cpp taboccur.cpp -tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabxcl.cpp -valblk.cpp value.cpp xindex.cpp xobject.cpp +tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabvir.cpp +tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h filter.h global.h ha_connect.h inihandl.h maputil.h msgid.h mycat.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabmul.h taboccur.h tabpivot.h tabsys.h -tabtbl.h tabutil.h tabvct.h tabxcl.h user_connect.h valblk.h value.h +tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h user_connect.h valblk.h value.h xindex.h xobject.h xtable.h) # diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index 9815fbb6be6..a2f537436c9 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -25,6 +25,7 @@ #include #include #include +#include // for uintprt_h #endif // !WIN32 /***********************************************************************/ @@ -50,11 +51,6 @@ #define ASSERT(B) #endif -/***********************************************************************/ -/* Static variables. */ -/***********************************************************************/ -extern "C" int trace; - /***********************************************************************/ /* DB static external variables. */ /***********************************************************************/ @@ -129,7 +125,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp) break; case TYPE_VOID: // Integer stored inside pp->Value - par->AddValue(g, (int)parmp->Value); + par->AddValue(g, parmp->Intval); break; } // endswitch valtyp @@ -585,7 +581,7 @@ bool ARRAY::CanBeShort(void) /***********************************************************************/ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) { - int i; + int i, prec = 0; bool b = FALSE; PMBV ovblk = Valblk; PVBLK ovblp = Vblp; @@ -595,6 +591,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) switch (Type) { case TYPE_DOUBLE: + prec = 2; case TYPE_SHORT: case TYPE_INT: case TYPE_DATE: @@ -607,13 +604,13 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) Size = Nval; Nval = 0; - Vblp = Valblk->Allocate(g, Type, Len, 0, Size); + Vblp = Valblk->Allocate(g, Type, Len, prec, Size); if (!Valblk->GetMemp()) // The error message was built by PlgDBalloc return TYPE_ERROR; else - Value = AllocateValue(g, Type, Len, 0, NULL); + Value = AllocateValue(g, Type, Len, prec, NULL); /*********************************************************************/ /* Converting STRING to DATE can be done according to date format. */ diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp index c1099261cef..802231b24ec 100644 --- a/storage/connect/blkfil.cpp +++ b/storage/connect/blkfil.cpp @@ -39,11 +39,6 @@ #include "array.h" // ARRAY classes dcls #include "blkfil.h" // Block Filter classes dcls -/***********************************************************************/ -/* Static variables. */ -/***********************************************************************/ -extern "C" int trace; - /* ------------------------ Class BLOCKFILTER ------------------------ */ /***********************************************************************/ diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp index 81ab1ad7245..78aba7bc494 100644 --- a/storage/connect/colblk.cpp +++ b/storage/connect/colblk.cpp @@ -23,8 +23,6 @@ #include "xindex.h" #include "xtable.h" -extern "C" int trace; - /***********************************************************************/ /* COLBLK protected constructor. */ /***********************************************************************/ diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 381e437f9ec..87c782ba953 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -48,11 +48,6 @@ #define my_strlwr(p) my_casedn_str(default_charset_info, (p)); #define my_stricmp(a, b) my_strcasecmp(default_charset_info, (a), (b)) -/***********************************************************************/ -/* DB static variables. */ -/***********************************************************************/ -extern "C" int trace; - /***********************************************************************/ /* Routines called internally by semantic routines. */ /***********************************************************************/ @@ -281,16 +276,13 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, if (trace) printf("Allocating column %s\n", p); -// if (*p == '*') { -// // This is a special column -// cp= new(g) COLUMN(p + 1); -// cp->SetTo_Table(tdbp->GetTable()); -// colp= ((PTDBASE)tdbp)->InsertSpcBlk(g, cp); -// } else - colp= tdbp->ColDB(g, p, 0); + g->Message[0] = 0; // To check whether ColDB made an error message + colp= tdbp->ColDB(g, p, 0); + + if (!colp && !(mode == MODE_INSERT && tdbp->IsSpecial(p))) { + if (g->Message[0] == 0) + sprintf(g->Message, MSG(COL_ISNOT_TABLE), p, tdbp->GetName()); - if (!colp) { - sprintf(g->Message, "Column %s not found in %s", p, tdbp->GetName()); goto err; } // endif colp @@ -421,14 +413,14 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool mrr) for (colp= tdbp->GetColumns(); rc == RC_OK && colp; colp= colp->GetNext()) { - colp->Reset(); + colp->Reset(); - // Virtual columns are computed by MariaDB - if (!colp->GetColUse(U_VIRTUAL) && (!mrr || colp->GetKcol())) - if (colp->Eval(g)) - rc= RC_FX; + // Virtual columns are computed by MariaDB + if (!colp->GetColUse(U_VIRTUAL) && (!mrr || colp->GetKcol())) + if (colp->Eval(g)) + rc= RC_FX; - } // endfor colp + } // endfor colp err: g->jump_level--; @@ -659,8 +651,10 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) if (!ptdb) return -1; else if (!((PTDBASE)ptdb)->GetDef()->Indexable()) { - sprintf(g->Message, "CntIndexInit: Table %s is not indexable", ptdb->GetName()); + sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); return 0; + } else if (((PTDBASE)ptdb)->GetDef()->Indexable() == 3) { + return 1; } else tdbp= (PTDBDOX)ptdb; @@ -730,13 +724,21 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, x= ((PTDBASE)ptdb)->GetDef()->Indexable(); if (!x) { - sprintf(g->Message, "CntIndexRead: Table %s is not indexable", ptdb->GetName()); + sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); return RC_FX; } else if (x == 2) { // Remote index if (ptdb->ReadKey(g, op, key, len)) return RC_FX; + goto rnd; + } else if (x == 3) { + if (key) + ((PTDBASE)ptdb)->SetRecpos(g, *(int*)key); + + if (op == OP_SAME) + return RC_NF; + goto rnd; } else tdbp= (PTDBDOX)ptdb; @@ -836,12 +838,21 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, x= ((PTDBASE)ptdb)->GetDef()->Indexable(); if (!x) { - sprintf(g->Message, "CntIndexRange: Table %s is not indexable", ptdb->GetName()); + sprintf(g->Message, MSG(TABLE_NO_INDEX), ptdb->GetName()); DBUG_PRINT("Range", ("%s", g->Message)); return -1; } else if (x == 2) { // Remote index return 2; + } else if (x == 3) { + // Virtual index + for (i= 0; i < 2; i++) + if (key[i]) + k[i] = *(int*)key[i] + (incl[i] ? 0 : 1 - 2 * i); + else + k[i] = (i) ? ptdb->Cardinality(g) : 1; + + return k[1] - k[0] + 1; } else tdbp= (PTDBDOX)ptdb; diff --git a/storage/connect/encas.h b/storage/connect/encas.h new file mode 100644 index 00000000000..37e97f211e6 --- /dev/null +++ b/storage/connect/encas.h @@ -0,0 +1,320 @@ + case MSG_ACCESS_VIOLATN: p = "Access violation"; break; + case MSG_ADD_BAD_TYPE: p = "Array add value type mismatch (%s -> %s)"; break; + case MSG_ALLOC_ERROR: p = "Error allocating %s"; break; + case MSG_ANSWER_TYPE: p = "Answer of type"; break; + case MSG_API_CONF_ERROR: p = "SQL Error: API_CONFORMANCE"; break; + case MSG_APPL_NOT_INIT: p = "Application not initialized"; break; + case MSG_ARRAY_BNDS_EXCD: p = "Array bounds exceeded"; break; + case MSG_BAD_ARRAY_OPER: p = "Arrays must be used with the IN operator"; break; + case MSG_BAD_ARRAY_TYPE: p = "Illegal array type %d"; break; + case MSG_BAD_ARRAY_VAL: p = "Arrays must have the same number of values"; break; + case MSG_BAD_BIN_FMT: p = "Invalid format %c for the %s BIN column"; break; + case MSG_BAD_BLK_ESTIM: p = "Number of blocks exceeds estimate"; break; + case MSG_BAD_BLK_SIZE: p = "No match in block %d size"; break; + case MSG_BAD_BYTE_NUM: p = "bad number of bytes written"; break; + case MSG_BAD_BYTE_READ: p = "bad number of bytes read"; break; + case MSG_BAD_COL_TYPE: p = "Invalid type %s for column %s"; break; + case MSG_BAD_COL_XPATH: p = "Invalid Xpath in column %s for HTML table %s"; break; + case MSG_BAD_CONST_TYPE: p = "Bad constant type=%d"; break; + case MSG_BAD_CONV_TYPE: p = "Invalid convert type %d"; break; + case MSG_BAD_DATETIME: p = "Invalid datetime value"; break; + case MSG_BAD_DBF_FILE: p = "DBF file %s is corrupted"; break; + case MSG_BAD_DBF_REC: p = "DBF file %s corrupted at record %d"; break; + case MSG_BAD_DBF_TYPE: p = "Unsupported DBF type %c for column %s"; break; + case MSG_BAD_DIRECTORY: p = "Bad directory %s: %s"; break; + case MSG_BAD_FIELD_RANK: p = "Invalid field rank %d for column %s"; break; + case MSG_BAD_FIELD_TYPE: p = "Bad type field %s"; break; + case MSG_BAD_FILE_HANDLE: p = "Invalid File Handle: %s"; break; + case MSG_BAD_FILTER: p = "Bad filter: Opc=%d B_T=%d %d Type=%d %d"; break; + case MSG_BAD_FILTER_CONV: p = "Bad filter conversion, B_T=%d,%d"; break; + case MSG_BAD_FILTER_OP: p = "Invalid filter operator %d"; break; + case MSG_BAD_FLD_FORMAT: p = "Bad format for field %d of %s"; break; + case MSG_BAD_FLD_LENGTH: p = "Field %s too long (%s --> %d) line %d of %s"; break; + case MSG_BAD_FREQ_SET: p = "Bad frequency setting for column %s"; break; + case MSG_BAD_FUNC_MODE: p = "%s: invalid mode %d"; break; + case MSG_BAD_HANDLE_VAL: p = "Invalid handle value"; break; + case MSG_BAD_HEADER: p = "File %s: Header corrupted"; break; + case MSG_BAD_HEAD_END: p = "Can't read end of header"; break; + case MSG_BAD_INDEX_FILE: p = "Wrong index file %s"; break; + case MSG_BAD_LINEFLD_FMT: p = "Bad format line %d field %d of %s"; break; + case MSG_BAD_LINE_LEN: p = "Line length not equal to Lrecl"; break; + case MSG_BAD_LRECL: p = "Table/File lrecl mismatch (%d,%hd)"; break; + case MSG_BAD_NODE_TYPE: p = "Bad type %d for table node"; break; + case MSG_BAD_OFFSET_VAL: p = "Invalid null offset value for a CSV table"; break; + case MSG_BAD_OPEN_MODE: p = "Invalid open mode %d"; break; + case MSG_BAD_PARAM_TYPE: p = "%.8s: Bad parameter type=%d"; break; + case MSG_BAD_PARM_COUNT: p = "Parameter count mismatch"; break; + case MSG_BAD_QUOTE_FIELD: p = "Missing ending quote in %s field %d line %d"; break; + case MSG_BAD_READ_NUMBER: p = "Wrong number %d of values read from %s"; break; + case MSG_BAD_RECFM: p = "Invalid recfm type %d for DOSCOL"; break; + case MSG_BAD_RECFM_VAL: p = "Bad Recfm value %d"; break; + case MSG_BAD_SET_CASE: p = "Cannot set sensitive an insensitive array"; break; + case MSG_BAD_SET_STRING: p = "Invalid SetValue from string"; break; + case MSG_BAD_SPECIAL_COL: p = "Bad special column %s"; break; + case MSG_BAD_SPEC_COLUMN: p = "Special column invalid for this table type"; break; + case MSG_BAD_TABLE_TYPE: p = "Bad type %s for table %s"; break; + case MSG_BAD_TYPE_LIKE: p = "Bad operand(%d) type=%d for LIKE"; break; + case MSG_BAD_VALBLK_INDX: p = "Out of range valblock index value"; break; + case MSG_BAD_VALBLK_TYPE: p = "Invalid value block type %d"; break; + case MSG_BAD_VALNODE: p = "Bad type %d for column %s value node"; break; + case MSG_BAD_VALUE_TYPE: p = "Invalid value type %d"; break; + case MSG_BAD_VAL_UPDATE: p = "Don't know which %s value to update"; break; + case MSG_BAS_NS_LIST: p = "Invalid namespaces list format"; break; + case MSG_BIN_F_TOO_LONG: p = "Value too long for field %s (%d --> %d)"; break; + case MSG_BIN_MODE_FAIL: p = "Set binary mode failed: %s"; break; + case MSG_BLKTYPLEN_MISM: p = "Non matching block types/lengths in SetValue"; break; + case MSG_BLK_IS_NULL: p = "Blk is NULL"; break; + case MSG_BREAKPOINT: p = "Breakpoint"; break; + case MSG_BUILD_INDEX: p = "Building index %s on %s"; break; + case MSG_CANNOT_OPEN: p = "Cannot open %s"; break; + case MSG_CHSIZE_ERROR: p = "chsize error: %s"; break; + case MSG_COL_ALLOC_ERR: p = "Cannot allocate column node"; break; + case MSG_COL_ISNOT_TABLE: p = "Column %s is not in table %s"; break; + case MSG_COL_NOT_SORTED: p = "Column %s of table %s is not sorted"; break; + case MSG_COL_NUM_MISM: p = "Number of columns mismatch"; break; + case MSG_COM_ERROR: p = "Com error"; break; + case MSG_CONCAT_SUBNODE: p = "Cannot concatenate sub-nodes"; break; + case MSG_CONNECT_CANCEL: p = "Connection cancelled by user"; break; + case MSG_CONTROL_C_EXIT: p = "Control C exit"; break; + case MSG_DATABASE_LOADED: p = "Database %s loaded"; break; + case MSG_DATA_MISALIGN: p = "Datatype misalignment"; break; + case MSG_DBASE_FILE: p = "dBASE dbf file: "; break; + case MSG_DEF_ALLOC_ERROR: p = "Error allocating %s DEF class"; break; + case MSG_DEL_FILE_ERR: p = "Error deleting %s"; break; + case MSG_DEL_READ_ERROR: p = "Delete: read error req=%d len=%d"; break; + case MSG_DEL_WRITE_ERROR: p = "Delete: write error: %s"; break; + case MSG_DEPREC_FLAG: p = "Deprecated option Flag, use Coltype"; break; + case MSG_DLL_LOAD_ERROR: p = "Error %d loading module %s"; break; + case MSG_DOM_NOT_SUPP: p = "MS-DOM not supported by this version"; break; + case MSG_DVAL_NOTIN_LIST: p = "Value %s not found in distinct values list of column %s"; break; + case MSG_EMPTY_DOC: p = "Empty document"; break; + case MSG_EMPTY_FILE: p = "%s empty file %s: "; break; + case MSG_EOF_AFTER_LINE: p = "EOF after line %d"; break; + case MSG_EOF_INDEX_FILE: p = "EOF while reading index file"; break; + case MSG_ERROR_IN_LSK: p = "Error %d in lseek64"; break; + case MSG_ERROR_IN_SFP: p = "Error %d in SetFilePointer"; break; + case MSG_ERR_READING_REC: p = "Error reading record %d of %s"; break; + case MSG_FAIL_ADD_NODE: p = "Failed to add %s table node"; break; + case MSG_FETCH_NO_RES: p = "Fetch: No Result Set"; break; + case MSG_FIELD_TOO_LONG: p = "Value too long for field %d line %d"; break; + case MSG_FILELEN_ERROR: p = "Error in %s for %s"; break; + case MSG_FILE_IS_EMPTY: p = "File %s is empty"; break; + case MSG_FILE_MAP_ERR: p = "File mapping error"; break; + case MSG_FILE_MAP_ERROR: p = "CreateFileMapping %s error rc=%d"; break; + case MSG_FILE_OPEN_YET: p = "File %s already open"; break; + case MSG_FILE_UNFOUND: p = "File %s not found"; break; + case MSG_FLD_TOO_LNG_FOR: p = "Field %d too long for %s line %d of %s"; break; + case MSG_FLT_BAD_RESULT: p = "Float inexact result"; break; + case MSG_FLT_DENORMAL_OP: p = "Float denormal operand"; break; + case MSG_FLT_INVALID_OP: p = "Float invalid operation"; break; + case MSG_FLT_OVERFLOW: p = "Float overflow"; break; + case MSG_FLT_STACK_CHECK: p = "Float stack check"; break; + case MSG_FLT_UNDERFLOW: p = "Float underflow"; break; + case MSG_FLT_ZERO_DIVIDE: p = "Float divide by zero"; break; + case MSG_FMT_WRITE_NIY: p = "Writing %s files is not implemented yet"; break; + case MSG_FOXPRO_FILE: p = "FoxPro file: "; break; + case MSG_FPUTS_ERROR: p = "fputs error: %s"; break; + case MSG_FSEEK_ERROR: p = "fseek error: %s"; break; + case MSG_FSETPOS_ERROR: p = "fseek error for i=%d"; break; + case MSG_FTELL_ERROR: p = "ftell error for recd=%d: %s"; break; + case MSG_FUNCTION_ERROR: p = "%s error: %d"; break; + case MSG_FUNC_ERRNO: p = "Error %d in %s"; break; + case MSG_FUNC_ERROR: p = "Error in %s"; break; + case MSG_FUNC_ERR_S: p = "%s error: %s"; break; + case MSG_FWRITE_ERROR: p = "fwrite error: %s"; break; + case MSG_GET_DIST_VALS: p = "Retrieving distinct values from "; break; + case MSG_GET_FUNC_ERR: p = "Error getting function %s: %s"; break; + case MSG_GLOBAL_ERROR: p = "Cannot allocate Global (size=%d)\n"; break; + case MSG_GUARD_PAGE: p = "Guard page violation"; break; + case MSG_GZOPEN_ERROR: p = "gzopen %s error %d on %s"; break; + case MSG_ILLEGAL_INSTR: p = "Illegal instruction"; break; + case MSG_ILL_FILTER_CONV: p = "Filtering implies an illegal conversion"; break; + case MSG_INDEX_NOT_UNIQ: p = "Index is not unique"; break; + case MSG_INDEX_YET_ON: p = "Index %s already exists on %s"; break; + case MSG_INDX_COL_NOTIN: p = "Index column %s is not in table %s"; break; + case MSG_INDX_EXIST_YET: p = "Index entry already exists"; break; + case MSG_INIT_FAILED: p = "Failed to initialize %s processing"; break; + case MSG_INT_COL_ERROR: p = "Internal error for index column %s"; break; + case MSG_INT_OVERFLOW: p = "Integer overflow"; break; + case MSG_INT_ZERO_DIVIDE: p = "Integer divide by zero"; break; + case MSG_INVALID_DISP: p = "Invalid disposition"; break; + case MSG_INVALID_FTYPE: p = "SBV: invalid Ftype %d"; break; + case MSG_INVALID_HANDLE: p = "Invalid handle"; break; + case MSG_INVALID_OPER: p = "Invalid operator %d for %s"; break; + case MSG_INV_COLUMN_TYPE: p = "Invalid type %d for column %s"; break; + case MSG_INV_COL_TYPE: p = "Invalid column type %s"; break; + case MSG_INV_DEF_READ: p = "Invalid deferred Read rc=%d"; break; + case MSG_INV_DIRCOL_OFST: p = "Invalid DIRCOL offset %d"; break; + case MSG_INV_MAP_POS: p = "Invalid map position"; break; + case MSG_INV_RAND_ACC: p = "Invalid random access to non optimized table"; break; + case MSG_INV_REC_POS: p = "Invalid record position"; break; + case MSG_INV_RESULT_TYPE: p = "Invalid result type %s"; break; + case MSG_INV_UPDT_TABLE: p = "Table %s invalid for update"; break; + case MSG_IN_WITHOUT_SUB: p = "IN or EXISTS without array or subquery"; break; + case MSG_KEY_ALLOC_ERR: p = "Error allocating Key offset block"; break; + case MSG_KEY_ALLOC_ERROR: p = "Memory allocation error, Klen=%d n=%d"; break; + case MSG_LINE_TOO_LONG: p = "New line is too long"; break; + case MSG_LIST: p = "--List--"; break; + case MSG_LOADING_FAILED: p = "Loading of %s failed"; break; + case MSG_LRECL_TOO_SMALL: p = "Lrecl too small (headlen = %d)"; break; + case MSG_MAKE_EMPTY_FILE: p = "Making empty file %s: %s"; break; + case MSG_MAKING: p = "Making"; break; + case MSG_MALLOC_ERROR: p = "Memory allocation failed: %s returned Null"; break; + case MSG_MAP_VIEW_ERROR: p = "MapViewOfFile %s error rc=%d"; break; + case MSG_MAXSIZE_ERROR: p = "Cannot calculate max size on open table"; break; + case MSG_MEM_ALLOC_ERR: p = "Memory allocation error, %s size=%d"; break; + case MSG_MEM_ALLOC_ERROR: p = "Memory allocation error"; break; + case MSG_MISPLACED_QUOTE: p = "Misplaced quote in line %d"; break; + case MSG_MISSING_ARG: p = "Missing argument for operator %d"; break; + case MSG_MISSING_FIELD: p = "Missing field %d in %s line %d"; break; + case MSG_MISSING_FNAME: p = "Missing file name"; break; + case MSG_MISSING_NODE: p = "Missing %s node in %s"; break; + case MSG_MISSING_ROWNODE: p = "Can't find RowNode for row %d"; break; + case MSG_MIS_TAG_LIST: p = "Missing column tag list"; break; + case MSG_MUL_MAKECOL_ERR: p = "Tabmul MakeCol logical error"; break; + case MSG_NAME_CONV_ERR: p = "Error converting node name"; break; + case MSG_NEW_DOC_FAILED: p = "Cannot create new document"; break; + case MSG_NEW_RETURN_NULL: p = "New returned Null in PlugEvalLike"; break; + case MSG_NEXT_FILE_ERROR: p = "Couldn't find next file. rc=%d"; break; + case MSG_NONCONT_EXCEPT: p = "Noncontinuable exception"; break; + case MSG_NOP_ZLIB_INDEX: p = "Cannot do indexing on non optimized zlib table"; break; + case MSG_NOT_A_DBF_FILE: p = "Not a dBASE dbf file "; break; + case MSG_NOT_FIXED_LEN: p = "File %s is not fixed length, len=%d lrecl=%d"; break; + case MSG_NO_0DH_HEAD: p = "No 0Dh at end of header (dbc=%d)"; break; + case MSG_NO_ACTIVE_DB: p = "No active database"; break; + case MSG_NO_CHAR_FROM: p = "Cannot return char value from type %d"; break; + case MSG_NO_DATE_FMT: p = "No date format for valblock of type %d"; break; + case MSG_NO_DEF_FNCCOL: p = "Cannot find default function column"; break; + case MSG_NO_DEF_PIVOTCOL: p = "Cannot find default pivot column"; break; + case MSG_NO_DIR_INDX_RD: p = "No direct access of %s tables"; break; + case MSG_NO_FEAT_SUPPORT: p = "No %s support in this version"; break; + case MSG_NO_FLD_FORMAT: p = "Missing format for field %d of %s"; break; + case MSG_NO_FORMAT_COL: p = "Cannot format the type COLUMN"; break; + case MSG_NO_FORMAT_TYPE: p = "Cannot set format from type %d"; break; + case MSG_NO_INDEX_READ: p = "No indexed read for multiple tables"; break; + case MSG_NO_KEY_COL: p = "No key columns found"; break; + case MSG_NO_KEY_UPDATE: p = "Cannot update key names"; break; + case MSG_NO_MAP_INSERT: p = "MAP incompatible with Insert"; break; + case MSG_NO_MATCHING_COL: p = "No matching column %s in %s"; break; + case MSG_NO_MATCH_COL: p = "Cannot find matching column"; break; + case MSG_NO_MEMORY: p = "No memory"; break; + case MSG_NO_MODE_PADDED: p = "Mode not supported for padded files"; break; + case MSG_NO_MUL_VCT: p = "VCT tables cannot be multiple"; break; + case MSG_NO_ODBC_DELETE: p = "Delete should not be called for ODBC tables"; break; + case MSG_NO_ODBC_DIRECT: p = "Direct access of ODBC tables not implemented yet"; break; + case MSG_NO_ODBC_MUL: p = "Multiple(2) not supported for ODBC tables"; break; + case MSG_NO_ODBC_SPECOL: p = "No ODBC special columns"; break; + case MSG_NO_PART_DEL: p = "No partial delete of %s files"; break; + case MSG_NO_PART_MAP: p = "Partial mapping not implemented for this OS"; break; + case MSG_NO_PAR_BLK_INS: p = "Cannot insert partial block yet"; break; + case MSG_NO_PIV_DIR_ACC: p = "No direct access to PIVOT tables"; break; + case MSG_NO_READ_32: p = "Can't read 32 bytes"; break; + case MSG_NO_RECOV_SPACE: p = "Cannot recover space in index file"; break; + case MSG_NO_ROWID_FOR_AM: p = "Can't get RowID in direct access for tables of type %s"; break; + case MSG_NO_ROW_NODE: p = "Row node name is not defined"; break; + case MSG_NO_SECTION_NAME: p = "Missing section name"; break; + case MSG_NO_SEC_UPDATE: p = "Cannot update section names"; break; + case MSG_NO_SETPOS_YET: p = "%s SetPos not implemented yet"; break; + case MSG_NO_SPEC_COL: p = "No MySQL special columns"; break; + case MSG_NO_SUB_VAL: p = "No sub value for array of type %d"; break; + case MSG_NO_TABCOL_DATA: p = "No data found for table %s column %s"; break; + case MSG_NO_TABLE_DEL: p = "Delete not enabled for %s tables "; break; + case MSG_NO_TAB_DATA: p = "No data found for table %s"; break; + case MSG_NO_VCT_DELETE: p = "Partial delete not yet implemented for VCT files"; break; + case MSG_NO_ZIP_DELETE: p = "Delete Zip files not implemented yet"; break; + case MSG_OPENING: p = "Opening"; break; + case MSG_OPEN_EMPTY_FILE: p = "Opening empty file %s: %s"; break; + case MSG_OPEN_ERROR: p = "Open error %d in mode %d on %s: "; break; + case MSG_OPEN_ERROR_IS: p = "Open error on %s: %s"; break; + case MSG_OPEN_MODE_ERROR: p = "Open(%s) error %d on %s"; break; + case MSG_OPEN_STRERROR: p = "open error: %s"; break; + case MSG_OPTBLK_RD_ERR: p = "Error reading opt block values: %s"; break; + case MSG_OPTBLK_WR_ERR: p = "Error writing opt block values: %s"; break; + case MSG_OPTIMIZING: p = "Optimizing "; break; + case MSG_OPT_BMAP_RD_ERR: p = "Error reading opt bitmaps: %s"; break; + case MSG_OPT_BMAP_WR_ERR: p = "Error writing opt bitmaps: %s"; break; + case MSG_OPT_CANCELLED: p = "Optimize cancelled by User"; break; + case MSG_OPT_DVAL_RD_ERR: p = "Error reading distinct values: %s"; break; + case MSG_OPT_DVAL_WR_ERR: p = "Error writing distinct values: %s"; break; + case MSG_OPT_HEAD_RD_ERR: p = "Error reading opt file header: %s"; break; + case MSG_OPT_HEAD_WR_ERR: p = "Error writing opt file header: %s"; break; + case MSG_OPT_LOGIC_ERR: p = "Logical error in SetBitmap, i=%d"; break; + case MSG_OPT_MAX_RD_ERR: p = "Error reading opt max values: %s"; break; + case MSG_OPT_MAX_WR_ERR: p = "Error writing opt max values: %s"; break; + case MSG_OPT_MIN_RD_ERR: p = "Error reading opt min values: %s"; break; + case MSG_OPT_MIN_WR_ERR: p = "Error writing opt min values: %s"; break; + case MSG_OPT_NOT_MATCH: p = "Non-matching opt file %s"; break; + case MSG_PAGE_ERROR: p = "In page error"; break; + case MSG_PARM_CNT_MISS: p = "Parameter count mismatch"; break; + case MSG_PREC_VBLP_NULL: p = "ARRAY SetPrecision: Vblp is NULL"; break; + case MSG_PRIV_INSTR: p = "Privileged instruction"; break; + case MSG_PROCADD_ERROR: p = "Error %d getting address of %s"; break; + case MSG_QUERY_CANCELLED: p = "Query Cancelled by User"; break; + case MSG_RANGE_NO_JOIN: p = "Range is not meant for join index"; break; + case MSG_RC_READING: p = "rc=%d reading table %s"; break; + case MSG_READY: p = "Ready"; break; + case MSG_READ_ERROR: p = "Error reading %s: %s"; break; + case MSG_READ_ONLY: p = "Cannot modify this read/only protected table"; break; + case MSG_READ_SEEK_ERROR: p = "Read seek error: %s"; break; + case MSG_REGISTER_ERR: p = "Unable to register NS with prefix='%s' and href='%s'"; break; + case MSG_REMOVE_ERROR: p = "Error removing %s: %s"; break; + case MSG_RENAME_ERROR: p = "Error renaming %s to %s: %s"; break; + case MSG_ROWID_NOT_IMPL: p = "RowNumber not implemented for tables of type %s"; break; + case MSG_SEC_KEY_FIRST: p = "Section and key names must come first on Insert"; break; + case MSG_SEC_NAME_FIRST: p = "Section name must come first on Insert"; break; + case MSG_SEP_IN_FIELD: p = "Field %d contains the separator character"; break; + case MSG_SEQUENCE_ERROR: p = "Sequence error on statement allocation"; break; + case MSG_SETEOF_ERROR: p = "Error %d in SetEndOfFile"; break; + case MSG_SETRECPOS_NIY: p = "SetRecpos not implemented for this table type"; break; + case MSG_SET_STR_TRUNC: p = "SetValue: String would be truncated"; break; + case MSG_SFP_ERROR: p = "SetFilePointer error: %s"; break; + case MSG_SHARED_LIB_ERR: p = "Error loading shared library %s: %s"; break; + case MSG_SINGLE_STEP: p = "Single step"; break; + case MSG_SORTING_VAL: p = "Sorting %d values"; break; + case MSG_SPCOL_READONLY: p = "Special column %s is Read Only"; break; + case MSG_SQL_CONF_ERROR: p = "SQL Error: SQL_CONFORMANCE"; break; + case MSG_SRCH_CLOSE_ERR: p = "Couldn't close search handle"; break; + case MSG_SRC_TABLE_UNDEF: p = "Source table is not defined"; break; + case MSG_STACK_OVERFLOW: p = "Stack overflow"; break; + case MSG_TABDIR_READONLY: p = "DIR tables are read/only"; break; + case MSG_TABLE_NOT_OPT: p = "Not an optimizable table"; break; + case MSG_TABLE_NO_INDEX: p = "Table %s is not indexable"; break; + case MSG_TABLE_READ_ONLY: p = "%s tables are read only "; break; + case MSG_TABMUL_READONLY: p = "Multiple tables are read/only"; break; + case MSG_TOO_MANY_FIELDS: p = "Too many fields line %d of %s"; break; + case MSG_TOO_MANY_JUMPS: p = "Too many jump levels"; break; + case MSG_TOO_MANY_KEYS: p = "Too many keys (%d)"; break; + case MSG_TO_BLK_IS_NULL: p = "To Blk is NULL"; break; + case MSG_TRUNCATE_ERROR: p = "truncate error: %s"; break; + case MSG_TRUNC_BY_ESTIM: p = "truncated by Estimate"; break; + case MSG_TYPE_MISMATCH: p = "Key and source are not of the same type"; break; + case MSG_TYPE_VALUE_ERR: p = "Column %s type(%s)/value(%s) mismatch"; break; + case MSG_UNBALANCE_QUOTE: p = "Unbalanced quote in line %d"; break; + case MSG_UNDEFINED_AM: p = "COLBLK %s: undefined Access Method"; break; + case MSG_UNKNOWN_EXCPT: p = "Unknown exception"; break; + case MSG_UNMATCH_FIL_ARG: p = "Unmatched filter argument"; break; + case MSG_UPDATE_ERROR: p = "Error updating %s"; break; + case MSG_UPD_ZIP_NOT_IMP: p = "Updating ZDOS tables not implemented yet"; break; + case MSG_VALSTR_TOO_LONG: p = "Value %s too long for string of length %d"; break; + case MSG_VALTYPE_NOMATCH: p = "Non matching Value types"; break; + case MSG_VALUE_ERROR: p = "Column %s: value is null"; break; + case MSG_VALUE_TOO_BIG: p = "Value %lld too big for column %s"; break; + case MSG_VALUE_TOO_LONG: p = "Value %s too long for column %s of length %d"; break; + case MSG_VAL_ALLOC_ERR: p = "Cannot allocate value node"; break; + case MSG_VIR_NO_DELETE: p = "Delete not allowed for %s tables"; break; + case MSG_VIR_READ_ONLY: p = "Virtual %s tables are read only"; break; + case MSG_VOID_FIRST_ARG: p = "First argument should not be void"; break; + case MSG_WORK_AREA: p = "Work area: %s"; break; + case MSG_WRITE_SEEK_ERR: p = "Write seek error: %s"; break; + case MSG_WRITE_STRERROR: p = "Error writing %s: %s"; break; + case MSG_WRITING: p = "Writing"; break; + case MSG_WRITING_ERROR: p = "Error writing to %s: %s"; break; + case MSG_WS_CONV_ERR: p = "Error converting %s to WS"; break; + case MSG_XCOL_MISMATCH: p = "Column %s mismatch in index"; break; + case MSG_XFILE_READERR: p = "Error %d reading index file"; break; + case MSG_XFILE_WRITERR: p = "Error writing index file: %s"; break; + case MSG_XMLTAB_INIT_ERR: p = "Error initializing XML table"; break; + case MSG_XML_INIT_ERROR: p = "Error initializing new XML file"; break; + case MSG_XPATH_CNTX_ERR: p = "Unable to create new XPath context"; break; + case MSG_XPATH_EVAL_ERR: p = "Unable to evaluate xpath location '%s'"; break; + case MSG_XPATH_NOT_SUPP: p = "Unsupported Xpath for column %s"; break; diff --git a/storage/connect/english.msg b/storage/connect/english.msg new file mode 100644 index 00000000000..9f445ca6000 --- /dev/null +++ b/storage/connect/english.msg @@ -0,0 +1,366 @@ + 100 IDS_TABLES "Table Headers" + 101 IDS_TAB_01 "Table_Cat" + 102 IDS_TAB_02 "Table_Schema" + 103 IDS_TAB_03 "Table_Name" + 104 IDS_TAB_04 "Table_Type" + 105 IDS_TAB_05 "Remark" + 106 IDS_COLUMNS "Column Headers" + 107 IDS_COL_01 "Table_Cat" + 108 IDS_COL_02 "Table_Schema" + 109 IDS_COL_03 "Table_Name" + 110 IDS_COL_04 "Column_Name" + 111 IDS_COL_05 "Data_Type" + 112 IDS_COL_06 "Type_Name" + 113 IDS_COL_07 "Column_Size" + 114 IDS_COL_08 "Buffer_Length" + 115 IDS_COL_09 "Decimal_Digits" + 116 IDS_COL_10 "Radix" + 117 IDS_COL_11 "Nullable" + 118 IDS_COL_12 "Remarks" + 119 IDS_PKEY "Key Headers" + 120 IDS_PKY_01 "Table_Catalog" + 121 IDS_PKY_02 "Table_Schema" + 122 IDS_PKY_03 "Table_Name" + 123 IDS_PKY_04 "Column_Name" + 124 IDS_PKY_05 "Key_Seq" + 125 IDS_PKY_06 "Pk_Name" + 126 IDS_STAT "Stat Headers" + 127 IDS_STA_01 "Table_Catalog" + 128 IDS_STA_02 "Table_Schema" + 129 IDS_STA_03 "Table_Name" + 130 IDS_STA_04 "Non_Unique" + 131 IDS_STA_05 "Index_Qualifier" + 132 IDS_STA_06 "Index_Name" + 133 IDS_STA_07 "Type" + 134 IDS_STA_08 "Seq_in_Index" + 135 IDS_STA_09 "Column_Name" + 136 IDS_STA_10 "Collation" + 137 IDS_STA_11 "Cardinality" + 138 IDS_STA_12 "Pages" + 139 IDS_STA_13 "Filter_Condition" + 140 IDS_DRIVER "Driver Headers" + 141 IDS_DRV_01 "Description" + 142 IDS_DRV_02 "Attributes" + 143 IDS_DSRC "DataSrc Headers" + 144 IDS_DSC_01 "Name" + 145 IDS_DSC_02 "Description" + 200 ACCESS_VIOLATN "Access violation" + 201 ADD_BAD_TYPE "Array add value type mismatch (%s -> %s)" + 202 ALLOC_ERROR "Error allocating %s" + 203 ANSWER_TYPE "Answer of type" + 204 API_CONF_ERROR "SQL Error: API_CONFORMANCE" + 205 APPL_NOT_INIT "Application not initialized" + 206 ARRAY_BNDS_EXCD "Array bounds exceeded" + 207 BAD_ARRAY_OPER "Arrays must be used with the IN operator" + 208 BAD_ARRAY_TYPE "Illegal array type %d" + 209 BAD_ARRAY_VAL "Arrays must have the same number of values" + 210 BAD_BIN_FMT "Invalid format %c for the %s BIN column" + 211 BAD_BLK_ESTIM "Number of blocks exceeds estimate" + 212 BAD_BLK_SIZE "No match in block %d size" + 213 BAD_BYTE_NUM "bad number of bytes written" + 214 BAD_BYTE_READ "bad number of bytes read" + 215 BAD_COL_TYPE "Invalid type %s for column %s" + 216 BAD_COL_XPATH "Invalid Xpath in column %s for HTML table %s" + 217 BAD_CONST_TYPE "Bad constant type=%d" + 218 BAD_CONV_TYPE "Invalid convert type %d" + 219 BAD_DATETIME "Invalid datetime value" + 220 BAD_DBF_FILE "DBF file %s is corrupted" + 221 BAD_DBF_REC "DBF file %s corrupted at record %d" + 222 BAD_DBF_TYPE "Unsupported DBF type %c for column %s" + 223 BAD_DIRECTORY "Bad directory %s: %s" + 224 BAD_FIELD_RANK "Invalid field rank %d for column %s" + 225 BAD_FIELD_TYPE "Bad type field %s" + 226 BAD_FILE_HANDLE "Invalid File Handle: %s" + 227 BAD_FILTER "Bad filter: Opc=%d B_T=%d %d Type=%d %d" + 228 BAD_FILTER_CONV "Bad filter conversion, B_T=%d,%d" + 229 BAD_FILTER_OP "Invalid filter operator %d" + 230 BAD_FLD_FORMAT "Bad format for field %d of %s" + 231 BAD_FLD_LENGTH "Field %s too long (%s --> %d) line %d of %s" + 232 BAD_FREQ_SET "Bad frequency setting for column %s" + 233 BAD_FUNC_MODE "%s: invalid mode %d" + 234 BAD_HANDLE_VAL "Invalid handle value" + 235 BAD_HEADER "File %s: Header corrupted" + 236 BAD_HEAD_END "Can't read end of header" + 237 BAD_INDEX_FILE "Wrong index file %s" + 238 BAD_LINEFLD_FMT "Bad format line %d field %d of %s" + 239 BAD_LINE_LEN "Line length not equal to Lrecl" + 240 BAD_LRECL "Table/File lrecl mismatch (%d,%hd)" + 241 BAD_NODE_TYPE "Bad type %d for table node" + 242 BAD_OFFSET_VAL "Invalid null offset value for a CSV table" + 243 BAD_OPEN_MODE "Invalid open mode %d" + 244 BAD_PARAM_TYPE "%.8s: Bad parameter type=%d" + 245 BAD_PARM_COUNT "Parameter count mismatch" + 246 BAD_QUOTE_FIELD "Missing ending quote in %s field %d line %d" + 247 BAD_READ_NUMBER "Wrong number %d of values read from %s" + 248 BAD_RECFM "Invalid recfm type %d for DOSCOL" + 249 BAD_RECFM_VAL "Bad Recfm value %d" + 250 BAD_SET_CASE "Cannot set sensitive an insensitive array" + 251 BAD_SET_STRING "Invalid SetValue from string" + 252 BAD_SPECIAL_COL "Bad special column %s" + 253 BAD_SPEC_COLUMN "Special column invalid for this table type" + 254 BAD_TABLE_TYPE "Bad type %s for table %s" + 255 BAD_TYPE_LIKE "Bad operand(%d) type=%d for LIKE" + 256 BAD_VALBLK_INDX "Out of range valblock index value" + 257 BAD_VALBLK_TYPE "Invalid value block type %d" + 258 BAD_VALNODE "Bad type %d for column %s value node" + 259 BAD_VALUE_TYPE "Invalid value type %d" + 260 BAD_VAL_UPDATE "Don't know which %s value to update" + 261 BAS_NS_LIST "Invalid namespaces list format" + 262 BIN_F_TOO_LONG "Value too long for field %s (%d --> %d)" + 263 BIN_MODE_FAIL "Set binary mode failed: %s" + 264 BLKTYPLEN_MISM "Non matching block types/lengths in SetValue" + 265 BLK_IS_NULL "Blk is NULL" + 266 BREAKPOINT "Breakpoint" + 267 BUILD_INDEX "Building index %s on %s" + 268 CANNOT_OPEN "Cannot open %s" + 269 CHSIZE_ERROR "chsize error: %s" + 270 COL_ALLOC_ERR "Cannot allocate column node" + 271 COL_ISNOT_TABLE "Column %s is not in table %s" + 272 COL_NOT_SORTED "Column %s of table %s is not sorted" + 273 COL_NUM_MISM "Number of columns mismatch" + 274 COM_ERROR "Com error" + 275 CONCAT_SUBNODE "Cannot concatenate sub-nodes" + 276 CONNECT_CANCEL "Connection cancelled by user" + 277 CONTROL_C_EXIT "Control C exit" + 278 DATABASE_LOADED "Database %s loaded" + 279 DATA_MISALIGN "Datatype misalignment" + 280 DBASE_FILE "dBASE dbf file: " + 281 DEF_ALLOC_ERROR "Error allocating %s DEF class" + 282 DEL_FILE_ERR "Error deleting %s" + 283 DEL_READ_ERROR "Delete: read error req=%d len=%d" + 284 DEL_WRITE_ERROR "Delete: write error: %s" + 285 DEPREC_FLAG "Deprecated option Flag, use Coltype" + 286 DLL_LOAD_ERROR "Error %d loading module %s" + 287 DOM_NOT_SUPP "MS-DOM not supported by this version" + 288 DVAL_NOTIN_LIST "Value %s not found in distinct values list of column %s" + 289 EMPTY_DOC "Empty document" + 290 EMPTY_FILE "%s empty file %s: " + 291 EOF_AFTER_LINE "EOF after line %d" + 292 EOF_INDEX_FILE "EOF while reading index file" + 293 ERROR_IN_LSK "Error %d in lseek64" + 294 ERROR_IN_SFP "Error %d in SetFilePointer" + 295 ERR_READING_REC "Error reading record %d of %s" + 296 FAIL_ADD_NODE "Failed to add %s table node" + 297 FETCH_NO_RES "Fetch: No Result Set" + 298 FIELD_TOO_LONG "Value too long for field %d line %d" + 299 FILELEN_ERROR "Error in %s for %s" + 300 FILE_IS_EMPTY "File %s is empty" + 301 FILE_MAP_ERR "File mapping error" + 302 FILE_MAP_ERROR "CreateFileMapping %s error rc=%d" + 303 FILE_OPEN_YET "File %s already open" + 304 FILE_UNFOUND "File %s not found" + 305 FLD_TOO_LNG_FOR "Field %d too long for %s line %d of %s" + 306 FLT_BAD_RESULT "Float inexact result" + 307 FLT_DENORMAL_OP "Float denormal operand" + 308 FLT_INVALID_OP "Float invalid operation" + 309 FLT_OVERFLOW "Float overflow" + 310 FLT_STACK_CHECK "Float stack check" + 311 FLT_UNDERFLOW "Float underflow" + 312 FLT_ZERO_DIVIDE "Float divide by zero" + 313 FMT_WRITE_NIY "Writing %s files is not implemented yet" + 314 FOXPRO_FILE "FoxPro file: " + 315 FPUTS_ERROR "fputs error: %s" + 316 FSEEK_ERROR "fseek error: %s" + 317 FSETPOS_ERROR "fseek error for i=%d" + 318 FTELL_ERROR "ftell error for recd=%d: %s" + 319 FUNCTION_ERROR "%s error: %d" + 320 FUNC_ERRNO "Error %d in %s" + 321 FUNC_ERROR "Error in %s" + 322 FUNC_ERR_S "%s error: %s" + 323 FWRITE_ERROR "fwrite error: %s" + 324 GET_DIST_VALS "Retrieving distinct values from " + 325 GET_FUNC_ERR "Error getting function %s: %s" + 326 GLOBAL_ERROR "Cannot allocate Global (size=%d)\n" + 327 GUARD_PAGE "Guard page violation" + 328 GZOPEN_ERROR "gzopen %s error %d on %s" + 329 ILLEGAL_INSTR "Illegal instruction" + 330 ILL_FILTER_CONV "Filtering implies an illegal conversion" + 331 INDEX_NOT_UNIQ "Index is not unique" + 332 INDEX_YET_ON "Index %s already exists on %s" + 333 INDX_COL_NOTIN "Index column %s is not in table %s" + 334 INDX_EXIST_YET "Index entry already exists" + 335 INIT_FAILED "Failed to initialize %s processing" + 336 INT_COL_ERROR "Internal error for index column %s" + 337 INT_OVERFLOW "Integer overflow" + 338 INT_ZERO_DIVIDE "Integer divide by zero" + 339 INVALID_DISP "Invalid disposition" + 340 INVALID_FTYPE "SBV: invalid Ftype %d" + 341 INVALID_HANDLE "Invalid handle" + 342 INVALID_OPER "Invalid operator %d for %s" + 343 INV_COLUMN_TYPE "Invalid type %d for column %s" + 344 INV_COL_TYPE "Invalid column type %s" + 345 INV_DEF_READ "Invalid deferred Read rc=%d" + 346 INV_DIRCOL_OFST "Invalid DIRCOL offset %d" + 347 INV_MAP_POS "Invalid map position" + 348 INV_RAND_ACC "Invalid random access to non optimized table" + 349 INV_REC_POS "Invalid record position" + 350 INV_RESULT_TYPE "Invalid result type %s" + 351 INV_UPDT_TABLE "Table %s invalid for update" + 352 IN_WITHOUT_SUB "IN or EXISTS without array or subquery" + 353 KEY_ALLOC_ERR "Error allocating Key offset block" + 354 KEY_ALLOC_ERROR "Memory allocation error, Klen=%d n=%d" + 355 LINE_TOO_LONG "New line is too long" + 356 LIST "--List--" + 357 LOADING_FAILED "Loading of %s failed" + 358 LRECL_TOO_SMALL "Lrecl too small (headlen = %d)" + 359 MAKE_EMPTY_FILE "Making empty file %s: %s" + 360 MAKING "Making" + 361 MALLOC_ERROR "Memory allocation failed: %s returned Null" + 362 MAP_VIEW_ERROR "MapViewOfFile %s error rc=%d" + 363 MAXSIZE_ERROR "Cannot calculate max size on open table" + 364 MEM_ALLOC_ERR "Memory allocation error, %s size=%d" + 365 MEM_ALLOC_ERROR "Memory allocation error" + 366 MISPLACED_QUOTE "Misplaced quote in line %d" + 367 MISSING_ARG "Missing argument for operator %d" + 368 MISSING_FIELD "Missing field %d in %s line %d" + 369 MISSING_FNAME "Missing file name" + 370 MISSING_NODE "Missing %s node in %s" + 371 MISSING_ROWNODE "Can't find RowNode for row %d" + 372 MIS_TAG_LIST "Missing column tag list" + 373 MUL_MAKECOL_ERR "Tabmul MakeCol logical error" + 374 NAME_CONV_ERR "Error converting node name" + 375 NEW_DOC_FAILED "Cannot create new document" + 376 NEW_RETURN_NULL "New returned Null in PlugEvalLike" + 377 NEXT_FILE_ERROR "Couldn't find next file. rc=%d" + 378 NONCONT_EXCEPT "Noncontinuable exception" + 379 NOP_ZLIB_INDEX "Cannot do indexing on non optimized zlib table" + 380 NOT_A_DBF_FILE "Not a dBASE dbf file " + 381 NOT_FIXED_LEN "File %s is not fixed length, len=%d lrecl=%d" + 382 NO_0DH_HEAD "No 0Dh at end of header (dbc=%d)" + 383 NO_ACTIVE_DB "No active database" + 384 NO_CHAR_FROM "Cannot return char value from type %d" + 385 NO_DATE_FMT "No date format for valblock of type %d" + 386 NO_DEF_FNCCOL "Cannot find default function column" + 387 NO_DEF_PIVOTCOL "Cannot find default pivot column" + 388 NO_DIR_INDX_RD "No direct access of %s tables" + 389 NO_FEAT_SUPPORT "No %s support in this version" + 390 NO_FLD_FORMAT "Missing format for field %d of %s" + 391 NO_FORMAT_COL "Cannot format the type COLUMN" + 392 NO_FORMAT_TYPE "Cannot set format from type %d" + 393 NO_INDEX_READ "No indexed read for multiple tables" + 394 NO_KEY_COL "No key columns found" + 395 NO_KEY_UPDATE "Cannot update key names" + 396 NO_MAP_INSERT "MAP incompatible with Insert" + 397 NO_MATCHING_COL "No matching column %s in %s" + 398 NO_MATCH_COL "Cannot find matching column" + 399 NO_MEMORY "No memory" + 400 NO_MODE_PADDED "Mode not supported for padded files" + 401 NO_MUL_VCT "VCT tables cannot be multiple" + 402 NO_ODBC_DELETE "Delete should not be called for ODBC tables" + 403 NO_ODBC_DIRECT "Direct access of ODBC tables not implemented yet" + 404 NO_ODBC_MUL "Multiple(2) not supported for ODBC tables" + 405 NO_ODBC_SPECOL "No ODBC special columns" + 406 NO_PART_DEL "No partial delete of %s files" + 407 NO_PART_MAP "Partial mapping not implemented for this OS" + 408 NO_PAR_BLK_INS "Cannot insert partial block yet" + 409 NO_PIV_DIR_ACC "No direct access to PIVOT tables" + 410 NO_READ_32 "Can't read 32 bytes" + 411 NO_RECOV_SPACE "Cannot recover space in index file" + 412 NO_ROWID_FOR_AM "Can't get RowID in direct access for tables of type %s" + 413 NO_ROW_NODE "Row node name is not defined" + 414 NO_SECTION_NAME "Missing section name" + 415 NO_SEC_UPDATE "Cannot update section names" + 416 NO_SETPOS_YET "%s SetPos not implemented yet" + 417 NO_SPEC_COL "No MySQL special columns" + 418 NO_SUB_VAL "No sub value for array of type %d" + 419 NO_TABCOL_DATA "No data found for table %s column %s" + 420 NO_TABLE_DEL "Delete not enabled for %s tables " + 421 NO_TAB_DATA "No data found for table %s" + 422 NO_VCT_DELETE "Partial delete not yet implemented for VCT files" + 423 NO_ZIP_DELETE "Delete Zip files not implemented yet" + 424 OPENING "Opening" + 425 OPEN_EMPTY_FILE "Opening empty file %s: %s" + 426 OPEN_ERROR "Open error %d in mode %d on %s: " + 427 OPEN_ERROR_IS "Open error on %s: %s" + 428 OPEN_MODE_ERROR "Open(%s) error %d on %s" + 429 OPEN_STRERROR "open error: %s" + 430 OPTBLK_RD_ERR "Error reading opt block values: %s" + 431 OPTBLK_WR_ERR "Error writing opt block values: %s" + 432 OPTIMIZING "Optimizing " + 433 OPT_BMAP_RD_ERR "Error reading opt bitmaps: %s" + 434 OPT_BMAP_WR_ERR "Error writing opt bitmaps: %s" + 435 OPT_CANCELLED "Optimize cancelled by User" + 436 OPT_DVAL_RD_ERR "Error reading distinct values: %s" + 437 OPT_DVAL_WR_ERR "Error writing distinct values: %s" + 438 OPT_HEAD_RD_ERR "Error reading opt file header: %s" + 439 OPT_HEAD_WR_ERR "Error writing opt file header: %s" + 440 OPT_LOGIC_ERR "Logical error in SetBitmap, i=%d" + 441 OPT_MAX_RD_ERR "Error reading opt max values: %s" + 442 OPT_MAX_WR_ERR "Error writing opt max values: %s" + 443 OPT_MIN_RD_ERR "Error reading opt min values: %s" + 444 OPT_MIN_WR_ERR "Error writing opt min values: %s" + 445 OPT_NOT_MATCH "Non-matching opt file %s" + 446 PAGE_ERROR "In page error" + 447 PARM_CNT_MISS "Parameter count mismatch" + 448 PREC_VBLP_NULL "ARRAY SetPrecision: Vblp is NULL" + 449 PRIV_INSTR "Privileged instruction" + 450 PROCADD_ERROR "Error %d getting address of %s" + 451 QUERY_CANCELLED "Query Cancelled by User" + 452 RANGE_NO_JOIN "Range is not meant for join index" + 453 RC_READING "rc=%d reading table %s" + 454 READY "Ready" + 455 READ_ERROR "Error reading %s: %s" + 456 READ_ONLY "Cannot modify this read/only protected table" + 457 READ_SEEK_ERROR "Read seek error: %s" + 458 REGISTER_ERR "Unable to register NS with prefix='%s' and href='%s'" + 459 REMOVE_ERROR "Error removing %s: %s" + 460 RENAME_ERROR "Error renaming %s to %s: %s" + 461 ROWID_NOT_IMPL "RowNumber not implemented for tables of type %s" + 462 SEC_KEY_FIRST "Section and key names must come first on Insert" + 463 SEC_NAME_FIRST "Section name must come first on Insert" + 464 SEP_IN_FIELD "Field %d contains the separator character" + 465 SEQUENCE_ERROR "Sequence error on statement allocation" + 466 SETEOF_ERROR "Error %d in SetEndOfFile" + 467 SETRECPOS_NIY "SetRecpos not implemented for this table type" + 468 SET_STR_TRUNC "SetValue: String would be truncated" + 469 SFP_ERROR "SetFilePointer error: %s" + 470 SHARED_LIB_ERR "Error loading shared library %s: %s" + 471 SINGLE_STEP "Single step" + 472 SORTING_VAL "Sorting %d values" + 473 SPCOL_READONLY "Special column %s is Read Only" + 474 SQL_CONF_ERROR "SQL Error: SQL_CONFORMANCE" + 475 SRCH_CLOSE_ERR "Couldn't close search handle" + 476 SRC_TABLE_UNDEF "Source table is not defined" + 477 STACK_OVERFLOW "Stack overflow" + 478 TABDIR_READONLY "DIR tables are read/only" + 479 TABLE_NOT_OPT "Not an optimizable table" + 480 TABLE_NO_INDEX "Table %s is not indexable" + 481 TABLE_READ_ONLY "%s tables are read only " + 482 TABMUL_READONLY "Multiple tables are read/only" + 483 TOO_MANY_FIELDS "Too many fields line %d of %s" + 484 TOO_MANY_JUMPS "Too many jump levels" + 485 TOO_MANY_KEYS "Too many keys (%d)" + 486 TO_BLK_IS_NULL "To Blk is NULL" + 487 TRUNCATE_ERROR "truncate error: %s" + 488 TRUNC_BY_ESTIM "truncated by Estimate" + 489 TYPE_MISMATCH "Key and source are not of the same type" + 490 TYPE_VALUE_ERR "Column %s type(%s)/value(%s) mismatch" + 491 UNBALANCE_QUOTE "Unbalanced quote in line %d" + 492 UNDEFINED_AM "COLBLK %s: undefined Access Method" + 493 UNKNOWN_EXCPT "Unknown exception" + 494 UNMATCH_FIL_ARG "Unmatched filter argument" + 495 UPDATE_ERROR "Error updating %s" + 496 UPD_ZIP_NOT_IMP "Updating ZDOS tables not implemented yet" + 497 VALSTR_TOO_LONG "Value %s too long for string of length %d" + 498 VALTYPE_NOMATCH "Non matching Value types" + 499 VALUE_ERROR "Column %s: value is null" + 500 VALUE_TOO_BIG "Value %lld too big for column %s" + 501 VALUE_TOO_LONG "Value %s too long for column %s of length %d" + 502 VAL_ALLOC_ERR "Cannot allocate value node" + 503 VIR_NO_DELETE "Delete not allowed for %s tables" + 504 VIR_READ_ONLY "Virtual %s tables are read only" + 505 VOID_FIRST_ARG "First argument should not be void" + 506 WORK_AREA "Work area: %s" + 507 WRITE_SEEK_ERR "Write seek error: %s" + 508 WRITE_STRERROR "Error writing %s: %s" + 509 WRITING "Writing" + 510 WRITING_ERROR "Error writing to %s: %s" + 511 WS_CONV_ERR "Error converting %s to WS" + 512 XCOL_MISMATCH "Column %s mismatch in index" + 513 XFILE_READERR "Error %d reading index file" + 514 XFILE_WRITERR "Error writing index file: %s" + 515 XMLTAB_INIT_ERR "Error initializing XML table" + 516 XML_INIT_ERROR "Error initializing new XML file" + 517 XPATH_CNTX_ERR "Unable to create new XPath context" + 518 XPATH_EVAL_ERR "Unable to evaluate xpath location '%s'" + 519 XPATH_NOT_SUPP "Unsupported Xpath for column %s" diff --git a/storage/connect/engmsg.h b/storage/connect/engmsg.h index ccced92261e..ad6dc6b5689 100644 --- a/storage/connect/engmsg.h +++ b/storage/connect/engmsg.h @@ -1,54 +1,10 @@ #define MSG_ACCESS_VIOLATN "Access violation" -#define MSG_ACT_ALLOC_FAIL "PlugInitLang: Activity allocation failed" -#define MSG_ADDVAL_ERROR "Error %d in AddValue" #define MSG_ADD_BAD_TYPE "Array add value type mismatch (%s -> %s)" -#define MSG_ADD_NULL_DOM "Adding string %s to a null domain" -#define MSG_ADPOS_IN_DICTP "ADPOS to work in User_Dictp" -#define MSG_AFTER " after: " -#define MSG_ALG_CHOICE_AUTO "Best algorithm choice is automatic" -#define MSG_ALG_CHOICE_BAD "Bad algorithm choice value, reset to AUTO" -#define MSG_ALG_CHOICE_QRY "Using Query algorithm" -#define MSG_ALG_CURLY_BRK "Algorithm choice depends on outer curly brackets" #define MSG_ALLOC_ERROR "Error allocating %s" -#define MSG_ALL_DELETED "All lines deleted in %.2lf sec" -#define MSG_ALTER_DB_ERR "Cannot find the DB to alter" -#define MSG_AMBIG_COL_QUAL "Ambiguous qualifier %s for column %s" -#define MSG_AMBIG_CORREL "Select %s.* refers more than one table" -#define MSG_AMBIG_SPEC_COL "Ambiguous special column %s" #define MSG_ANSWER_TYPE "Answer of type" #define MSG_API_CONF_ERROR "SQL Error: API_CONFORMANCE" -#define MSG_APPL_ACCESSIBLE "Application %s accessible" -#define MSG_APPL_ACTIVE "Application %s still active" -#define MSG_APPL_BAD_SAVE "Application %s may be incorrectly saved" -#define MSG_APPL_CREATED "Application %s created" -#define MSG_APPL_IS_ACTIVE "Application already active" #define MSG_APPL_NOT_INIT "Application not initialized" -#define MSG_APPL_NOT_LOADED "Application not loaded" -#define MSG_APPL_QUIT "Application %s quit" -#define MSG_APPL_SAVED "Application %s saved" -#define MSG_APP_STILL_ACTIV "Application of language %s still active (not freed)" -#define MSG_AREAFILE_NOTFND "Area file not found" -#define MSG_ARGS_SYNTAX_ERR "?SetArgs syntax error: unexpected %s after %s" -#define MSG_ARG_ALREADY_SET "Argument %d already set" -#define MSG_ARG_NOT_AN_ATTR "Argument is not an attribute (wrong pos-type %d)" -#define MSG_ARG_OUT_CONTEXT "@-type argument used out of context" -#define MSG_ARG_OUT_RANGE "Phrase argument of value %d is out of range" -#define MSG_ARG_PTR_NOSEM "Argument of value %d points to a nonterm having no Sem" -#define MSG_ARG_PTR_NOSEMS "Argument of value %d points to a nonterm having no semantics" -#define MSG_ARG_REF_LOOP "?Looping argument cross references" -#define MSG_ARG_TWO_CONST "2nd argument of %s must be a constant" -#define MSG_ARRAY_ALLOC_ERR "Memory allocation error in ARRAY" #define MSG_ARRAY_BNDS_EXCD "Array bounds exceeded" -#define MSG_ARRAY_ERROR "Error while making array k=%d n=%d" -#define MSG_ATTRIBUTE_ERROR "Error rule %u attribute %s: " -#define MSG_ATT_NOT_CASE "Attribute has wrong value %d (not a casevalue)" -#define MSG_ATT_POSCODE_BIG "Attribute poscode %d is too big (max=%d)" -#define MSG_AVGLEN_ERROR "avglen should be between %d and %d" -#define MSG_BAD_AGGREG_FUNC "Unsupported aggregate function %d" -#define MSG_BAD_ARGTYPES "Argument type invalid for %s" -#define MSG_BAD_ARGUMENTS "Argument not attached for %s" -#define MSG_BAD_ARG_NUM "Invalid number of arguments %d" -#define MSG_BAD_ARG_TYPE "Bad argument type %d" #define MSG_BAD_ARRAY_OPER "Arrays must be used with the IN operator" #define MSG_BAD_ARRAY_TYPE "Illegal array type %d" #define MSG_BAD_ARRAY_VAL "Arrays must have the same number of values" @@ -57,321 +13,97 @@ #define MSG_BAD_BLK_SIZE "No match in block %d size" #define MSG_BAD_BYTE_NUM "bad number of bytes written" #define MSG_BAD_BYTE_READ "bad number of bytes read" -#define MSG_BAD_CARDINALITY "Invalid Cardinality call for multiple table" -#define MSG_BAD_CASE_SPEC "Wrong case specification %c, enter new one: " -#define MSG_BAD_CHAR_SPEC "Invalid character specification:'%s'" -#define MSG_BAD_CHECK_TYPE "Invalid CheckColumn subtype %d" -#define MSG_BAD_CHECK_VAL "Bad check setting '%s'" -#define MSG_BAD_COLCRT_ARG "Bad COLCRT argument (type=%hd, domain=%hd)" -#define MSG_BAD_COLDEF_TYPE "Coldefs: wrong type %d" -#define MSG_BAD_COLIST_ITEM "Incorrect colist item" -#define MSG_BAD_COLIST_TYPE "Bad Colist type=%d" -#define MSG_BAD_COLSIZE "Colsize %d is too small for this database" -#define MSG_BAD_COL_ENTRY "Invalid entry for column %s" -#define MSG_BAD_COL_FORMAT "Invalid column format type %d" -#define MSG_BAD_COL_IN_FILT "Incorrect column in filter" -#define MSG_BAD_COL_QUALIF "Bad qualifier %s for column %s" #define MSG_BAD_COL_TYPE "Invalid type %s for column %s" #define MSG_BAD_COL_XPATH "Invalid Xpath in column %s for HTML table %s" -#define MSG_BAD_COMPARE_OP "Bad compare op %d" #define MSG_BAD_CONST_TYPE "Bad constant type=%d" #define MSG_BAD_CONV_TYPE "Invalid convert type %d" -#define MSG_BAD_CORREL "Select %s.* correlation refers no tables" #define MSG_BAD_DATETIME "Invalid datetime value" -#define MSG_BAD_DATE_OPER "Unexpected date operator %d" #define MSG_BAD_DBF_FILE "DBF file %s is corrupted" #define MSG_BAD_DBF_REC "DBF file %s corrupted at record %d" -#define MSG_BAD_DBF_TYPE "Unsupported DBF type %c" -#define MSG_BAD_DEF_ARG "Bad INDEXDEF argument (type=%hd, domain=%hd)" -#define MSG_BAD_DEF_READ "Unexpected EOF in deferred Read" -#define MSG_BAD_DEF_TYPE "Invalid column definition type" +#define MSG_BAD_DBF_TYPE "Unsupported DBF type %c for column %s" #define MSG_BAD_DIRECTORY "Bad directory %s: %s" -#define MSG_BAD_DIST_JN_FIL "Invalid Distinct Join filter" -#define MSG_BAD_DIST_JOIN "Invalid Distinct Join specification" -#define MSG_BAD_DOM_COL_DEF "Invalid column definitions for a domain" -#define MSG_BAD_DOM_VALUE "%d is not a valid domain value" -#define MSG_BAD_EDIT_INIT "Coparm: edition %s not properly initialized" -#define MSG_BAD_EVAL_TYPE "Bad scalar function eval type=%d" -#define MSG_BAD_EXEC_MODE "Bad execution mode '%s'" -#define MSG_BAD_EXP_ARGTYPE "Invalid expression argument type=%d" -#define MSG_BAD_EXP_OPER "Bad expression operator=%d" -#define MSG_BAD_FETCH_RC "Unexpected Fetch return code %d" -#define MSG_BAD_FIELD_FMT "Invalid field format %c for %s" #define MSG_BAD_FIELD_RANK "Invalid field rank %d for column %s" #define MSG_BAD_FIELD_TYPE "Bad type field %s" #define MSG_BAD_FILE_HANDLE "Invalid File Handle: %s" -#define MSG_BAD_FILE_LIST "Bad Filelist section" #define MSG_BAD_FILTER "Bad filter: Opc=%d B_T=%d %d Type=%d %d" #define MSG_BAD_FILTER_CONV "Bad filter conversion, B_T=%d,%d" -#define MSG_BAD_FILTER_LINK "Bad filter link operator %d" #define MSG_BAD_FILTER_OP "Invalid filter operator %d" -#define MSG_BAD_FILTEST_OP "Invalid operator %d %d for FilTest" #define MSG_BAD_FLD_FORMAT "Bad format for field %d of %s" #define MSG_BAD_FLD_LENGTH "Field %s too long (%s --> %d) line %d of %s" -#define MSG_BAD_FLOAT_CONV "Invalid convert of float array" -#define MSG_BAD_FPARM_NEXT "Coparm: FPARM with non-null Next" #define MSG_BAD_FREQ_SET "Bad frequency setting for column %s" -#define MSG_BAD_FUNC_ARG "Funcarg of type %d not implemented" -#define MSG_BAD_FUNC_ARGTYP "Bad Function argument type=%d" #define MSG_BAD_FUNC_MODE "%s: invalid mode %d" -#define MSG_BAD_GENRE "Genre is invalid" -#define MSG_BAD_GETVIEW_RET "GetView: invalid return type %d" #define MSG_BAD_HANDLE_VAL "Invalid handle value" -#define MSG_BAD_HAV_FILTER "Having filter found in a Vanilla query" -#define MSG_BAD_HAV_FILTYPE "Bad filter type for Having Clause" #define MSG_BAD_HEADER "File %s: Header corrupted" -#define MSG_BAD_HEADER_VAL "Invalid header value %d" #define MSG_BAD_HEAD_END "Can't read end of header" -#define MSG_BAD_INDEX_COL "Bad column %s for index %s" -#define MSG_BAD_INDEX_DEF "Bad index definition for %s" #define MSG_BAD_INDEX_FILE "Wrong index file %s" -#define MSG_BAD_INDEX_PART "Bad index part for %s" -#define MSG_BAD_INPUT "Incorrect input" -#define MSG_BAD_IN_ARGTYPE "Bad argument type for IN operator" -#define MSG_BAD_IN_ENDING "Error: wrong end of IN string" -#define MSG_BAD_IN_STRING "IN string begins or ends with invalid char %c ... %c" -#define MSG_BAD_JCOL_TYPE "Logical JCT error: Unmatched column types" -#define MSG_BAD_JOIN_EXP "Invalid expression used in join" -#define MSG_BAD_JOIN_FILTER "Improper join filter" -#define MSG_BAD_JOIN_OP "Bad join operator %d" -#define MSG_BAD_LANG_SIZE "Wrong Language file size %d" #define MSG_BAD_LINEFLD_FMT "Bad format line %d field %d of %s" #define MSG_BAD_LINE_LEN "Line length not equal to Lrecl" -#define MSG_BAD_LIST_TYPE "Invalid list type=%d" -#define MSG_BAD_LOCALE "Invalid locale %s" -#define MSG_BAD_LOCDFON_ARG "Bad parameter for LOCDFON" -#define MSG_BAD_LOCNODE_USE "Unexpected use of LOCNODE" #define MSG_BAD_LRECL "Table/File lrecl mismatch (%d,%hd)" -#define MSG_BAD_MAX_HAVING "MAXTMP value too small for Having" -#define MSG_BAD_MAX_NREC "MaxRec=%d doesn't match MaxBlk=%d Nrec=%d" -#define MSG_BAD_MAX_PARAM "Bad parameters for setting max value" -#define MSG_BAD_MAX_SETTING "Bad max setting '%c'" -#define MSG_BAD_MERGE_TYPE "Type %d cannot be merged" #define MSG_BAD_NODE_TYPE "Bad type %d for table node" #define MSG_BAD_OFFSET_VAL "Invalid null offset value for a CSV table" #define MSG_BAD_OPEN_MODE "Invalid open mode %d" -#define MSG_BAD_OPERATOR "Invalid operator %s" -#define MSG_BAD_ORDER_MODE "Bad ordering mode %c" -#define MSG_BAD_ORDER_TYPE "Type=%d invalid for order item" -#define MSG_BAD_OUTER_JOIN "Invalid outer join on child table" -#define MSG_BAD_PAD_ARGTYP "Bad argument type for Pad or Justify" -#define MSG_BAD_PARAMETERS "%.8s: Bad parameters" #define MSG_BAD_PARAM_TYPE "%.8s: Bad parameter type=%d" #define MSG_BAD_PARM_COUNT "Parameter count mismatch" -#define MSG_BAD_PHASE_NUM "Out of range phrase number %d" -#define MSG_BAD_PHRASE_NB "out of range phrase number %d rc=%d\n" -#define MSG_BAD_POS_CODE "Invalid POS code %d" -#define MSG_BAD_POS_TYPE "Invalid POS code type %d" -#define MSG_BAD_PROJNUM "Bad projnum %d for column %s" -#define MSG_BAD_QUERY_OPEN "Query open invalid mode %d" -#define MSG_BAD_QUERY_TYPE "Invalid query type %d for %s" #define MSG_BAD_QUOTE_FIELD "Missing ending quote in %s field %d line %d" #define MSG_BAD_READ_NUMBER "Wrong number %d of values read from %s" #define MSG_BAD_RECFM "Invalid recfm type %d for DOSCOL" #define MSG_BAD_RECFM_VAL "Bad Recfm value %d" -#define MSG_BAD_RESULT_TYPE "Bad result type %d for %s" -#define MSG_BAD_RETURN_TYPE "Bad returned type %d" -#define MSG_BAD_ROW_VALIST "Invalid ROW list of values" -#define MSG_BAD_ROW_VALNB "Number of values in list mismatch" -#define MSG_BAD_SCF_ARGTYPE "Argument %d type=%s invalid for %s" -#define MSG_BAD_SEM_DOMAIN "Invalid domain .%d" -#define MSG_BAD_SETTINGS "Some settings do not match table type" #define MSG_BAD_SET_CASE "Cannot set sensitive an insensitive array" #define MSG_BAD_SET_STRING "Invalid SetValue from string" -#define MSG_BAD_SET_TYPE "Bad set type %hd" -#define MSG_BAD_SPECIAL_CMD "Ill formed special command" #define MSG_BAD_SPECIAL_COL "Bad special column %s" #define MSG_BAD_SPEC_COLUMN "Special column invalid for this table type" -#define MSG_BAD_SQL_PARAM "Invalid SQL parameter for FindColblk" -#define MSG_BAD_SUBLST_TYPE "Coparm: bad sub-list type %d" -#define MSG_BAD_SUBSEL_IN_X "Bad sub-select in expression" -#define MSG_BAD_SUBSEL_TYPE "Bad Sub-Select returned type %d" -#define MSG_BAD_SUB_RESULT "Undefined Sub-Select function result" -#define MSG_BAD_SUB_SELECT "Bad sub-select in function argument" -#define MSG_BAD_TABLE_LINE "Illegal or truncated line '%s' in Tables section" -#define MSG_BAD_TABLE_LIST "Table %s not found in table list" #define MSG_BAD_TABLE_TYPE "Bad type %s for table %s" -#define MSG_BAD_TEST_TYPE "Array BlockTest type mismatch %s %s" -#define MSG_BAD_TRIM_ARGTYP "Bad argument type for Trim" -#define MSG_BAD_TYPE_FOR_IN "Arg type mismatch for IN function" -#define MSG_BAD_TYPE_FOR_S "Incorrect type %d for %s(%d)" #define MSG_BAD_TYPE_LIKE "Bad operand(%d) type=%d for LIKE" -#define MSG_BAD_UPD_COR "Qualifier %s of column %s not related to the updated table %s" -#define MSG_BAD_USERBLK_LEN "User block write length error" -#define MSG_BAD_USETEMP "Bad usetemp setting '%s'" -#define MSG_BAD_USETEMP_VAL "Bad Usetemp value %d" #define MSG_BAD_VALBLK_INDX "Out of range valblock index value" #define MSG_BAD_VALBLK_TYPE "Invalid value block type %d" #define MSG_BAD_VALNODE "Bad type %d for column %s value node" #define MSG_BAD_VALUE_TYPE "Invalid value type %d" #define MSG_BAD_VAL_UPDATE "Don't know which %s value to update" -#define MSG_BAD_VIEW_OPEN "View open invalid mode %d" -#define MSG_BAD_XMODE_VAL "Bad execution mode %d" -#define MSG_BAD_XOBJ_TYPE "Bad Xobject type %d" #define MSG_BAS_NS_LIST "Invalid namespaces list format" #define MSG_BIN_F_TOO_LONG "Value too long for field %s (%d --> %d)" #define MSG_BIN_MODE_FAIL "Set binary mode failed: %s" #define MSG_BLKTYPLEN_MISM "Non matching block types/lengths in SetValue" #define MSG_BLK_IS_NULL "Blk is NULL" -#define MSG_BLOCK_NO_MATCH "Non matching block" #define MSG_BREAKPOINT "Breakpoint" -#define MSG_BUFF_TOO_SMALL "GetColData: Buffer is too small" -#define MSG_BUFSIZE_ERROR "Error getting screen buffer size" -#define MSG_BUILDING_GROUPS "Building groups" -#define MSG_BUILD_DIST_GRPS "Building groups distinct" #define MSG_BUILD_INDEX "Building index %s on %s" -#define MSG_BXP_NULL "Bxp NULL in PUTFON" #define MSG_CANNOT_OPEN "Cannot open %s" -#define MSG_CD_ONE_STEP "Count Distinct must be processed in one step" -#define MSG_CD_ORDER_ERROR "Ordering error in Count Distinct" -#define MSG_CHECKING_ROWS "Checking rows to update" -#define MSG_CHECK_LEVEL "Checking level reset to %u" #define MSG_CHSIZE_ERROR "chsize error: %s" -#define MSG_CLN_NOT_IN_JOIN "Column C%d not found in join" -#define MSG_CNTDIS_COL_LOST "Count Distinct column lost" -#define MSG_COLIST_BAD_TYPE "Invalid Colist element type=%d" -#define MSG_COLNAM_TOO_LONG "Column name too long" -#define MSG_COLSEC_TOO_BIG "Column section too big in table %s (%d)" -#define MSG_COLS_REDUCED " (reduced by Maxcol)" -#define MSG_COLUMN_ERROR "Column error" -#define MSG_COLUMN_MISMATCH "Column %s mismatch" -#define MSG_COLUMN_NOT_KEY "Join column R%d.%s is not a key" #define MSG_COL_ALLOC_ERR "Cannot allocate column node" -#define MSG_COL_ALLOC_ERROR "Memory allocation error for column %d" -#define MSG_COL_HAS_NO_DEF "Column %s has no definition" -#define MSG_COL_INVAL_TABLE "Column %s.%s not found in table %s alias %s" #define MSG_COL_ISNOT_TABLE "Column %s is not in table %s" -#define MSG_COL_NB_MISM "Number of columns mismatch" -#define MSG_COL_NOTIN_GRPBY "Column %s not in Group By list" -#define MSG_COL_NOTIN_TABLE "Column %s is not in any table" -#define MSG_COL_NOTIN_UPDT "%s does not belong to the updated table %s" -#define MSG_COL_NOT_CODED "Column %s is not coded" -#define MSG_COL_NOT_EXIST "Column %s is not in table %s" -#define MSG_COL_NOT_FOUND "Column %s does not exist in %s" -#define MSG_COL_NOT_IN_DB "Column %s of table %s not in DB" -#define MSG_COL_NOT_IN_JOIN "Column %s not found in join" #define MSG_COL_NOT_SORTED "Column %s of table %s is not sorted" #define MSG_COL_NUM_MISM "Number of columns mismatch" -#define MSG_COL_USED_TWICE "Column %s linked twice ???" -#define MSG_COMPUTE_ERROR "Error in Compute, op=%d" -#define MSG_COMPUTE_NIY "Compute not implemented for token strings" -#define MSG_COMPUTING "Computing" -#define MSG_COMPUTING_DIST "Computing Distinct" -#define MSG_COMPUTING_FUNC "Computing function(s)" #define MSG_COM_ERROR "Com error" #define MSG_CONCAT_SUBNODE "Cannot concatenate sub-nodes" -#define MSG_CONNECTED "Connected" #define MSG_CONNECT_CANCEL "Connection cancelled by user" -#define MSG_CONNECT_ERROR "Error %d connecting to %s" -#define MSG_CONN_CLOSED "%s(%d) closed" -#define MSG_CONN_CREATED "Connection %s created" -#define MSG_CONN_DROPPED "Connection %s dropped" -#define MSG_CONN_OPEN "%s(%d) open (%s)" -#define MSG_CONN_SUC_OPEN "%s(%d) successfully open" #define MSG_CONTROL_C_EXIT "Control C exit" -#define MSG_COPY_BAD_PHASE "List copy invalid in phase %d" -#define MSG_COPY_INV_TYPE "Coparm: type not supported %d" -#define MSG_CORREL_NO_QRY "Correlated subqueries cannot be of QRY type" -#define MSG_CREATED_PLUGDB " Created by PlugDB %s " -#define MSG_CURSOR_SET "Cursor set to %d" -#define MSG_DATABASE_ACTIVE "Database %s activated" #define MSG_DATABASE_LOADED "Database %s loaded" -#define MSG_DATA_IS_NULL "ExecSpecialCmd: data is NULL" #define MSG_DATA_MISALIGN "Datatype misalignment" #define MSG_DBASE_FILE "dBASE dbf file: " -#define MSG_DB_ALREADY_DEF "Database %s already defined" -#define MSG_DB_ALTERED "Database altered" -#define MSG_DB_CREATED "Database %s created" -#define MSG_DB_NOT_SPEC "Database not specified" -#define MSG_DB_REMOVED "Database %s removed from DB list" -#define MSG_DB_SORT_ERROR "Error in DB sort" -#define MSG_DB_STOPPED "Database %s stopped" -#define MSG_DEBUG_NOT_ACTIV "Debug is not active" -#define MSG_DEBUG_SET_INV "Invalid Debug set %c" #define MSG_DEF_ALLOC_ERROR "Error allocating %s DEF class" -#define MSG_DELETING_ROWS "Deleting rows" #define MSG_DEL_FILE_ERR "Error deleting %s" #define MSG_DEL_READ_ERROR "Delete: read error req=%d len=%d" #define MSG_DEL_WRITE_ERROR "Delete: write error: %s" #define MSG_DEPREC_FLAG "Deprecated option Flag, use Coltype" -#define MSG_DICTIONARY "Dictionary " -#define MSG_DIRECT_VARTOK "Direct access of variable token rules not implemented" -#define MSG_DISCONNECTED "Disonnected" -#define MSG_DISTINCT_ERROR "More than one DISTINCT functional item" -#define MSG_DISTINCT_ROWS "Selecting distinct rows" -#define MSG_DISTINCT_VALUES "Retrieving distinct values" -#define MSG_DIS_NOHEAD_JOIN "Distinct join on not heading table" #define MSG_DLL_LOAD_ERROR "Error %d loading module %s" -#define MSG_DOMAIN_EMPTY "Domain %s is empty" -#define MSG_DOMAIN_ERROR "Column %s domain(%s)/value(%s) mismatch" -#define MSG_DOMAIN_FULL "Domain %s is full (max=%d)" -#define MSG_DOM_FILE_ERROR "Domain file %s not found" #define MSG_DOM_NOT_SUPP "MS-DOM not supported by this version" -#define MSG_DOM_OPEN_ERROR "Domain open error: %s" -#define MSG_DOM_READ_ERROR "Domain read error %d: %s" -#define MSG_DOM_READ_ONLY "Domain table %s is read only" -#define MSG_DOM_WRITE_ERROR "Domain write error %d: %s" -#define MSG_DONE "Done, rc=%d" -#define MSG_DOSALMEM_NOMEM "Memory Allocation failed, not enough memory" -#define MSG_DROP_DB_ERR "Drop database %s failed" -#define MSG_DSORT_LOG_ERROR "Logical error in Kindex distinct Sort" -#define MSG_DUMMY_NO_COLS "Dummy tables must have no columns" -#define MSG_DUPLICAT_COUNT "Count on more than one column" -#define MSG_DUP_COL_NAME "Duplicate column name %s" -#define MSG_DUP_PROJNUM "Duplicated projnum %d for column %s" #define MSG_DVAL_NOTIN_LIST "Value %s not found in distinct values list of column %s" #define MSG_EMPTY_DOC "Empty document" #define MSG_EMPTY_FILE "%s empty file %s: " -#define MSG_ENDSTR_MISMATCH "No match between end of string and end of node" -#define MSG_END_OF_DELETE "%d line(s) deleted in %.2lf sec" -#define MSG_END_OF_INSERT "%d line(s) inserted in %.2lf sec" -#define MSG_END_OF_QUERY "%d line(s) retrieved in %.2lf sec" -#define MSG_END_OF_UPDATE "%d line(s) updated in %.2lf sec" #define MSG_EOF_AFTER_LINE "EOF after line %d" #define MSG_EOF_INDEX_FILE "EOF while reading index file" -#define MSG_ERASED " and erased" -#define MSG_ERASE_FAILED " (erase failed)" -#define MSG_ERROR "Error" #define MSG_ERROR_IN_LSK "Error %d in lseek64" #define MSG_ERROR_IN_SFP "Error %d in SetFilePointer" -#define MSG_ERROR_NO_PARM "No parameter (valid only with %.8s.1 and %.8s.5)" -#define MSG_ERROR_OPENING "Error opening: " -#define MSG_ERR_NUM_GT_MAX "Error: Numval (%d) greater than Maxnum (%d)" #define MSG_ERR_READING_REC "Error reading record %d of %s" -#define MSG_ERR_RET_RULE "error return, rule=%u" -#define MSG_ERR_RET_TYPE "error return, type=%d" -#define MSG_EVAL_EXPIRED "Evaluation version expired" -#define MSG_EVAL_ONLY "I agree to use this Dll for evaluation purpose only" -#define MSG_EXECUTING "Executing" -#define MSG_EXECUTION_ERROR "Execution error" -#define MSG_EXEC_MODE_IS "Execution mode is %s" -#define MSG_EXEC_MODE_RESET ". Mode reset to Execute" -#define MSG_EXEC_MODE_SET "Execution mode set to %s" -#define MSG_EXIT_EVAL_ERR "Error evaluating Exit" -#define MSG_EXIT_FROM_LANG "Exit from language %s version %d.%d" #define MSG_FAIL_ADD_NODE "Failed to add %s table node" -#define MSG_FETCHING_DATA "Fetching data" -#define MSG_FETCHING_ROWS "Fetching rows" #define MSG_FETCH_NO_RES "Fetch: No Result Set" #define MSG_FIELD_TOO_LONG "Value too long for field %d line %d" #define MSG_FILELEN_ERROR "Error in %s for %s" -#define MSG_FILE_CLOSE_ERR "Error %d occurred closing the file" #define MSG_FILE_IS_EMPTY "File %s is empty" #define MSG_FILE_MAP_ERR "File mapping error" #define MSG_FILE_MAP_ERROR "CreateFileMapping %s error rc=%d" -#define MSG_FILE_NOT_FOUND "File %s cannot be found" #define MSG_FILE_OPEN_YET "File %s already open" #define MSG_FILE_UNFOUND "File %s not found" -#define MSG_FILGRP_NO_TABLE "Missing table %d for a filter group" -#define MSG_FILTER_ATTACH "Filter passed to Attach" -#define MSG_FILTER_NO_TABLE "Missing first table for a filter" -#define MSG_FIND_BAD_TYPE "Array Find type mismatch %s %s" -#define MSG_FIX_OVFLW_ADD "Fixed Overflow on add" -#define MSG_FIX_OVFLW_TIMES "Fixed Overflow on times" -#define MSG_FIX_UNFLW_ADD "Fixed Underflow on add" -#define MSG_FIX_UNFLW_TIMES "Fixed Underflow on times" #define MSG_FLD_TOO_LNG_FOR "Field %d too long for %s line %d of %s" -#define MSG_FLTST_NO_CORREL "FilTest should be called only for correlated subqueries" #define MSG_FLT_BAD_RESULT "Float inexact result" #define MSG_FLT_DENORMAL_OP "Float denormal operand" #define MSG_FLT_INVALID_OP "Float invalid operation" @@ -380,11 +112,8 @@ #define MSG_FLT_UNDERFLOW "Float underflow" #define MSG_FLT_ZERO_DIVIDE "Float divide by zero" #define MSG_FMT_WRITE_NIY "Writing %s files is not implemented yet" -#define MSG_FNC_NOTIN_SLIST "Order aggregate function not in select list" -#define MSG_FORMAT_ERROR "Formating error" #define MSG_FOXPRO_FILE "FoxPro file: " #define MSG_FPUTS_ERROR "fputs error: %s" -#define MSG_FSBPARP_NULL "PUTFON: fsbparp is NULL" #define MSG_FSEEK_ERROR "fseek error: %s" #define MSG_FSETPOS_ERROR "fseek error for i=%d" #define MSG_FTELL_ERROR "ftell error for recd=%d: %s" @@ -392,360 +121,113 @@ #define MSG_FUNC_ERRNO "Error %d in %s" #define MSG_FUNC_ERROR "Error in %s" #define MSG_FUNC_ERR_S "%s error: %s" -#define MSG_FUNC_REF_DEL "Reference to a defined function (rule %d) which has been deleted" #define MSG_FWRITE_ERROR "fwrite error: %s" -#define MSG_GETCWD_ERR_NO "?getcwd %s errno=%d" -#define MSG_GETFILESIZE_ERR "Error %d in GetFileSize" #define MSG_GET_DIST_VALS "Retrieving distinct values from " -#define MSG_GET_ERROR "Error in %s (column %d)" #define MSG_GET_FUNC_ERR "Error getting function %s: %s" -#define MSG_GET_NAME_ERR "Error getting SYS table names" #define MSG_GLOBAL_ERROR "Cannot allocate Global (size=%d)\n" -#define MSG_GRAM_ALLOC_ERR "Allocation error in Grammar Up" -#define MSG_GRAM_MISMATCH "Warning: GRAMMAR version mismatch (saved under GRAMMAR v%u)" -#define MSG_GRAM_SUBSET_ERR "Grammar dictionary Subset error" -#define MSG_GRBY_TAB_NOTIMP "Group by filtered joined table not implemented" -#define MSG_GROUPBY_NOT_ALL "Group By must include all non-functional select items" -#define MSG_GROUP_ON_FUNC "Invalid group by on functional column" -#define MSG_GRP_COL_MISM "Column mismatch in groups" -#define MSG_GRP_LIST_MISMAT "Grouping does not match select list" #define MSG_GUARD_PAGE "Guard page violation" #define MSG_GZOPEN_ERROR "gzopen %s error %d on %s" -#define MSG_GZPUTS_ERROR "gzputs error: %s" -#define MSG_HANDLE_IS_NULL "%s is NULL: last error: %d" -#define MSG_HARRY_COMP_NIY "Compute not implemented for coded strings" -#define MSG_HAVING_FILTER "Filtering by Having" -#define MSG_HBUF_TOO_SMALL "Buffer(%d) too small for header(%d)" -#define MSG_HEAD_OPEN_ERROR "Error opening header file %s" -#define MSG_HEAD_READ_ERROR "Error reading header file %s" -#define MSG_HEAD_WRITE_ERR "Error writing header file %s" -#define MSG_HI_OFFSET_ERR "High offet is not 0" -#define MSG_HUGE_DEFAULT "Huge defaults to %d" -#define MSG_HUGE_WARNING_1 "Huge memory not 16-bit compatible for %d\n" -#define MSG_HUGE_WARNING_2 "Unpredictable results may occur\n" -#define MSG_IDLE "Idle" #define MSG_ILLEGAL_INSTR "Illegal instruction" #define MSG_ILL_FILTER_CONV "Filtering implies an illegal conversion" -#define MSG_INDEX_CREATED "Index %s created on %s" -#define MSG_INDEX_DEF_ERR "Error storing index definition for %s" -#define MSG_INDEX_DROPPED "Index %s dropped from %s" -#define MSG_INDEX_INIT_ERR "Cannot initialize index %s" -#define MSG_INDEX_NOT_DEF "Index %s has no definition" #define MSG_INDEX_NOT_UNIQ "Index is not unique" -#define MSG_INDEX_ONE_SAVE "Indexes are saved in one unique file" -#define MSG_INDEX_SEP_SAVE "Indexes are saved in separate files" #define MSG_INDEX_YET_ON "Index %s already exists on %s" -#define MSG_INDX_ALL_DROP "All indexes dropped from %s" #define MSG_INDX_COL_NOTIN "Index column %s is not in table %s" #define MSG_INDX_EXIST_YET "Index entry already exists" -#define MSG_INIT_ERROR "Error initializing %s" #define MSG_INIT_FAILED "Failed to initialize %s processing" -#define MSG_INPUT "Input: " -#define MSG_INPUT_KEYBD_YET "Input already from keyboard" -#define MSG_INSERTING "Inserting: " -#define MSG_INSERT_ERROR "Insert error: file %s in use" -#define MSG_INSERT_MISMATCH "Column/Value list mismatch" -#define MSG_INTERNAL "internal" #define MSG_INT_COL_ERROR "Internal error for index column %s" #define MSG_INT_OVERFLOW "Integer overflow" #define MSG_INT_ZERO_DIVIDE "Integer divide by zero" -#define MSG_INVALID_BIP "Invalid Bip .%d" #define MSG_INVALID_DISP "Invalid disposition" #define MSG_INVALID_FTYPE "SBV: invalid Ftype %d" #define MSG_INVALID_HANDLE "Invalid handle" #define MSG_INVALID_OPER "Invalid operator %d for %s" -#define MSG_INVALID_OPTION "Invalid option %s" #define MSG_INV_COLUMN_TYPE "Invalid type %d for column %s" -#define MSG_INV_COL_DATATYP "Invalid Data Type %d for column %d" -#define MSG_INV_COL_NUM "Invalid column %d" #define MSG_INV_COL_TYPE "Invalid column type %s" -#define MSG_INV_CONC_BIP "Invalid bip (only valid are : %.8s.0 .1 and .5)" -#define MSG_INV_DATA_PATH "Invalid database path %s" #define MSG_INV_DEF_READ "Invalid deferred Read rc=%d" #define MSG_INV_DIRCOL_OFST "Invalid DIRCOL offset %d" -#define MSG_INV_DOMAIN_TYPE "Invalid type %d" -#define MSG_INV_FILTER "Filter met in %s" -#define MSG_INV_FNC_BUFTYPE "FNC: invalid argument type %d for %s" -#define MSG_INV_INFO_TYPE "Invalid catalog info type %d" -#define MSG_INV_INIPATH "Invalid inipath " #define MSG_INV_MAP_POS "Invalid map position" -#define MSG_INV_OPERATOR "invalid operator %d\n" -#define MSG_INV_PARAMETER "Invalid parameter %s" -#define MSG_INV_PARM_TYPE "Invalid parameter type" -#define MSG_INV_QUALIFIER "Invalid qualifier '%s'" -#define MSG_INV_QUERY_TYPE "Invalid query type %d" #define MSG_INV_RAND_ACC "Invalid random access to non optimized table" #define MSG_INV_REC_POS "Invalid record position" #define MSG_INV_RESULT_TYPE "Invalid result type %s" -#define MSG_INV_SET_SUBTYPE "Invalid SetFormat subtype %d" -#define MSG_INV_SPECIAL_CMD "%s: Invalid special command" -#define MSG_INV_SUBTYPE "Invalid subtype %s" -#define MSG_INV_TOK_DOMAIN "Invalid token domain %s" -#define MSG_INV_TOPSEM_CMD "Invalid TopSem command %c" -#define MSG_INV_TRANSF_USE "Invalid use in transformation rule" -#define MSG_INV_TYPE_SPEC "Invalid type specification (%.8s.%d)" #define MSG_INV_UPDT_TABLE "Table %s invalid for update" -#define MSG_INV_VALUE_LIST "Invalid Insert value list" -#define MSG_INV_WHERE_JOIN "Invalid where clause in join query" -#define MSG_INV_WORK_PATH "Invalid work path %s" -#define MSG_IN_ARGTYPE_MISM "Argument type mismatch for IN expression" -#define MSG_IN_USE " and in use" #define MSG_IN_WITHOUT_SUB "IN or EXISTS without array or subquery" -#define MSG_IS_NOT_CONN "%s is not a connection definition" -#define MSG_JCT_MISS_COLS "Missing columns for a JCT table" -#define MSG_JCT_MISS_TABLE "Missing joined table for JCT" -#define MSG_JCT_NO_FILTER "Virtual JCT tables cannot be filtered" -#define MSG_JCT_NO_KEY "Logical JCT error: no key" -#define MSG_JOIN_KEY_NO_COL "Join key is not a column" #define MSG_KEY_ALLOC_ERR "Error allocating Key offset block" #define MSG_KEY_ALLOC_ERROR "Memory allocation error, Klen=%d n=%d" -#define MSG_LANGUAGE_QUIT "%s quit" -#define MSG_LANG_ACTIVE "Language %s active" -#define MSG_LANG_ALLOC_FAIL "PlugInitLang: Lang block allocation failed" -#define MSG_LANG_ALREADY_UP "Edited language is already there" -#define MSG_LANG_BAD_SAVE "Language %s may be incorrectly saved" -#define MSG_LANG_NOT_FREED "Language %s cannot be freed (not in main chain)" -#define MSG_LANG_SAVED "Language %s saved" -#define MSG_LANG_WR_LEN_ERR "Lang block write length error" -#define MSG_LDF_ALLOC_ERROR "LdfBlock allocation error" -#define MSG_LDF_RN_MISMATCH "LDF rule number mismatch" -#define MSG_LDF_WLEN_ERROR "LdfData write length error" -#define MSG_LDF_W_LEN_ERROR "LdfData write length error" -#define MSG_LIC_NO_MYSQL "Your current license does not enable using the MySQL table type" -#define MSG_LINEAR_ERROR "Linearization error" -#define MSG_LINE_LENGTH "Output line length reset to %d" -#define MSG_LINE_MAXLIN "Max number of work lines reset to %d" -#define MSG_LINE_MAXRES "Max number of output lines reset to %d" -#define MSG_LINE_MAXTMP "Max number of intermediate lines reset to %d" #define MSG_LINE_TOO_LONG "New line is too long" -#define MSG_LINJOINDB_ERROR "System error: incorrect call to LinJoinDB" #define MSG_LIST "--List--" -#define MSG_LNG_NOT_IN_LIST "Language %s not found in attached list" -#define MSG_LOADING_DB "Loading DB Description" #define MSG_LOADING_FAILED "Loading of %s failed" -#define MSG_LOAD_CDLL_ERROR "Error loading ConnDll: rc=%d" -#define MSG_LOCSTRG_TOO_BIG "LOCSTRG: n too big ? (%d)\n" -#define MSG_LOGICAL_ERROR "%s: Logical error" #define MSG_LRECL_TOO_SMALL "Lrecl too small (headlen = %d)" -#define MSG_MAC_NO_DELETE "Delete not enabled for MAC tables" -#define MSG_MAC_NO_INDEX "No direct access to MAC tables" -#define MSG_MAC_READ_ONLY "MAC tables are read only" -#define MSG_MAC_WIN_ONLY "MAC tables are Windows only" #define MSG_MAKE_EMPTY_FILE "Making empty file %s: %s" #define MSG_MAKING "Making" -#define MSG_MAKING_DISTINCT "Making distinct groups" #define MSG_MALLOC_ERROR "Memory allocation failed: %s returned Null" -#define MSG_MALLOC_NULL "malloc returned Null" -#define MSG_MAP_NO_MORE "Type %s no more supported" -#define MSG_MAP_OBJ_ERR "Error %d occurred closing the mapping object" -#define MSG_MAP_VEC_ONLY "MAP Insert is for VEC Estimate tables only" #define MSG_MAP_VIEW_ERROR "MapViewOfFile %s error rc=%d" #define MSG_MAXSIZE_ERROR "Cannot calculate max size on open table" -#define MSG_MAXTMP_TRUNCATE "Intermediate results truncated by maxtmp=%d" -#define MSG_MAX_BITMAP "Max opt bitmap size reset to %d" -#define MSG_MEMSIZE_TOO_BIG "Error: memsize (%d) too big for length (%d)" #define MSG_MEM_ALLOC_ERR "Memory allocation error, %s size=%d" #define MSG_MEM_ALLOC_ERROR "Memory allocation error" -#define MSG_MEM_ALLOC_YET "Memory already allocated" -#define MSG_METAFILE_NOTFND "Grammar Meta file not found" #define MSG_MISPLACED_QUOTE "Misplaced quote in line %d" -#define MSG_MISSING "Missing: Value=%p Argval=%p Builtin=%d" #define MSG_MISSING_ARG "Missing argument for operator %d" -#define MSG_MISSING_COL_DEF "Missing column definition" -#define MSG_MISSING_CONNECT "Missing connect string" -#define MSG_MISSING_EOL "Missing endline character in %s" #define MSG_MISSING_FIELD "Missing field %d in %s line %d" #define MSG_MISSING_FNAME "Missing file name" #define MSG_MISSING_NODE "Missing %s node in %s" -#define MSG_MISSING_POS "Missing POS code" #define MSG_MISSING_ROWNODE "Can't find RowNode for row %d" -#define MSG_MISSING_SERV_DB "Missing server and/or database string" -#define MSG_MISS_LEAD_COL "Missing leading index column %s" -#define MSG_MISS_NAME_LRECL "Missing file name and/or lrecl" -#define MSG_MISS_TABLE_LIST "Missing table list" -#define MSG_MISS_VCT_ELMT "Missing VCT block size (Elements)" #define MSG_MIS_TAG_LIST "Missing column tag list" -#define MSG_MKEMPTY_NIY "MakeEmptyFile: not yet implemented for Huge and Unix" -#define MSG_MOVE_INV_TYPE "MOVPARM: Invalid parameter type %d" -#define MSG_MULT_DISTINCT "Distinct is specified more than once" -#define MSG_MULT_KEY_ERROR "Multiple key error k=%d n=%d" #define MSG_MUL_MAKECOL_ERR "Tabmul MakeCol logical error" -#define MSG_MYSQL_CNC_OFF "MySQL connection is closed" -#define MSG_MYSQL_CNC_ON "MySQL connection is established" -#define MSG_MYSQL_NOT_SUP "MySQL not supported by this version" -#define MSG_MY_CNC_ALREADY "MySQL connection already active" #define MSG_NAME_CONV_ERR "Error converting node name" -#define MSG_NAME_IS_USED "Name %s already in use" -#define MSG_NCOL_GT_MAXCOL "Too many columns (%d > %d max)" -#define MSG_NEW_CHAR_NULL "new char(%d) returned Null" #define MSG_NEW_DOC_FAILED "Cannot create new document" #define MSG_NEW_RETURN_NULL "New returned Null in PlugEvalLike" -#define MSG_NEW_TABLE_ERR "Unable to retrieve new table %s" #define MSG_NEXT_FILE_ERROR "Couldn't find next file. rc=%d" -#define MSG_NODEF_FROM_VIEW "Cannot define a table from a view" -#define MSG_NODE_FOR_CHAR "Node %s found when looking for character" -#define MSG_NODE_SUBSET_ERR "Node %d Subset error" #define MSG_NONCONT_EXCEPT "Noncontinuable exception" -#define MSG_NON_DUP_HAVING "Having clause in non/dup functional query" -#define MSG_NON_EVAL_SEM "Sem not evaluated: p_no=%d" #define MSG_NOP_ZLIB_INDEX "Cannot do indexing on non optimized zlib table" #define MSG_NOT_A_DBF_FILE "Not a dBASE dbf file " -#define MSG_NOT_ENOUGH_COLS "Not enough columns in %s" -#define MSG_NOT_ENOUGH_MEM "Not enough memory to perform this operation" #define MSG_NOT_FIXED_LEN "File %s is not fixed length, len=%d lrecl=%d" -#define MSG_NOT_IMPLEMENTED "Not implemented: %.8s" -#define MSG_NOT_IMPL_JOIN "Not implemented for Join" -#define MSG_NOT_IMPL_SET "Not implemented for set operators" -#define MSG_NOT_IMPL_YET "Not implemented yet" -#define MSG_NOT_LINEARIZED "Table tree was not linearized" -#define MSG_NOT_MODIFIABLE " (not modifiable)" #define MSG_NO_0DH_HEAD "No 0Dh at end of header (dbc=%d)" -#define MSG_NO_ACTIVE_APPL "No active application" #define MSG_NO_ACTIVE_DB "No active database" -#define MSG_NO_ACTIVE_UDIC "No active user dictionary" -#define MSG_NO_AGGR_FUNC "Aggregated function %d not allowed here" -#define MSG_NO_AREA_FILE "Area file not found" -#define MSG_NO_AVAIL_RESULT "No result available" -#define MSG_NO_BIG_DELETE "Partial delete not yet implemented for Huge files" #define MSG_NO_CHAR_FROM "Cannot return char value from type %d" -#define MSG_NO_CLUSTER_COL "No clustered columns" -#define MSG_NO_COL_ADDING "Cannot add new column(s) to old definition" -#define MSG_NO_COL_DEF_AS "Column definitions cannot be used with AS Select" -#define MSG_NO_COL_FOUND "No column found in section %s" -#define MSG_NO_COL_IN_TABLE "Column %d not in table %s" -#define MSG_NO_COL_SECTION "Missing column section for table %s" -#define MSG_NO_CONNECT_ADDR "No connexion address provided" -#define MSG_NO_CONST_FILTER "Constant filters not implemented" -#define MSG_NO_CURLY_BRKT "No closing curly bracket" -#define MSG_NO_DATABASE "Database %s not found" #define MSG_NO_DATE_FMT "No date format for valblock of type %d" -#define MSG_NO_DBF_INSERT "Insert not supported yet for GDF files" #define MSG_NO_DEF_FNCCOL "Cannot find default function column" #define MSG_NO_DEF_PIVOTCOL "Cannot find default pivot column" #define MSG_NO_DIR_INDX_RD "No direct access of %s tables" -#define MSG_NO_DMY_DIR_ACC "No direct access of virtual DUMMY tables" -#define MSG_NO_DOM_DELETE "Partial delete not yet implemented for domains" -#define MSG_NO_DOM_MATCH "Unmatched string %.8s... in domain %s" -#define MSG_NO_EDITED_LANG "Coparm: No active edited language" -#define MSG_NO_EXP_LINK "Cannot use expression to link a JCT table" -#define MSG_NO_EXT_FILTER "Filtering cannot refer to another table" -#define MSG_NO_EXT_UPDATE "Cannot update with reference to another table" #define MSG_NO_FEAT_SUPPORT "No %s support in this version" -#define MSG_NO_FILE_LIST "Table %s has no file list" #define MSG_NO_FLD_FORMAT "Missing format for field %d of %s" #define MSG_NO_FORMAT_COL "Cannot format the type COLUMN" #define MSG_NO_FORMAT_TYPE "Cannot set format from type %d" -#define MSG_NO_FULL_JOIN "Only Equi-join on key(s) is allowed by check setting" -#define MSG_NO_FUL_OUT_JOIN "Full outer joins are not supported" -#define MSG_NO_FUNC_ORDER "Unsupported ordering on functional item" -#define MSG_NO_HEAD_JOIN "Join on not heading table" -#define MSG_NO_HQL_CONV "Conversion to HQL not available" -#define MSG_NO_INDEX "No indexes on table %s" -#define MSG_NO_INDEX_GBX "No or improper index for SQLGBX" -#define MSG_NO_INDEX_IN "No indexes found in %s" #define MSG_NO_INDEX_READ "No indexed read for multiple tables" -#define MSG_NO_INIT_LANG "No initial language" -#define MSG_NO_JOIN_TO_EXP "No join to expressions" -#define MSG_NO_JOIN_UPDEL "Update/Delete on MySQL table cannot be joined" #define MSG_NO_KEY_COL "No key columns found" #define MSG_NO_KEY_UPDATE "Cannot update key names" -#define MSG_NO_LANGUAGE "No language in operation\n" -#define MSG_NO_LANG_TO_QUIT "No next language to quit" -#define MSG_NO_LISTVAL_HERE "LSTBLK: List of values used out of context" #define MSG_NO_MAP_INSERT "MAP incompatible with Insert" #define MSG_NO_MATCHING_COL "No matching column %s in %s" #define MSG_NO_MATCH_COL "Cannot find matching column" #define MSG_NO_MEMORY "No memory" -#define MSG_NO_MEM_CORR_SUB "In memory correlated subquery not implemented yet" #define MSG_NO_MODE_PADDED "Mode not supported for padded files" -#define MSG_NO_MORE_COL "Column %s no more in pivot table" -#define MSG_NO_MORE_LANG "No more language, exit from %s\n" -#define MSG_NO_MORE_VAR "VAR files no more supported" -#define MSG_NO_MULCOL_JOIN "No join yet on muticolumn index" -#define MSG_NO_MULT_HAVING "Multiple having clauses not implemented" -#define MSG_NO_MUL_DIR_ACC "Direct access of multiple tables not implemented yet" #define MSG_NO_MUL_VCT "VCT tables cannot be multiple" -#define MSG_NO_MYSQL_CONN "No open MySQL connection" -#define MSG_NO_MYSQL_DELETE "Delete should not be called for MySQL tables" -#define MSG_NO_NBCOL "No NBcol" -#define MSG_NO_NBLIN "No NBlin, MaxSize or Continued" -#define MSG_NO_NBLIN_CONT "Fetch: No NBlin or Continued" -#define MSG_NO_NULL_CONST "Cannot handle constant" -#define MSG_NO_ODBC_COL "Automatic ODBC columns not supported in this version" #define MSG_NO_ODBC_DELETE "Delete should not be called for ODBC tables" #define MSG_NO_ODBC_DIRECT "Direct access of ODBC tables not implemented yet" #define MSG_NO_ODBC_MUL "Multiple(2) not supported for ODBC tables" #define MSG_NO_ODBC_SPECOL "No ODBC special columns" -#define MSG_NO_OPT_COLUMN "Not optimizable or no optimized columns" -#define MSG_NO_OP_MODIF "Modificators do not apply to %s" -#define MSG_NO_PARAMETER "No parameter" #define MSG_NO_PART_DEL "No partial delete of %s files" #define MSG_NO_PART_MAP "Partial mapping not implemented for this OS" #define MSG_NO_PAR_BLK_INS "Cannot insert partial block yet" #define MSG_NO_PIV_DIR_ACC "No direct access to PIVOT tables" -#define MSG_NO_POS_ADDED "No Pos_code added" -#define MSG_NO_PROMPTING "Cannot handle prompting for distributed tables" -#define MSG_NO_QRY_DELETE "Delete cannot be used for QRY views" -#define MSG_NO_QUERY_ARRAY "Array from QUERY not implemented yet" -#define MSG_NO_RCUR_DSK_YET "Recursive use of DISK not implemented yet" #define MSG_NO_READ_32 "Can't read 32 bytes" #define MSG_NO_RECOV_SPACE "Cannot recover space in index file" -#define MSG_NO_REF_DELETE "Cannot delete with reference to another table" -#define MSG_NO_REF_UPDATE "Cannot update with reference to another table" -#define MSG_NO_REMOTE_FNC "Cannot process some functions remotely" #define MSG_NO_ROWID_FOR_AM "Can't get RowID in direct access for tables of type %s" #define MSG_NO_ROW_NODE "Row node name is not defined" #define MSG_NO_SECTION_NAME "Missing section name" #define MSG_NO_SEC_UPDATE "Cannot update section names" -#define MSG_NO_SELECTED_DB "No selected database" -#define MSG_NO_SELF_PIVOT "Cannot pivot oneself!" -#define MSG_NO_SERVER_FOUND "No server found" #define MSG_NO_SETPOS_YET "%s SetPos not implemented yet" -#define MSG_NO_SFEXIT_UNIX "Function %s not available on Unix" -#define MSG_NO_SOURCE " (no source)" #define MSG_NO_SPEC_COL "No MySQL special columns" -#define MSG_NO_SQL_DELETE "Delete cannot be currently used for SQL views" #define MSG_NO_SUB_VAL "No sub value for array of type %d" -#define MSG_NO_SUCH_INDEX "No indexes %s on table %s" -#define MSG_NO_SUCH_SERVER "cannot find the server %s" -#define MSG_NO_SUCH_TABLE "Table %s not in DB" #define MSG_NO_TABCOL_DATA "No data found for table %s column %s" -#define MSG_NO_TABLE_COL "No columns found for %s" #define MSG_NO_TABLE_DEL "Delete not enabled for %s tables " -#define MSG_NO_TABLE_DESC "No Table Description Block" -#define MSG_NO_TABLE_INDEX "Table %s has no index" -#define MSG_NO_TABLE_LIST "No table list" #define MSG_NO_TAB_DATA "No data found for table %s" -#define MSG_NO_TERM_IN_TOK "Non terminal cannot be used in token rules" -#define MSG_NO_TOKEN_DB "Cannot find DB for Token column %s" -#define MSG_NO_UNIX_CATINFO "No catalog info under Unix" -#define MSG_NO_UPDEL_JOIN "Update/Delete on ODBC table cannot be joined" #define MSG_NO_VCT_DELETE "Partial delete not yet implemented for VCT files" -#define MSG_NO_VIEW_COLDEF "No coldefs available for views" -#define MSG_NO_VIEW_SORT "Cannot sort/join SQL functional view %s" #define MSG_NO_ZIP_DELETE "Delete Zip files not implemented yet" -#define MSG_NO_ZIP_DIR_ACC "Direct access of ZDOS tables not implemented yet" -#define MSG_NULL_COL_VALUE "Column Value block is NULL" -#define MSG_NULL_ENTRY "InitLang, null entry %d %s" -#define MSG_NULL_QUERY "Null query" -#define MSG_NUMVAL_NOMATCH "Numval mismatch for %s" -#define MSG_N_FULL_PARSES "%d full parses" -#define MSG_ODBC_READ_ONLY "ODBC is currently read only" -#define MSG_OFFSET_NOT_SUPP "Offset not implemented for this type of sub query" -#define MSG_ONE_LANG_YET "Already one language in edition" -#define MSG_ONE_PARAM_ONLY "Only one parameter allowed" -#define MSG_ONLY_LOG10_IMPL "Only Log10 is implemented" -#define MSG_ON_LANGUAGE "Language %.8s version %d.%d loaded for editing" #define MSG_OPENING "Opening" -#define MSG_OPENING_QUERY "Opening query" #define MSG_OPEN_EMPTY_FILE "Opening empty file %s: %s" #define MSG_OPEN_ERROR "Open error %d in mode %d on %s: " #define MSG_OPEN_ERROR_IS "Open error on %s: %s" -#define MSG_OPEN_ERROR_ON "Open error on %s" #define MSG_OPEN_MODE_ERROR "Open(%s) error %d on %s" -#define MSG_OPEN_SORT_ERROR "Logical sort error in QUERY Open" #define MSG_OPEN_STRERROR "open error: %s" -#define MSG_OPEN_W_ERROR "Couldn't open %s for writing" #define MSG_OPTBLK_RD_ERR "Error reading opt block values: %s" #define MSG_OPTBLK_WR_ERR "Error writing opt block values: %s" #define MSG_OPTIMIZING "Optimizing " @@ -756,258 +238,83 @@ #define MSG_OPT_DVAL_WR_ERR "Error writing distinct values: %s" #define MSG_OPT_HEAD_RD_ERR "Error reading opt file header: %s" #define MSG_OPT_HEAD_WR_ERR "Error writing opt file header: %s" -#define MSG_OPT_INIT "Optimization initialized" #define MSG_OPT_LOGIC_ERR "Logical error in SetBitmap, i=%d" #define MSG_OPT_MAX_RD_ERR "Error reading opt max values: %s" #define MSG_OPT_MAX_WR_ERR "Error writing opt max values: %s" #define MSG_OPT_MIN_RD_ERR "Error reading opt min values: %s" #define MSG_OPT_MIN_WR_ERR "Error writing opt min values: %s" #define MSG_OPT_NOT_MATCH "Non-matching opt file %s" -#define MSG_OP_RES_TOO_LONG "Result too long for operator=%d" -#define MSG_ORDER_OUT_RANGE "Order %d out of range" -#define MSG_ORDER_TWICE "Ordering twice the same select item" #define MSG_PAGE_ERROR "In page error" #define MSG_PARM_CNT_MISS "Parameter count mismatch" -#define MSG_PARSE_NULL_SEM "Parse with null semantics" -#define MSG_PARSING_QUERY "Parsing query" -#define MSG_PIX_ERROR "Pix %s error Rule_no=%u\n" -#define MSG_PIX_TEST_ERROR "Rule=%u: pix-TEST not in first node\n" -#define MSG_PLG_READ_ONLY "PLG is currently Read Only" -#define MSG_PLM_NULL_SFP "TABPLM ReadDB: Sfp is NULL" -#define MSG_PLUG_NOT_INIT "Plug was not initialized\n" -#define MSG_PLUG_NOT_RUN "Plug is not running" -#define MSG_PNODE_RULE "(P_node %d rule %d) " -#define MSG_POS_TOO_LONG "%s too long (>%d)" #define MSG_PREC_VBLP_NULL "ARRAY SetPrecision: Vblp is NULL" #define MSG_PRIV_INSTR "Privileged instruction" #define MSG_PROCADD_ERROR "Error %d getting address of %s" -#define MSG_PROCESS_SUBQRY "Processing Sub-Query" -#define MSG_PROC_WOULD_LOOP "Process would loop (maxres=%d maxlin=%d)" -#define MSG_PROGRESS_INFO "Progress Information" -#define MSG_PROMPT_CANCEL "Prompt was cancelled" -#define MSG_PROMPT_NIY "Prompt not implemented for this configuration" -#define MSG_PTR_NOT_FOUND "Pointer not found Num=%d ti1=%d" -#define MSG_PXDEF_IS_NULL "Pxdef is NULL" -#define MSG_QRY_READ_ONLY "QRY views are read only" #define MSG_QUERY_CANCELLED "Query Cancelled by User" -#define MSG_QUERY_NOT_EXEC "Query not executed" -#define MSG_QUERY_SAVED "Query %s saved" -#define MSG_QUOTE_IN_QUOTE "Quote char inside quoted field in line %d" -#define MSG_RANGE_NIY "Range NIY for %s" #define MSG_RANGE_NO_JOIN "Range is not meant for join index" #define MSG_RC_READING "rc=%d reading table %s" -#define MSG_READB_BAD_INIT "%s ReadDB called with Init=0" -#define MSG_READCOL_ERROR "SQLCOL ReadColumn error" -#define MSG_READING "Reading" -#define MSG_READING_FROM "Reading from %s" -#define MSG_READING_RECORD "Error reading record %d of %s" #define MSG_READY "Ready" #define MSG_READ_ERROR "Error reading %s: %s" -#define MSG_READ_ERROR_RC "Read error, rc=%d" -#define MSG_READ_MEM_ERROR "Reading memory %d: size=%d" #define MSG_READ_ONLY "Cannot modify this read/only protected table" #define MSG_READ_SEEK_ERROR "Read seek error: %s" -#define MSG_READ_SEG_ERROR "Reading segment %d: size=%d" -#define MSG_RECEIVED "Received %c\n" -#define MSG_RECORD_ERROR "Error reading record %d of %s" -#define MSG_RECORD_NO_SEP "Record with no separator" -#define MSG_REC_SKIPPED " (%d bad records skipped by MaxErr setting)" -#define MSG_REDUCE_INDEX "Reducing index" #define MSG_REGISTER_ERR "Unable to register NS with prefix='%s' and href='%s'" -#define MSG_REMOTE_CONN_ERR "Remote connection failed" #define MSG_REMOVE_ERROR "Error removing %s: %s" -#define MSG_REMOVE_NOT_IMPL "Remove not implemented for non-table TDB" #define MSG_RENAME_ERROR "Error renaming %s to %s: %s" -#define MSG_RENUM_RULES "Renumber rules and enter ADD again (rule saved in buffer)" -#define MSG_REORDER_INDEX "Reordering index" -#define MSG_REQU_ARG_NUM "Function %s requires %d arguments" -#define MSG_RESET_TO "%s reset to %d" -#define MSG_RES_NOT_UNIQUE "Result is not a unique value" -#define MSG_RET_FROM_LANG "Return to language %s version %d.%d from language %s version %d.%d" #define MSG_ROWID_NOT_IMPL "RowNumber not implemented for tables of type %s" -#define MSG_ROWS_SELECTED "%d rows selected in %.2lf sec" -#define MSG_ROWS_TRUNCATED " (truncated by MAXRES, LIMIT, FREQ or AreaSize setting)" -#define MSG_ROW_ARGNB_ERR "ROW arg number mismatch (%d,%d)" -#define MSG_RPC_SERVER_ERR "RPC error, server not responding" -#define MSG_RSC_ALLOC_ERROR "Memory allocation error in Rescol %s" -#define MSG_RULE_ENTERED "Rule %d entered" -#define MSG_RULE_SUBSET_ERR "Rules Subset error" -#define MSG_SAVING_INDEX "Saving index file" -#define MSG_SCAN_NOT_IMP "Scan not implemented" #define MSG_SEC_KEY_FIRST "Section and key names must come first on Insert" #define MSG_SEC_NAME_FIRST "Section name must come first on Insert" -#define MSG_SEC_NOT_FOUND "Section %s not found in %s" -#define MSG_SEEK_ERROR "Seek error in CopyHeader" -#define MSG_SEMANTIC_TREE "Semantic Tree" -#define MSG_SEM_BAD_REF "Sem name @%d refers to an argument of type not 0 or 1" -#define MSG_SEM_UNKNOWN "unknown, rc=%d" #define MSG_SEP_IN_FIELD "Field %d contains the separator character" #define MSG_SEQUENCE_ERROR "Sequence error on statement allocation" #define MSG_SETEOF_ERROR "Error %d in SetEndOfFile" #define MSG_SETRECPOS_NIY "SetRecpos not implemented for this table type" -#define MSG_SET_LOCALE "Locale set to %s" -#define MSG_SET_NULL_DOM "Setting value %d to a null domain" -#define MSG_SET_OP_NOT_IMPL "sorry - set operators not implemented" #define MSG_SET_STR_TRUNC "SetValue: String would be truncated" -#define MSG_SEVERAL_TREES "Some tables are not properly joined" #define MSG_SFP_ERROR "SetFilePointer error: %s" -#define MSG_SFUNC_NOT_IMPL "Scalar Function %s not implemented" #define MSG_SHARED_LIB_ERR "Error loading shared library %s: %s" #define MSG_SINGLE_STEP "Single step" -#define MSG_SLEEP "I slept %d milliseconds" -#define MSG_SMART_SORTING "Retrieving sorted rows (pass %d of %d)" -#define MSG_SMART_SORT_ERR "Logical Smart Sort Error 1" -#define MSG_SORTING "Sorting" -#define MSG_SORTING_INDEX "Sorting index" #define MSG_SORTING_VAL "Sorting %d values" -#define MSG_SORT_JOIN_INDEX "Sorting join index" #define MSG_SPCOL_READONLY "Special column %s is Read Only" -#define MSG_SPEC_CMD_SEP "Special commands must be executed separately" -#define MSG_SQL_BAD_TYPE "RephraseSQL: type %d not supported" -#define MSG_SQL_BLOCK_MISM "CheckColumn: SQL current blocks mismatch" #define MSG_SQL_CONF_ERROR "SQL Error: SQL_CONFORMANCE" -#define MSG_SQL_READ_ONLY "SQL views are currently read only" #define MSG_SRCH_CLOSE_ERR "Couldn't close search handle" #define MSG_SRC_TABLE_UNDEF "Source table is not defined" -#define MSG_STACK_ERROR "stack error, i=%d\n" -#define MSG_STACK_OVERFLOW "Parser: Stack overflow\n" -#define MSG_STRG_NOT_FOUND "String not found" -#define MSG_STRING_INV_LIST "List invalid for SemString" -#define MSG_STRING_TOO_BIG "String too big for domain %s" -#define MSG_SUBALLOC_ERROR "Not enough memory in area %p for request of %d (used=%d free=%d)" -#define MSG_SUBAL_HUGE_ERR "Not enough memory in huge %p for request of %d" -#define MSG_SUBARG_NOSEM "@ or sub-phrase arg of level %d points to a meaningless argument" -#define MSG_SUBARG_OUTRANGE "Out of range @ or sub-phrase argument of level %d" -#define MSG_SUBQRY_ONEITEM "Sub-Query must have exactly one select item" -#define MSG_SUBSET_ERROR "SubSet error in LoadDB" -#define MSG_SUB_OPEN_YET "Subquery already open" -#define MSG_SUB_RES_TOO_LNG "Result too long for SUBSTR" -#define MSG_SYNTAX_ERROR "Syntax error" -#define MSG_SYSTEM_ERROR "System error %d" -#define MSG_S_ACCESS_DENIED "%s: access denied" -#define MSG_S_ERROR "%s error" -#define MSG_S_ERROR_NUM "%s: error=%d" -#define MSG_S_INTRUPT_ERROR "%s: interrupt error" -#define MSG_S_INVALID_PARM "%s: invalid parameter" -#define MSG_S_INV_ADDRESS "%s: invalid address" -#define MSG_S_UNKNOWN_ERROR "%s: unknown error code %u" +#define MSG_STACK_OVERFLOW "Stack overflow" #define MSG_TABDIR_READONLY "DIR tables are read/only" -#define MSG_TABLE_ALREADY "Table %s already exists" -#define MSG_TABLE_ALTERED "%s table %s altered" -#define MSG_TABLE_CREATED "%s table %s created" -#define MSG_TABLE_DROPPED "Table %s dropped" -#define MSG_TABLE_MULT_JOIN "Table %s used more than once for join" -#define MSG_TABLE_NOT_IN_DB "Table %s does not exist in %s" #define MSG_TABLE_NOT_OPT "Not an optimizable table" -#define MSG_TABLE_NO_INDEX "Table %s cannot be indexed" -#define MSG_TABLE_NO_OPT "Table %s does not exist or type is not optimizable" +#define MSG_TABLE_NO_INDEX "Table %s is not indexable" #define MSG_TABLE_READ_ONLY "%s tables are read only " #define MSG_TABMUL_READONLY "Multiple tables are read/only" -#define MSG_TAB_NOT_LOADED " (some tables could not be loaded)" -#define MSG_TAB_NOT_SPEC "No table specified" -#define MSG_TB_VW_NOTIN_DB "Table or view %s not in DB" -#define MSG_TDB_NXT_NOT_NUL "Tdb.Next not NULL" -#define MSG_TDB_USE_ERROR "Error, Tdbp->Use=%d" -#define MSG_TOO_MANY_COLS "Too many columns" -#define MSG_TOO_MANY_COLTAB "Too many columns in %s (%d)" #define MSG_TOO_MANY_FIELDS "Too many fields line %d of %s" #define MSG_TOO_MANY_JUMPS "Too many jump levels" #define MSG_TOO_MANY_KEYS "Too many keys (%d)" -#define MSG_TOO_MANY_POS "Too many pos_codes" -#define MSG_TOO_MANY_TABLES "Too many tables (%d)" -#define MSG_TOPSEM_ERROR "Unknown error in TopSem" #define MSG_TO_BLK_IS_NULL "To Blk is NULL" -#define MSG_TO_FTR_NOT_NULL "Set.To_Ftr is not null" -#define MSG_TO_PIX_NOT_NULL "Set.To_Pix is not null" -#define MSG_TO_SEM_NOT_NULL "Set.To_Sem is not null" #define MSG_TRUNCATE_ERROR "truncate error: %s" #define MSG_TRUNC_BY_ESTIM "truncated by Estimate" -#define MSG_TYPES_ERROR "Error on Types(%d)" -#define MSG_TYPE_CONV_ERROR "Type cannot be converted in expression" -#define MSG_TYPE_DEF_MISM "type and definition do not match" #define MSG_TYPE_MISMATCH "Key and source are not of the same type" -#define MSG_TYPE_RECFM_MISM "Type and Recfm mismatch" -#define MSG_TYPE_TO_VERIFY "Type to verify: %d" #define MSG_TYPE_VALUE_ERR "Column %s type(%s)/value(%s) mismatch" #define MSG_UNBALANCE_QUOTE "Unbalanced quote in line %d" #define MSG_UNDEFINED_AM "COLBLK %s: undefined Access Method" -#define MSG_UNDEFINED_PATH "Undefined Plgcnx.ini path" -#define MSG_UNDEF_COL_COUNT "Count on undefined column" -#define MSG_UNKNOWN_DOMAIN "Unknown domain %s" -#define MSG_UNKNOWN_ERROR "Unknown error" #define MSG_UNKNOWN_EXCPT "Unknown exception" -#define MSG_UNKNOWN_NAME "Unknown name: %.8s" -#define MSG_UNKNOWN_PATH "Unknown Plgcnx.ini path" -#define MSG_UNKNOWN_POS "Unknown pos name: %s" -#define MSG_UNKNOWN_SEM "Unknown Sem %.8s, rc=%d" -#define MSG_UNKNOWN_SYNONYM "Unknown synonym" -#define MSG_UNKNW_QRY_TYPE "ReadDB: unknown query type" -#define MSG_UNKN_ERR_CODE "Unknown error code %d" -#define MSG_UNLOADABLE " unloadable: " -#define MSG_UNLOADABLE_PRM "%s unloadable: %s" #define MSG_UNMATCH_FIL_ARG "Unmatched filter argument" -#define MSG_UNQ_COL_SEV_TAB "Unqualified column %s is in several tables" -#define MSG_UNRESOLVED_ARG "?Unresolved argument %s at %d line %d" #define MSG_UPDATE_ERROR "Error updating %s" -#define MSG_UPDATING_ROWS "Updating rows" #define MSG_UPD_ZIP_NOT_IMP "Updating ZDOS tables not implemented yet" -#define MSG_UP_LANGUAGE "Block language %.8s version %d level %d loaded" -#define MSG_USED_FREE_MEM "%d used in sarea, %d free" -#define MSG_USETEMP_IS "UseTemp is %s" -#define MSG_USETEMP_RESET ". Usetemp reset to Auto" -#define MSG_USETEMP_SET "UseTemp set to %s" -#define MSG_USE_NO_MATCH "Use do not match : Use=%d, ti2=%d, ti3=%d" -#define MSG_USING_INDEX " (Using index" -#define MSG_VALIST_MISMATCH "List of values mismatch" #define MSG_VALSTR_TOO_LONG "Value %s too long for string of length %d" #define MSG_VALTYPE_NOMATCH "Non matching Value types" #define MSG_VALUE_ERROR "Column %s: value is null" -#define MSG_VALUE_NOT_ALLOC "Value not allocated for column R%d %s" #define MSG_VALUE_TOO_BIG "Value %lld too big for column %s" #define MSG_VALUE_TOO_LONG "Value %s too long for column %s of length %d" #define MSG_VAL_ALLOC_ERR "Cannot allocate value node" -#define MSG_VAL_TOO_LONG "Value field %s too long for %s" -#define MSG_VIEW_ALREADY "View %s already exists" -#define MSG_VIEW_CREATED "%s view %s created" -#define MSG_VIEW_DROPPED "View %s dropped" -#define MSG_VIEW_NOT_IN_DB "View %s does not exist in %s" #define MSG_VIR_NO_DELETE "Delete not allowed for %s tables" #define MSG_VIR_READ_ONLY "Virtual %s tables are read only" -#define MSG_VM_LANG "Language has VM format, not supported" #define MSG_VOID_FIRST_ARG "First argument should not be void" -#define MSG_VOID_IN_STRING "Error: void IN string" -#define MSG_VOID_ORDER_LIST "Null ordering list, system error ?" -#define MSG_VOID_POS_DICT "Void Pos dictionary" -#define MSG_VOID_QUERY "Void query %s" #define MSG_WORK_AREA "Work area: %s" -#define MSG_WORK_TOO_SMALL "Work area too small, increase AreaSize" -#define MSG_WRITE_ERROR "Error writing to %s" #define MSG_WRITE_SEEK_ERR "Write seek error: %s" #define MSG_WRITE_STRERROR "Error writing %s: %s" #define MSG_WRITING "Writing" #define MSG_WRITING_ERROR "Error writing to %s: %s" -#define MSG_WRITING_QUERY "Writing query: " -#define MSG_WRONG_ARG_NUM "Function %s does not take %d arguments" -#define MSG_WRONG_COL_NUM "Column number %d out of range in %s" -#define MSG_WRONG_DB_LIST "Wrong or nul database list" -#define MSG_WRONG_FUNCTION "Wrong function %d" -#define MSG_WRONG_OP_PARM "Wrong operator or parameters for %s" -#define MSG_WRONG_PARMS "Wrong parameters for %s" -#define MSG_WRONG_PASSWORD "Illegal password for %s" -#define MSG_WRONG_TYPE "unsupported type" -#define MSG_WRONG_USERFILE "Wrong Userfile size=%d" #define MSG_WS_CONV_ERR "Error converting %s to WS" #define MSG_XCOL_MISMATCH "Column %s mismatch in index" -#define MSG_XDB_DEL_ERROR "Error while deleting entries from XDB file" #define MSG_XFILE_READERR "Error %d reading index file" -#define MSG_XFILE_TOO_SMALL "Index file is smaller than index length" #define MSG_XFILE_WRITERR "Error writing index file: %s" #define MSG_XMLTAB_INIT_ERR "Error initializing XML table" #define MSG_XML_INIT_ERROR "Error initializing new XML file" #define MSG_XPATH_CNTX_ERR "Unable to create new XPath context" #define MSG_XPATH_EVAL_ERR "Unable to evaluate xpath location '%s'" #define MSG_XPATH_NOT_SUPP "Unsupported Xpath for column %s" -#define MSG_X_ARG_ADDED "%d arguments have been added" -#define MSG_X_ARG_SET "%d arguments have been set" -#define MSG_X_ON_TAB " %s on %s(" -#define MSG_ZERO_DIVIDE "Zero divide in expression" diff --git a/storage/connect/enids.h b/storage/connect/enids.h new file mode 100644 index 00000000000..d171955b0bd --- /dev/null +++ b/storage/connect/enids.h @@ -0,0 +1,46 @@ + case IDS_TABLES: p = "Table Headers"; break; + case IDS_TAB_01: p = "Table_Cat"; break; + case IDS_TAB_02: p = "Table_Schema"; break; + case IDS_TAB_03: p = "Table_Name"; break; + case IDS_TAB_04: p = "Table_Type"; break; + case IDS_TAB_05: p = "Remark"; break; + case IDS_COLUMNS: p = "Column Headers"; break; + case IDS_COL_01: p = "Table_Cat"; break; + case IDS_COL_02: p = "Table_Schema"; break; + case IDS_COL_03: p = "Table_Name"; break; + case IDS_COL_04: p = "Column_Name"; break; + case IDS_COL_05: p = "Data_Type"; break; + case IDS_COL_06: p = "Type_Name"; break; + case IDS_COL_07: p = "Column_Size"; break; + case IDS_COL_08: p = "Buffer_Length"; break; + case IDS_COL_09: p = "Decimal_Digits"; break; + case IDS_COL_10: p = "Radix"; break; + case IDS_COL_11: p = "Nullable"; break; + case IDS_COL_12: p = "Remarks"; break; + case IDS_PKEY: p = "Key Headers"; break; + case IDS_PKY_01: p = "Table_Catalog"; break; + case IDS_PKY_02: p = "Table_Schema"; break; + case IDS_PKY_03: p = "Table_Name"; break; + case IDS_PKY_04: p = "Column_Name"; break; + case IDS_PKY_05: p = "Key_Seq"; break; + case IDS_PKY_06: p = "Pk_Name"; break; + case IDS_STAT: p = "Stat Headers"; break; + case IDS_STA_01: p = "Table_Catalog"; break; + case IDS_STA_02: p = "Table_Schema"; break; + case IDS_STA_03: p = "Table_Name"; break; + case IDS_STA_04: p = "Non_Unique"; break; + case IDS_STA_05: p = "Index_Qualifier"; break; + case IDS_STA_06: p = "Index_Name"; break; + case IDS_STA_07: p = "Type"; break; + case IDS_STA_08: p = "Seq_in_Index"; break; + case IDS_STA_09: p = "Column_Name"; break; + case IDS_STA_10: p = "Collation"; break; + case IDS_STA_11: p = "Cardinality"; break; + case IDS_STA_12: p = "Pages"; break; + case IDS_STA_13: p = "Filter_Condition"; break; + case IDS_DRIVER: p = "Driver Headers"; break; + case IDS_DRV_01: p = "Description"; break; + case IDS_DRV_02: p = "Attributes"; break; + case IDS_DSRC: p = "DataSrc Headers"; break; + case IDS_DSC_01: p = "Name"; break; + case IDS_DSC_02: p = "Description"; break; diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp index c0ca40f4c01..08f87e2b836 100644 --- a/storage/connect/filamap.cpp +++ b/storage/connect/filamap.cpp @@ -46,8 +46,6 @@ #include "filamap.h" #include "tabdos.h" -extern "C" int trace; - /* --------------------------- Class MAPFAM -------------------------- */ /***********************************************************************/ @@ -290,8 +288,8 @@ bool MAPFAM::RecordPos(PGLOBAL g) /***********************************************************************/ int MAPFAM::InitDelete(PGLOBAL g, int fpos, int spos) { - Fpos = Memory + fpos; - Mempos = Memory + spos; + Fpos = Memory + (ptrdiff_t)fpos; + Mempos = Memory + (ptrdiff_t)spos; return RC_OK; } // end of InitDelete @@ -360,7 +358,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g) while (*Mempos++ != '\n') ; // What about Unix ??? // Set caller line buffer - len = (Mempos - Fpos) - Ending; + len = (Mempos - Fpos) - 1; + + // Don't rely on ENDING setting + if (len > 0 && *(Mempos - 2) == '\r') + len--; // Line ends by CRLF + memcpy(Tdbp->GetLine(), Fpos, len); Tdbp->GetLine()[len] = '\0'; return RC_OK; @@ -685,7 +688,7 @@ bool MPXFAM::SetPos(PGLOBAL g, int pos) /***********************************************************************/ int MPXFAM::InitDelete(PGLOBAL g, int fpos, int spos) { - Fpos = Memory + Headlen + fpos * Lrecl; + Fpos = Memory + Headlen + (ptrdiff_t)fpos * Lrecl; Mempos = Fpos + Lrecl; return RC_OK; } // end of InitDelete diff --git a/storage/connect/filamap.h b/storage/connect/filamap.h index 1d85fa36155..1d44239e610 100644 --- a/storage/connect/filamap.h +++ b/storage/connect/filamap.h @@ -104,7 +104,7 @@ class DllExport MPXFAM : public MBKFAM { virtual int MaxBlkSize(PGLOBAL g, int s) {return TXTFAM::MaxBlkSize(g, s);} virtual bool SetPos(PGLOBAL g, int recpos); - virtual int GetNextPos(void) {return (int)Fpos + Nrec;} + virtual int GetNextPos(void) {return GetPos() + 1;} virtual bool DeferReading(void) {return false;} virtual int ReadBuffer(PGLOBAL g); virtual int WriteBuffer(PGLOBAL g); diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index a214ab8acf2..98b8bb6fd95 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -63,8 +63,6 @@ #define DBFTYPE 3 /* value of bits 0 and 1 if .dbf */ #define EOH 0x0D /* end-of-header marker in .dbf file */ -extern "C" int trace; // The general trace value - /****************************************************************************/ /* First 32 bytes of a .dbf file. */ /* Note: some reserved fields are used here to store info (Fields) */ @@ -286,7 +284,8 @@ PQRYRES DBFColumns(PGLOBAL g, char *dp, const char *fn, bool info) break; default: if (!info) { - sprintf(g->Message, MSG(BAD_DBF_TYPE), thisfield.Type); + sprintf(g->Message, MSG(BAD_DBF_TYPE), thisfield.Type + , thisfield.Name); goto err; } // endif info @@ -587,7 +586,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g) case 'D': // Date break; default: // Should never happen - sprintf(g->Message, "Unsupported DBF type %c for column %s", + sprintf(g->Message, MSG(BAD_DBF_TYPE), c, cdp->GetName()); return true; } // endswitch c diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index 1fa72d52746..980d558eee5 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -52,7 +52,6 @@ #define INVALID_SET_FILE_POINTER 0xFFFFFFFF #endif -extern "C" int trace; extern int num_read, num_there, num_eq[2]; // Statistics /* --------------------------- Class FIXFAM -------------------------- */ @@ -131,18 +130,49 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g) /*******************************************************************/ /* For Insert the buffer must be prepared. */ /*******************************************************************/ - memset(To_Buf, ' ', Buflen); + if (Tdbp->GetFtype() == RECFM_BIN) { + // The buffer must be prepared depending on column types + int n = 0; + PDOSDEF defp = (PDOSDEF)Tdbp->GetDef(); + PCOLDEF cdp; - if (/*Tdbp->GetFtype() < 2 &&*/ !Padded) - // If not binary, the file is physically a text file. - // We do it also for binary table because the lrecl can have been + // Prepare the first line of the buffer + memset(To_Buf, 0, Buflen); + + for (cdp = defp->GetCols(); cdp; cdp = cdp->GetNext()) { + if (IsTypeNum(cdp->GetType())) + memset(To_Buf + cdp->GetOffset(), ' ', cdp->GetClen()); + + n = MY_MAX(n, cdp->GetPoff() + cdp->GetClen()); + } // endfor cdp + + // We do this for binary table because the lrecl can have been // specified with additional space to include line ending. - for (int len = Lrecl; len <= Buflen; len += Lrecl) { -#if defined(WIN32) - To_Buf[len - 2] = '\r'; -#endif // WIN32 - To_Buf[len - 1] = '\n'; - } // endfor len + if (n < Lrecl && Ending) { + To_Buf[Lrecl - 1] = '\n'; + + if (n < Lrecl - 1 && Ending == 2) + To_Buf[Lrecl - 2] = '\r'; + + } // endif n + + // Now repeat this for the whole buffer + for (int len = Lrecl; len <= Buflen - Lrecl; len += Lrecl) + memcpy(To_Buf + len, To_Buf, Lrecl); + + } else { + memset(To_Buf, ' ', Buflen); + + if (!Padded) + // The file is physically a text file. + for (int len = Lrecl; len <= Buflen; len += Lrecl) { + if (Ending == 2) + To_Buf[len - 2] = '\r'; + + To_Buf[len - 1] = '\n'; + } // endfor len + + } // endif Ftype Rbuf = Nrec; // To be used by WriteDB } // endif Insert @@ -205,7 +235,7 @@ int FIXFAM::WriteModifiedBlock(PGLOBAL g) // NOTE: Next line was added to avoid a very strange fread bug. // When the fseek is not executed (even the file has the good // pointer position) the next read can happen anywhere in the file. - OldBlk = CurBlk; // This will force fseek to be executed + OldBlk = -2; // This will force fseek to be executed Modif = 0; return rc; } // end of WriteModifiedBlock diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index dfd5a6638cf..675c021fe51 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -56,7 +56,6 @@ #endif extern int num_read, num_there, num_eq[2]; // Statistics -extern "C" int trace; /***********************************************************************/ /* Routine called externally by TXTFAM SortedRows functions. */ @@ -287,7 +286,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top) // *((int*)pp->Value) = *((int*)val); // break; case TYPE_VOID: - pp->Value = (void*)(intptr)*(int*)val; + pp->Intval = *(int*)val; break; // case TYPE_STRING: // pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1); @@ -538,7 +537,8 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) PDBUSER dbuserp = PlgGetUser(g); // This is required when using Unix files under Windows and vice versa - Bin = (Blocked || Ending != CRLF); +//Bin = (Blocked || Ending != CRLF); + Bin = true; // To avoid ftell problems switch (mode) { case MODE_READ: @@ -684,6 +684,7 @@ bool DOSFAM::RecordPos(PGLOBAL g) { if ((Fpos = ftell(Stream)) < 0) { sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); +// strcat(g->Message, " (possible wrong ENDING option value)"); return true; } // endif Fpos diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index b93adbd13dd..c449347bbcb 100755 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -64,7 +64,6 @@ extern int num_read, num_there; // Statistics static int num_write; -extern "C" int trace; #if defined(UNIX) // Add dummy strerror (NGC) @@ -388,15 +387,20 @@ bool VCTFAM::MakeEmptyFile(PGLOBAL g, char *fn) n = (Header == 1 || Header == 3) ? sizeof(VECHEADER) : 0; - if (lseek(h, n + MaxBlk * Nrec * Lrecl - 1, SEEK_SET) == -1) { - sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); - close(h); - return true; - } // endif h + if (lseek(h, n + MaxBlk * Nrec * Lrecl - 1, SEEK_SET) < 0) + goto err; + + // This actually fills the empty file + if (write(h, &c, 1) < 0) + goto err; - write(h, &c, 1); // This actually fills the empty file close(h); return false; + + err: + sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); + close(h); + return true; } // end of MakeEmptyFile /***********************************************************************/ @@ -3393,15 +3397,20 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, char *fn) htrc("MEF: pos=%lld n=%d maxblk=%d blksize=%d\n", pos, n, MaxBlk, Blksize); - if (lseek64(h, pos, SEEK_SET) < 0) { - sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); - close(h); - return true; - } // endif h + if (lseek64(h, pos, SEEK_SET) < 0) + goto err; - write(h, &c, 1); // This actually fills the empty file + // This actually fills the empty file + if (write(h, &c, 1) < 0) + goto err; + close(h); return false; + + err: + sprintf(g->Message, MSG(MAKE_EMPTY_FILE), To_File, strerror(errno)); + close(h); + return true; #endif // !WIN32 } // end of MakeEmptyFile diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index 8473011ab8b..1288689325c 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -62,7 +62,6 @@ /* DB static variables. */ /***********************************************************************/ extern int num_read, num_there, num_eq[]; // Statistics -extern "C" int trace; /* ------------------------------------------------------------------- */ diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h index 6d27cb67e81..edb8b5db323 100644 --- a/storage/connect/filamzip.h +++ b/storage/connect/filamzip.h @@ -1,170 +1,170 @@ -/************** FilAmZip H Declares Source Code File (.H) **************/ -/* Name: FILAMZIP.H Version 1.2 */ -/* */ -/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */ -/* */ -/* This file contains the GZIP access method classes declares. */ -/***********************************************************************/ -#ifndef __FILAMZIP_H -#define __FILAMZIP_H - -#include "zlib.h" - -typedef class ZIPFAM *PZIPFAM; -typedef class ZBKFAM *PZBKFAM; -typedef class ZIXFAM *PZIXFAM; -typedef class ZLBFAM *PZLBFAM; - -/***********************************************************************/ -/* This is the access method class declaration for not optimized */ -/* variable record length files compressed using the gzip library */ -/* functions. File is accessed record by record (row). */ -/***********************************************************************/ -class DllExport ZIPFAM : public TXTFAM { -// friend class DOSCOL; - public: - // Constructor - ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;} - ZIPFAM(PZIPFAM txfp); - - // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) - {return (PTXF)new(g) ZIPFAM(this);} - - // Methods - virtual void Reset(void); - virtual int GetFileLength(PGLOBAL g); - virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;} - virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual bool SetPos(PGLOBAL g, int recpos); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual bool OpenTableFile(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); - - protected: - int Zerror(PGLOBAL g); // GZ error function - - // Members - gzFile Zfile; // Points to GZ file structure - z_off_t Zpos; // Uncompressed file position - }; // end of class ZIPFAM - -/***********************************************************************/ -/* This is the access method class declaration for optimized variable */ -/* record length files compressed using the gzip library functions. */ -/* The File is accessed by block (requires an opt file). */ -/***********************************************************************/ -class DllExport ZBKFAM : public ZIPFAM { - public: - // Constructor - ZBKFAM(PDOSDEF tdp); - ZBKFAM(PZBKFAM txfp); - - // Implementation - virtual int GetPos(void); - virtual int GetNextPos(void) {return 0;} - virtual PTXF Duplicate(PGLOBAL g) - {return (PTXF)new(g) ZBKFAM(this);} - - // Methods - virtual int Cardinality(PGLOBAL g); - virtual int MaxBlkSize(PGLOBAL g, int s); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int GetRowID(void); - virtual bool RecordPos(PGLOBAL g); - virtual int SkipRecord(PGLOBAL g, bool header); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual int DeleteRecords(PGLOBAL g, int irc); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); - - protected: - // Members - char *CurLine; // Position of current line in buffer - char *NxtLine; // Position of Next line in buffer - bool Closing; // True when closing on Insert - }; // end of class ZBKFAM - -/***********************************************************************/ -/* This is the access method class declaration for fixed record */ -/* length files compressed using the gzip library functions. */ -/* The file is always accessed by block. */ -/***********************************************************************/ -class DllExport ZIXFAM : public ZBKFAM { - public: - // Constructor - ZIXFAM(PDOSDEF tdp); - ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {} - - // Implementation - virtual int GetNextPos(void) {return 0;} - virtual PTXF Duplicate(PGLOBAL g) - {return (PTXF)new(g) ZIXFAM(this);} - - // Methods - virtual int Cardinality(PGLOBAL g); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - - protected: - // No additional Members - }; // end of class ZIXFAM - -/***********************************************************************/ -/* This is the DOS/UNIX Access Method class declaration for PlugDB */ -/* fixed/variable files compressed using the zlib library functions. */ -/* Physically these are written and read using the same technique */ -/* than blocked variable files, only the contain of each block is */ -/* compressed using the deflate zlib function. The purpose of this */ -/* specific format is to have a fast mechanism for direct access of */ -/* records so blocked optimization is fast and direct access (joins) */ -/* is allowed. Note that the block length is written ahead of each */ -/* block to enable reading when optimization file is not available. */ -/***********************************************************************/ -class DllExport ZLBFAM : public BLKFAM { - public: - // Constructor - ZLBFAM(PDOSDEF tdp); - ZLBFAM(PZLBFAM txfp); - - // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;} - virtual int GetPos(void); - virtual int GetNextPos(void); - virtual PTXF Duplicate(PGLOBAL g) - {return (PTXF)new(g) ZLBFAM(this);} - inline void SetOptimized(bool b) {Optimized = b;} - - // Methods - virtual int GetFileLength(PGLOBAL g); +/************** FilAmZip H Declares Source Code File (.H) **************/ +/* Name: FILAMZIP.H Version 1.2 */ +/* */ +/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */ +/* */ +/* This file contains the GZIP access method classes declares. */ +/***********************************************************************/ +#ifndef __FILAMZIP_H +#define __FILAMZIP_H + +#include "zlib.h" + +typedef class ZIPFAM *PZIPFAM; +typedef class ZBKFAM *PZBKFAM; +typedef class ZIXFAM *PZIXFAM; +typedef class ZLBFAM *PZLBFAM; + +/***********************************************************************/ +/* This is the access method class declaration for not optimized */ +/* variable record length files compressed using the gzip library */ +/* functions. File is accessed record by record (row). */ +/***********************************************************************/ +class DllExport ZIPFAM : public TXTFAM { +// friend class DOSCOL; + public: + // Constructor + ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;} + ZIPFAM(PZIPFAM txfp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} + virtual int GetPos(void); + virtual int GetNextPos(void); + virtual PTXF Duplicate(PGLOBAL g) + {return (PTXF)new(g) ZIPFAM(this);} + + // Methods + virtual void Reset(void); + virtual int GetFileLength(PGLOBAL g); + virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;} + virtual int MaxBlkSize(PGLOBAL g, int s) {return s;} + virtual bool AllocateBuffer(PGLOBAL g); + virtual int GetRowID(void); + virtual bool RecordPos(PGLOBAL g); virtual bool SetPos(PGLOBAL g, int recpos); - virtual bool AllocateBuffer(PGLOBAL g); - virtual int ReadBuffer(PGLOBAL g); - virtual int WriteBuffer(PGLOBAL g); - virtual void CloseTableFile(PGLOBAL g, bool abort); - virtual void Rewind(void); - - protected: - bool WriteCompressedBuffer(PGLOBAL g); - int ReadCompressedBuffer(PGLOBAL g, void *rdbuf); - - // Members - z_streamp Zstream; // Compression/decompression stream - Byte *Zbuffer; // Compressed block buffer - int *Zlenp; // Pointer to block length - bool Optimized; // true when opt file is available - }; // end of class ZLBFAM - -#endif // __FILAMZIP_H + virtual int SkipRecord(PGLOBAL g, bool header); + virtual bool OpenTableFile(PGLOBAL g); + virtual int ReadBuffer(PGLOBAL g); + virtual int WriteBuffer(PGLOBAL g); + virtual int DeleteRecords(PGLOBAL g, int irc); + virtual void CloseTableFile(PGLOBAL g, bool abort); + virtual void Rewind(void); + + protected: + int Zerror(PGLOBAL g); // GZ error function + + // Members + gzFile Zfile; // Points to GZ file structure + z_off_t Zpos; // Uncompressed file position + }; // end of class ZIPFAM + +/***********************************************************************/ +/* This is the access method class declaration for optimized variable */ +/* record length files compressed using the gzip library functions. */ +/* The File is accessed by block (requires an opt file). */ +/***********************************************************************/ +class DllExport ZBKFAM : public ZIPFAM { + public: + // Constructor + ZBKFAM(PDOSDEF tdp); + ZBKFAM(PZBKFAM txfp); + + // Implementation + virtual int GetPos(void); + virtual int GetNextPos(void) {return 0;} + virtual PTXF Duplicate(PGLOBAL g) + {return (PTXF)new(g) ZBKFAM(this);} + + // Methods + virtual int Cardinality(PGLOBAL g); + virtual int MaxBlkSize(PGLOBAL g, int s); + virtual bool AllocateBuffer(PGLOBAL g); + virtual int GetRowID(void); + virtual bool RecordPos(PGLOBAL g); + virtual int SkipRecord(PGLOBAL g, bool header); + virtual int ReadBuffer(PGLOBAL g); + virtual int WriteBuffer(PGLOBAL g); + virtual int DeleteRecords(PGLOBAL g, int irc); + virtual void CloseTableFile(PGLOBAL g, bool abort); + virtual void Rewind(void); + + protected: + // Members + char *CurLine; // Position of current line in buffer + char *NxtLine; // Position of Next line in buffer + bool Closing; // True when closing on Insert + }; // end of class ZBKFAM + +/***********************************************************************/ +/* This is the access method class declaration for fixed record */ +/* length files compressed using the gzip library functions. */ +/* The file is always accessed by block. */ +/***********************************************************************/ +class DllExport ZIXFAM : public ZBKFAM { + public: + // Constructor + ZIXFAM(PDOSDEF tdp); + ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {} + + // Implementation + virtual int GetNextPos(void) {return 0;} + virtual PTXF Duplicate(PGLOBAL g) + {return (PTXF)new(g) ZIXFAM(this);} + + // Methods + virtual int Cardinality(PGLOBAL g); + virtual bool AllocateBuffer(PGLOBAL g); + virtual int ReadBuffer(PGLOBAL g); + virtual int WriteBuffer(PGLOBAL g); + + protected: + // No additional Members + }; // end of class ZIXFAM + +/***********************************************************************/ +/* This is the DOS/UNIX Access Method class declaration for PlugDB */ +/* fixed/variable files compressed using the zlib library functions. */ +/* Physically these are written and read using the same technique */ +/* than blocked variable files, only the contain of each block is */ +/* compressed using the deflate zlib function. The purpose of this */ +/* specific format is to have a fast mechanism for direct access of */ +/* records so blocked optimization is fast and direct access (joins) */ +/* is allowed. Note that the block length is written ahead of each */ +/* block to enable reading when optimization file is not available. */ +/***********************************************************************/ +class DllExport ZLBFAM : public BLKFAM { + public: + // Constructor + ZLBFAM(PDOSDEF tdp); + ZLBFAM(PZLBFAM txfp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;} + virtual int GetPos(void); + virtual int GetNextPos(void); + virtual PTXF Duplicate(PGLOBAL g) + {return (PTXF)new(g) ZLBFAM(this);} + inline void SetOptimized(bool b) {Optimized = b;} + + // Methods + virtual int GetFileLength(PGLOBAL g); + virtual bool SetPos(PGLOBAL g, int recpos); + virtual bool AllocateBuffer(PGLOBAL g); + virtual int ReadBuffer(PGLOBAL g); + virtual int WriteBuffer(PGLOBAL g); + virtual void CloseTableFile(PGLOBAL g, bool abort); + virtual void Rewind(void); + + protected: + bool WriteCompressedBuffer(PGLOBAL g); + int ReadCompressedBuffer(PGLOBAL g, void *rdbuf); + + // Members + z_streamp Zstream; // Compression/decompression stream + Byte *Zbuffer; // Compressed block buffer + int *Zlenp; // Pointer to block length + bool Optimized; // true when opt file is available + }; // end of class ZLBFAM + +#endif // __FILAMZIP_H diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp index 9212432cdde..949d49c2943 100644 --- a/storage/connect/filter.cpp +++ b/storage/connect/filter.cpp @@ -39,11 +39,6 @@ //#include "select.h" #include "xindex.h" -/***********************************************************************/ -/* Static variables. */ -/***********************************************************************/ -extern "C" int trace; - /***********************************************************************/ /* Utility routines. */ /***********************************************************************/ @@ -63,7 +58,7 @@ static PPARM MakeParm(PGLOBAL g, PXOB xp) } // end of MakeParm /***********************************************************************/ -/* Routines called externally by FILTER function. */ +/* Routines called internally/externally by FILTER functions. */ /***********************************************************************/ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); //bool ReadSubQuery(PGLOBAL, PSUBQ); @@ -72,6 +67,32 @@ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); BYTE OpBmp(PGLOBAL g, OPVAL opc); PARRAY MakeValueArray(PGLOBAL g, PPARM pp); +/***********************************************************************/ +/* Returns the bitmap representing the conditions that must not be */ +/* met when returning from TestValue for a given operator. */ +/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */ +/***********************************************************************/ +BYTE OpBmp(PGLOBAL g, OPVAL opc) + { + BYTE bt; + + switch (opc) { + case OP_IN: + case OP_EQ: bt = 0x06; break; + case OP_NE: bt = 0x01; break; + case OP_GT: bt = 0x03; break; + case OP_GE: bt = 0x02; break; + case OP_LT: bt = 0x05; break; + case OP_LE: bt = 0x04; break; + case OP_EXIST: bt = 0x00; break; + default: + sprintf(g->Message, MSG(BAD_FILTER_OP), opc); + longjmp(g->jumper[g->jump_level], TYPE_ARRAY); + } // endswitch opc + + return bt; + } // end of OpBmp + /***********************************************************************/ /* Routines called externally by CondFilter. */ /***********************************************************************/ @@ -80,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2) PFIL filp = new(g) FILTER(g, vop); filp->Arg(0) = fp1; - filp->Arg(1) = fp2; + filp->Arg(1) = (fp2) ? fp2 : pXVOID; if (filp->Convert(g, false)) return NULL; diff --git a/storage/connect/frcas.h b/storage/connect/frcas.h new file mode 100644 index 00000000000..e9401d475ae --- /dev/null +++ b/storage/connect/frcas.h @@ -0,0 +1,320 @@ + case MSG_ACCESS_VIOLATN: p = "Violation accès mémoire"; break; + case MSG_ADD_BAD_TYPE: p = "Ajout d'une valeur de type %s non conforme dans un tableau %s"; break; + case MSG_ALLOC_ERROR: p = "Erreur d'allocation de %s"; break; + case MSG_ANSWER_TYPE: p = "Réponse de type"; break; + case MSG_API_CONF_ERROR: p = "Erreur SQL: API_CONFORMANCE"; break; + case MSG_APPL_NOT_INIT: p = "Application non initialisée"; break; + case MSG_ARRAY_BNDS_EXCD: p = "Hors limite de tableau"; break; + case MSG_BAD_ARRAY_OPER: p = "Les tableaux doivent utiliser l'opérateur IN"; break; + case MSG_BAD_ARRAY_TYPE: p = "Type=%d invalide pour un tableau"; break; + case MSG_BAD_ARRAY_VAL: p = "Les tableaux doivent avoir le même nombre de valeurs"; break; + case MSG_BAD_BIN_FMT: p = "Format invalide %c pour la colonne BIN %s"; break; + case MSG_BAD_BLK_ESTIM: p = "Nombre de blocs supérieur à l'estimation"; break; + case MSG_BAD_BLK_SIZE: p = "Taille du bloc %d non conforme"; break; + case MSG_BAD_BYTE_NUM: p = "Le nombre d'octets écrits est faux"; break; + case MSG_BAD_BYTE_READ: p = "Le nombre d'octets lus est faux"; break; + case MSG_BAD_COL_TYPE: p = "Type invalide %s pour la colonne %s"; break; + case MSG_BAD_COL_XPATH: p = "Xpath invalide colonne %s de la table HTML %s"; break; + case MSG_BAD_CONST_TYPE: p = "Type=%d invalide pour une constante"; break; + case MSG_BAD_CONV_TYPE: p = "Convertion de type invalide %d"; break; + case MSG_BAD_DATETIME: p = "Valeur date/temps invalide"; break; + case MSG_BAD_DBF_FILE: p = "Le fichier DBF %s est altéré"; break; + case MSG_BAD_DBF_REC: p = "Fichier DBF %s altéré enregistrement %d"; break; + case MSG_BAD_DBF_TYPE: p = "Type DBF %c non supporté colonne %s"; break; + case MSG_BAD_DIRECTORY: p = "Répertoire invalide %s: %s"; break; + case MSG_BAD_FIELD_RANK: p = "Rang %d invalide pour la colonne %s"; break; + case MSG_BAD_FIELD_TYPE: p = "Mauvais type de champ %s"; break; + case MSG_BAD_FILE_HANDLE: p = "Handle de fichier invalide: %s"; break; + case MSG_BAD_FILTER: p = "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d"; break; + case MSG_BAD_FILTER_CONV: p = "Conversion filtre incorrecte, B_T=%d,%d"; break; + case MSG_BAD_FILTER_OP: p = "Opérateur de filtre invalide %d"; break; + case MSG_BAD_FLD_FORMAT: p = "Format invalide pour le champs %d de %s"; break; + case MSG_BAD_FLD_LENGTH: p = "Champs %s trop long (%s --> %d) ligne %d de %s"; break; + case MSG_BAD_FREQ_SET: p = "Spécification erronnée de Freq pour la colonne %s"; break; + case MSG_BAD_FUNC_MODE: p = "%s: mode invalide %d"; break; + case MSG_BAD_HANDLE_VAL: p = "Valeur Handle invalide"; break; + case MSG_BAD_HEADER: p = "Fichier %s: bloc en-tête altéré"; break; + case MSG_BAD_HEAD_END: p = "Lecture fin d'en-tête impossible"; break; + case MSG_BAD_INDEX_FILE: p = "Fichier index %s corrompu"; break; + case MSG_BAD_LINEFLD_FMT: p = "Format invalide ligne %d champs %d de %s"; break; + case MSG_BAD_LINE_LEN: p = "Longueur ligne non égale à Lrecl"; break; + case MSG_BAD_LRECL: p = "Disparité lrecl table/fichier (%d,%hd)"; break; + case MSG_BAD_NODE_TYPE: p = "Type noeud erroné pour la table"; break; + case MSG_BAD_OFFSET_VAL: p = "Nul offset invalide pour une table CSV"; break; + case MSG_BAD_OPEN_MODE: p = "Mode d'ouverture invalide %d"; break; + case MSG_BAD_PARAM_TYPE: p = "%.8s: Paramètre de type=%d invalide"; break; + case MSG_BAD_PARM_COUNT: p = "Nombre de paramètres incohérent"; break; + case MSG_BAD_QUOTE_FIELD: p = "Quote manquante dans %s champs %d ligne %d"; break; + case MSG_BAD_READ_NUMBER: p = "Mauvais nombre %d de valeurs lues dans %s"; break; + case MSG_BAD_RECFM: p = "Recfm type %d invalide pour DOSCOL"; break; + case MSG_BAD_RECFM_VAL: p = "Valeur invalide %d de Recfm"; break; + case MSG_BAD_SET_CASE: p = "La casse d'un tableau ne peut pas passer de non respect à respecter"; break; + case MSG_BAD_SET_STRING: p = "SetValue: appel invalide pour STRING"; break; + case MSG_BAD_SPECIAL_COL: p = "Colonne spéciale invalide %s"; break; + case MSG_BAD_SPEC_COLUMN: p = "Colonne spéciale invalide pour ce type de table"; break; + case MSG_BAD_TABLE_TYPE: p = "Type invalide %s pour la table %s"; break; + case MSG_BAD_TYPE_LIKE: p = "Type(%d)= %d invalide pour LIKE"; break; + case MSG_BAD_VALBLK_INDX: p = "Valeur hors limites de l'index du bloc de valeurs"; break; + case MSG_BAD_VALBLK_TYPE: p = "Type=%d invalide pour un bloc de valeurs"; break; + case MSG_BAD_VALNODE: p = "Type %d invalide pour le noeud valeur colonne %s"; break; + case MSG_BAD_VALUE_TYPE: p = "Type de valeur invalide %d"; break; + case MSG_BAD_VAL_UPDATE: p = "Impossible de déterminer quelle valeur %s doit être mise à jour"; break; + case MSG_BAS_NS_LIST: p = "Format invalide de la liste des espace-noms"; break; + case MSG_BIN_F_TOO_LONG: p = "Valeur trop longue pour le champ %s (%d --> %d)"; break; + case MSG_BIN_MODE_FAIL: p = "Echec mode binaire: %s"; break; + case MSG_BLKTYPLEN_MISM: p = "Disparité types/longueurs de bloc dans SetValue"; break; + case MSG_BLK_IS_NULL: p = "Blk est nul"; break; + case MSG_BREAKPOINT: p = "Point de contrôle"; break; + case MSG_BUILD_INDEX: p = "Construction index %s sur %s"; break; + case MSG_CANNOT_OPEN: p = "Ouverture impossible de %s"; break; + case MSG_CHSIZE_ERROR: p = "Erreur dans chsize: %s"; break; + case MSG_COL_ALLOC_ERR: p = "Allocation impossible du noeud colonne"; break; + case MSG_COL_ISNOT_TABLE: p = "La colonne %s n'est pas dans la table %s"; break; + case MSG_COL_NOT_SORTED: p = "La colonne %s de la table %s n'est pas triée"; break; + case MSG_COL_NUM_MISM: p = "Disparité du nombre de colonnes"; break; + case MSG_COM_ERROR: p = "Erreur Com"; break; + case MSG_CONCAT_SUBNODE: p = "Concaténation de sous-noeuds impossible"; break; + case MSG_CONNECT_CANCEL: p = "Connection interrompue par l'utilisateur"; break; + case MSG_CONTROL_C_EXIT: p = "Exit par Ctrl-C"; break; + case MSG_DATABASE_LOADED: p = "Base de données %s chargée"; break; + case MSG_DATA_MISALIGN: p = "Mauvais alignement pour ce type de données"; break; + case MSG_DBASE_FILE: p = "Fichier dBASE dbf: "; break; + case MSG_DEF_ALLOC_ERROR: p = "Erreur d'allocation de la classe DEF %s"; break; + case MSG_DEL_FILE_ERR: p = "Erreur à l'effacement de %s"; break; + case MSG_DEL_READ_ERROR: p = "Delete: erreur en lecture req=%d len=%d"; break; + case MSG_DEL_WRITE_ERROR: p = "Delete: erreur en écriture: %s"; break; + case MSG_DEPREC_FLAG: p = "Option Flag périmée, utiliser Coltype"; break; + case MSG_DLL_LOAD_ERROR: p = "Erreur %d au chargement du module %s"; break; + case MSG_DOM_NOT_SUPP: p = "MS-DOM non supporté par cette version"; break; + case MSG_DVAL_NOTIN_LIST: p = "Valeur %s non trouvée dans la liste des valeurs distinctes de la colonne %s"; break; + case MSG_EMPTY_DOC: p = "Document vide"; break; + case MSG_EMPTY_FILE: p = "%s du fichier vide %s: "; break; + case MSG_EOF_AFTER_LINE: p = "Fin de fichier après la ligne %d"; break; + case MSG_EOF_INDEX_FILE: p = "EOF lisant le fichier index"; break; + case MSG_ERROR_IN_LSK: p = "Erreur %d dans lseek64"; break; + case MSG_ERROR_IN_SFP: p = "Erreur %d dans SetFilePointer"; break; + case MSG_ERR_READING_REC: p = "Erreur lisant l'enregistrement %d de %s"; break; + case MSG_FAIL_ADD_NODE: p = "L'ajout du noeud %s dans la table a échoué"; break; + case MSG_FETCH_NO_RES: p = "Fetch: Pas de Résultats"; break; + case MSG_FIELD_TOO_LONG: p = "Valeur trop longue pour le champs %d ligne %d"; break; + case MSG_FILELEN_ERROR: p = "Erreur dans %s pour %s"; break; + case MSG_FILE_IS_EMPTY: p = "Le fichier %s est vide"; break; + case MSG_FILE_MAP_ERR: p = "Erreur de File mapping"; break; + case MSG_FILE_MAP_ERROR: p = "CreateFileMapping %s erreur rc=%d"; break; + case MSG_FILE_OPEN_YET: p = "Fichier %s déjà ouvert"; break; + case MSG_FILE_UNFOUND: p = "Fichier %s non trouvé"; break; + case MSG_FLD_TOO_LNG_FOR: p = "Champs %d trop long pour %s ligne %d de %s"; break; + case MSG_FLT_BAD_RESULT: p = "Virgule flottante: résultat inexacte"; break; + case MSG_FLT_DENORMAL_OP: p = "Opérande virgule flottante non normalisé"; break; + case MSG_FLT_INVALID_OP: p = "Opération virgule flottante invalide"; break; + case MSG_FLT_OVERFLOW: p = "Dépassement de capacité virgule flottante"; break; + case MSG_FLT_STACK_CHECK: p = "Virgule flottante: Erreur de la pile"; break; + case MSG_FLT_UNDERFLOW: p = "Sous-dépassement de capacité virgule flottante"; break; + case MSG_FLT_ZERO_DIVIDE: p = "Virgule flottante: division par zéro"; break; + case MSG_FMT_WRITE_NIY: p = "L'écriture des fichiers %s n'est pas encore implémentée"; break; + case MSG_FOXPRO_FILE: p = "Fichier FoxPro: "; break; + case MSG_FPUTS_ERROR: p = "Erreur dans fputs: %s"; break; + case MSG_FSEEK_ERROR: p = "Erreur dans fseek: %s"; break; + case MSG_FSETPOS_ERROR: p = "Erreur dans fseek pour i=%d"; break; + case MSG_FTELL_ERROR: p = "Erreur dans ftell enregistrement=%d: %s"; break; + case MSG_FUNCTION_ERROR: p = "Erreur dans %s: %d"; break; + case MSG_FUNC_ERRNO: p = "Erreur %d dans %s"; break; + case MSG_FUNC_ERROR: p = "Erreur dans %s"; break; + case MSG_FUNC_ERR_S: p = "Erreur dans %s: %s"; break; + case MSG_FWRITE_ERROR: p = "Erreur dans fwrite: %s"; break; + case MSG_GET_DIST_VALS: p = "Récupération des valeurs distinctes de "; break; + case MSG_GET_FUNC_ERR: p = "Erreur en recherche de la fonction %s: %s"; break; + case MSG_GLOBAL_ERROR: p = "Erreur d'allocation de Global (taille=%d)\n"; break; + case MSG_GUARD_PAGE: p = "Violation de page de garde"; break; + case MSG_GZOPEN_ERROR: p = "gzopen %s: erreur %d sur %s"; break; + case MSG_ILLEGAL_INSTR: p = "Instruction illégale"; break; + case MSG_ILL_FILTER_CONV: p = "Conversion implicite illégale dans un filtre"; break; + case MSG_INDEX_NOT_UNIQ: p = "L'index n'est pas Unique"; break; + case MSG_INDEX_YET_ON: p = "L'index %s existe déjà sur %s"; break; + case MSG_INDX_COL_NOTIN: p = "La colonne index %s n'existe pas dans la table %s"; break; + case MSG_INDX_EXIST_YET: p = "L'entrée index existe déjà"; break; + case MSG_INIT_FAILED: p = "L'initialisation de %s a échoué"; break; + case MSG_INT_COL_ERROR: p = "Erreur interne sur la colonne index %s"; break; + case MSG_INT_OVERFLOW: p = "Dépassement de capacité sur entier"; break; + case MSG_INT_ZERO_DIVIDE: p = "Division entière par zéro"; break; + case MSG_INVALID_DISP: p = "Disposition invalide"; break; + case MSG_INVALID_FTYPE: p = "SBV: Ftype %d invalide"; break; + case MSG_INVALID_HANDLE: p = "Poignée invalide"; break; + case MSG_INVALID_OPER: p = "Opérateur invalide %d pour %s"; break; + case MSG_INV_COLUMN_TYPE: p = "Type %d Invalide pour la colonne %s"; break; + case MSG_INV_COL_TYPE: p = "Type de colonne %s invalide"; break; + case MSG_INV_DEF_READ: p = "Lecture différée invalide rc=%d"; break; + case MSG_INV_DIRCOL_OFST: p = "Offset invalide pour une colonne DIR"; break; + case MSG_INV_MAP_POS: p = "Position mémoire invalide"; break; + case MSG_INV_RAND_ACC: p = "L'accès aléatoire d'une table non optimisée est impossible"; break; + case MSG_INV_REC_POS: p = "Position d'enregistrement invalide"; break; + case MSG_INV_RESULT_TYPE: p = "Type de résultat invalide %s"; break; + case MSG_INV_UPDT_TABLE: p = "Table %s invalide pour Update"; break; + case MSG_IN_WITHOUT_SUB: p = "IN ou EXISTS sans tableau ou subquery"; break; + case MSG_KEY_ALLOC_ERR: p = "Erreur d'allocation d'un bloc offset clé"; break; + case MSG_KEY_ALLOC_ERROR: p = "Erreur d'allocation mémoire, Klen=%d n=%d"; break; + case MSG_LINE_TOO_LONG: p = "La nouvelle ligne est trop longue"; break; + case MSG_LIST: p = "--Liste--"; break; + case MSG_LOADING_FAILED: p = "Le chargement de %s a échoué"; break; + case MSG_LRECL_TOO_SMALL: p = "Lrecl trop petit (longueur en-tête = %d)"; break; + case MSG_MAKE_EMPTY_FILE: p = "Génération du fichier vide %s: %s"; break; + case MSG_MAKING: p = "Génération"; break; + case MSG_MALLOC_ERROR: p = "Allocation mémoire impossible par %s"; break; + case MSG_MAP_VIEW_ERROR: p = "MapViewOfFile %s erreur rc=%d"; break; + case MSG_MAXSIZE_ERROR: p = "Maxsize incalculable sur table ouverte"; break; + case MSG_MEM_ALLOC_ERR: p = "Erreur d'allocation mémoire, taille %s = %d"; break; + case MSG_MEM_ALLOC_ERROR: p = "Erreur d'allocation mémoire"; break; + case MSG_MISPLACED_QUOTE: p = "Appostrophe mal placée ligne %d"; break; + case MSG_MISSING_ARG: p = "Argument manquant pour l'opérateur %d"; break; + case MSG_MISSING_FIELD: p = "Champs %d manquant dans %s ligne %d"; break; + case MSG_MISSING_FNAME: p = "Nom du fichier manquant"; break; + case MSG_MISSING_NODE: p = "Noeud %s manquant dans %s"; break; + case MSG_MISSING_ROWNODE: p = "Impossible de trouver le noeud de la ligne %d"; break; + case MSG_MIS_TAG_LIST: p = "Liste des balises colonne manquante"; break; + case MSG_MUL_MAKECOL_ERR: p = "Erreur logique dans TABMUL::MakeCol"; break; + case MSG_NAME_CONV_ERR: p = "Erreur de convertion du nom de noeud"; break; + case MSG_NEW_DOC_FAILED: p = "Impossible de créer le nouveau document"; break; + case MSG_NEW_RETURN_NULL: p = "NULL renvoyé par New dans PlugEvalLike"; break; + case MSG_NEXT_FILE_ERROR: p = "Erreur en recherche du fichier suivant. rc=%s"; break; + case MSG_NONCONT_EXCEPT: p = "Exception non-continuable"; break; + case MSG_NOP_ZLIB_INDEX: p = "L'indexage d'une table zlib non optimisée est impossible"; break; + case MSG_NOT_A_DBF_FILE: p = "Le fichier n'a pas le format dBASE dbf "; break; + case MSG_NOT_FIXED_LEN: p = "Fichier %s non fixe, len=%d lrecl=%d"; break; + case MSG_NO_0DH_HEAD: p = "0DH manquant en fin d'en-tête (dbc=%d)"; break; + case MSG_NO_ACTIVE_DB: p = "Pas de base de données active"; break; + case MSG_NO_CHAR_FROM: p = "Conversion de type %d en caractères impossible"; break; + case MSG_NO_DATE_FMT: p = "Pas de format date pour le valblock de type %d"; break; + case MSG_NO_DEF_FNCCOL: p = "Colonne fonction par défaut introuvable"; break; + case MSG_NO_DEF_PIVOTCOL: p = "Colonne pivot par défaut introuvable"; break; + case MSG_NO_DIR_INDX_RD: p = "Pas d'accès directe des tables %s"; break; + case MSG_NO_FEAT_SUPPORT: p = "%s non supporté dans cette version"; break; + case MSG_NO_FLD_FORMAT: p = "Format absent pour le champs %d de %s"; break; + case MSG_NO_FORMAT_COL: p = "Type COLUMN informattable"; break; + case MSG_NO_FORMAT_TYPE: p = "Le format ne peut pas être défini à partir du type %d"; break; + case MSG_NO_INDEX_READ: p = "Pas d'accès directe des tables multiples"; break; + case MSG_NO_KEY_COL: p = "Pas de colonne clé trouvée"; break; + case MSG_NO_KEY_UPDATE: p = "Le nom des clés ne peut pas être modifié"; break; + case MSG_NO_MAP_INSERT: p = "MAP incompatible avec Insert"; break; + case MSG_NO_MATCHING_COL: p = "Pas de colonne correspondant à %s dans %s"; break; + case MSG_NO_MATCH_COL: p = "Colonne correspondante introuvable"; break; + case MSG_NO_MEMORY: p = "Mémoire pleine"; break; + case MSG_NO_MODE_PADDED: p = "Mode non supporté pour les fichiers 'padded'"; break; + case MSG_NO_MUL_VCT: p = "Les tables VCT ne peuvent pas être multiples"; break; + case MSG_NO_ODBC_DELETE: p = "Delete ne devrait pas être appelé pour les tables ODBC"; break; + case MSG_NO_ODBC_DIRECT: p = "Accès directe des tables ODBC non encore implémenté"; break; + case MSG_NO_ODBC_MUL: p = "Multiple(2) non supporté pour les tables ODBC"; break; + case MSG_NO_ODBC_SPECOL: p = "Pas de colonne spéciale ODBC"; break; + case MSG_NO_PART_DEL: p = "Delete partiel des fichier %s impossible"; break; + case MSG_NO_PART_MAP: p = "Mapping partiel non implémenté pour cet OS"; break; + case MSG_NO_PAR_BLK_INS: p = "Insertion de bloc partiel impossible"; break; + case MSG_NO_PIV_DIR_ACC: p = "Pas d'accès directe aux tables PIVOT"; break; + case MSG_NO_READ_32: p = "Lecture de 32 octets impossible"; break; + case MSG_NO_RECOV_SPACE: p = "Espace non recouvrable dans le fichier index"; break; + case MSG_NO_ROWID_FOR_AM: p = "Accès direct impossible de ROWID pour les tables de type %s"; break; + case MSG_NO_ROW_NODE: p = "Le nom du Rownode n'est pas défini"; break; + case MSG_NO_SECTION_NAME: p = "Nom de section manquant"; break; + case MSG_NO_SEC_UPDATE: p = "Les noms de section ne peuvent pas être modifiés"; break; + case MSG_NO_SETPOS_YET: p = "SetPos pas encore implémenté pour les fichier %s"; break; + case MSG_NO_SPEC_COL: p = "Pas de colonne spéciales MYSQL"; break; + case MSG_NO_SUB_VAL: p = "Pas de sous-value d'un tableau de type %d"; break; + case MSG_NO_TABCOL_DATA: p = "Pas de données pour la table %s colonne %s"; break; + case MSG_NO_TABLE_DEL: p = "Delete non autorisé pour les tables %s "; break; + case MSG_NO_TAB_DATA: p = "Pas de données pour la table %s"; break; + case MSG_NO_VCT_DELETE: p = "Délétion Partielle non implémentée pour les fichiers VCT"; break; + case MSG_NO_ZIP_DELETE: p = "Delete sur fichier Zip non encore implementé"; break; + case MSG_OPENING: p = "Ouverture"; break; + case MSG_OPEN_EMPTY_FILE: p = "Ouverture du fichier vide %s: %s"; break; + case MSG_OPEN_ERROR: p = "Erreur d'ouverture %d en mode %d sur %s: "; break; + case MSG_OPEN_ERROR_IS: p = "Erreur à l'ouverture de %s: %s"; break; + case MSG_OPEN_MODE_ERROR: p = "Erreur d'ouverture(%s) %d sur %s"; break; + case MSG_OPEN_STRERROR: p = "Erreur à l'ouverture: %s"; break; + case MSG_OPTBLK_RD_ERR: p = "Erreur à la lecture d'un bloc optimisation: %s"; break; + case MSG_OPTBLK_WR_ERR: p = "Erreur à l'écriture d'un bloc optimisation: %s"; break; + case MSG_OPTIMIZING: p = "Optimisation de "; break; + case MSG_OPT_BMAP_RD_ERR: p = "Erreur en lecture des bitmaps d'optimisation: %s"; break; + case MSG_OPT_BMAP_WR_ERR: p = "Erreur en écriture des bitmaps d'optimisation: %s"; break; + case MSG_OPT_CANCELLED: p = "Optimisation interrompue par l'utilisateur"; break; + case MSG_OPT_DVAL_RD_ERR: p = "Erreur en lecture des valeurs distinctes: %s"; break; + case MSG_OPT_DVAL_WR_ERR: p = "Erreur en écriture des valeurs distinctes: %s"; break; + case MSG_OPT_HEAD_RD_ERR: p = "Erreur en lecture de l'entête du fichier opt: %s"; break; + case MSG_OPT_HEAD_WR_ERR: p = "Erreur en écriture de l'entête du fichier opt: %s"; break; + case MSG_OPT_LOGIC_ERR: p = "Erreur logique dans SetBitmap, i=%d"; break; + case MSG_OPT_MAX_RD_ERR: p = "Erreur en lecture des valeurs maxi: %s"; break; + case MSG_OPT_MAX_WR_ERR: p = "Erreur en écriture des valeurs maxi: %s"; break; + case MSG_OPT_MIN_RD_ERR: p = "Erreur en lecture des valeurs mini: %s"; break; + case MSG_OPT_MIN_WR_ERR: p = "Erreur en écriture des valeurs mini: %s"; break; + case MSG_OPT_NOT_MATCH: p = "Le fichier opt %s n'est pas à jour"; break; + case MSG_PAGE_ERROR: p = "Erreur de pagination"; break; + case MSG_PARM_CNT_MISS: p = "Disparité du nombre de Paramètres"; break; + case MSG_PREC_VBLP_NULL: p = "ARRAY SetPrecision: Vblp est NULL"; break; + case MSG_PRIV_INSTR: p = "Instruction privilégiée"; break; + case MSG_PROCADD_ERROR: p = "Erreur %d sur l'adresse de %s"; break; + case MSG_QUERY_CANCELLED: p = "Requête interrompue par l'utilisateur"; break; + case MSG_RANGE_NO_JOIN: p = "Range non compatible avec les index de jointure"; break; + case MSG_RC_READING: p = "rc=%d en lecture de la table %s"; break; + case MSG_READY: p = "Prêt"; break; + case MSG_READ_ERROR: p = "Erreur en lecture sur %s: %s"; break; + case MSG_READ_ONLY: p = "Cette table protégée en lecture seule ne peut être modifiée"; break; + case MSG_READ_SEEK_ERROR: p = "Erreur de recherche en lecture: %s"; break; + case MSG_REGISTER_ERR: p = "Enregistrement NS impossible, préfix='%s' et href='%s'"; break; + case MSG_REMOVE_ERROR: p = "Erreur en supprimant %s: %s"; break; + case MSG_RENAME_ERROR: p = "Erreur renommant %s en %s: %s"; break; + case MSG_ROWID_NOT_IMPL: p = "RowNumber non implémenté pour les tables de type %s"; break; + case MSG_SEC_KEY_FIRST: p = "Les sections et clés doivent être insérées en premier"; break; + case MSG_SEC_NAME_FIRST: p = "Le nom de section doit être en tête de liste en insertion"; break; + case MSG_SEP_IN_FIELD: p = "Le champ %d contient le caractère séparateur"; break; + case MSG_SEQUENCE_ERROR: p = "HSTMT: Allocation hors séquence"; break; + case MSG_SETEOF_ERROR: p = "Erreur %d dans SetEndOfFile"; break; + case MSG_SETRECPOS_NIY: p = "SetRecpos non implémenté pour ce type de table"; break; + case MSG_SET_STR_TRUNC: p = "SetValue: Chaîne de caractères tronquée"; break; + case MSG_SFP_ERROR: p = "Erreur sur SetFilePointer: %s"; break; + case MSG_SHARED_LIB_ERR: p = "Erreur au chargement de la librairie partagée %s: %s"; break; + case MSG_SINGLE_STEP: p = "Pas à pas"; break; + case MSG_SORTING_VAL: p = "Tri de %d valeurs"; break; + case MSG_SPCOL_READONLY: p = "La colonne spéciale %s est en lecture seulement"; break; + case MSG_SQL_CONF_ERROR: p = "Erreur SQL: SQL_CONFORMANCE"; break; + case MSG_SRCH_CLOSE_ERR: p = "Erreur à la fermeture de l'Handle de recherche"; break; + case MSG_SRC_TABLE_UNDEF: p = "La table source n'est pas définie"; break; + case MSG_STACK_OVERFLOW: p = "Dépassement de capacité de la pile"; break; + case MSG_TABDIR_READONLY: p = "Les tables DIR sont en lecture seulement"; break; + case MSG_TABLE_NOT_OPT: p = "Table non optimisable"; break; + case MSG_TABLE_NO_INDEX: p = "La table %s n'est pas indexable"; break; + case MSG_TABLE_READ_ONLY: p = "Les tables %s sont en lecture seulement "; break; + case MSG_TABMUL_READONLY: p = "Les tables multiples sont en lecture seulement"; break; + case MSG_TOO_MANY_FIELDS: p = "Trop de champs ligne %d de %s"; break; + case MSG_TOO_MANY_JUMPS: p = "Trop de niveaux de saut"; break; + case MSG_TOO_MANY_KEYS: p = "Trop de clés (%d)"; break; + case MSG_TO_BLK_IS_NULL: p = "To Blk est nul"; break; + case MSG_TRUNCATE_ERROR: p = "Erreur en troncation: %s"; break; + case MSG_TRUNC_BY_ESTIM: p = "Tronqué par l'option Estimate"; break; + case MSG_TYPE_MISMATCH: p = "Clé et source ne sont pas du même type"; break; + case MSG_TYPE_VALUE_ERR: p = "Colonne %s: disparité type(%s)/valeur(%s)"; break; + case MSG_UNBALANCE_QUOTE: p = "Appostrophe en trop ligne %d"; break; + case MSG_UNDEFINED_AM: p = "COLBLK %s: méthode d'accès indéfinie"; break; + case MSG_UNKNOWN_EXCPT: p = "Exception non répertoriée"; break; + case MSG_UNMATCH_FIL_ARG: p = "Argument de filtre dépareillé"; break; + case MSG_UPDATE_ERROR: p = "Erreur en Update sur %s"; break; + case MSG_UPD_ZIP_NOT_IMP: p = "Mise à jour des tables ZDOS non encore implementé"; break; + case MSG_VALSTR_TOO_LONG: p = "Valeur %s trop longue pour une chaîne de longueur %d"; break; + case MSG_VALTYPE_NOMATCH: p = "Disparité types de valeur"; break; + case MSG_VALUE_ERROR: p = "Colonne %s: bloc valeur nul"; break; + case MSG_VALUE_TOO_BIG: p = "Valeur %lld trop grande pour la colonne %s"; break; + case MSG_VALUE_TOO_LONG: p = "Valeur %s trop longue pour la colonne %s de longueur %d"; break; + case MSG_VAL_ALLOC_ERR: p = "Allocation impossible du noeud valeur"; break; + case MSG_VIR_NO_DELETE: p = "Delete impossible sur les tables %s"; break; + case MSG_VIR_READ_ONLY: p = "Les tables virtuelles %s sont en lecture seulement"; break; + case MSG_VOID_FIRST_ARG: p = "Le premier argument ne doit pas être vide"; break; + case MSG_WORK_AREA: p = "Espace de travail: %s"; break; + case MSG_WRITE_SEEK_ERR: p = "Erreur de recherche en écriture: %s"; break; + case MSG_WRITE_STRERROR: p = "Erreur en écriture sur %s: %s"; break; + case MSG_WRITING: p = "Ecriture"; break; + case MSG_WRITING_ERROR: p = "Erreur à l'écriture de %s: %s"; break; + case MSG_WS_CONV_ERR: p = "Erreur de convertion de %s en WS"; break; + case MSG_XCOL_MISMATCH: p = "La colonne %s ne correspond pas à l'index"; break; + case MSG_XFILE_READERR: p = "Erreur %d en lisant le fichier index"; break; + case MSG_XFILE_WRITERR: p = "Erreur en écrivant le fichier index: %s"; break; + case MSG_XMLTAB_INIT_ERR: p = "Erreur d'initialisation de la table XML"; break; + case MSG_XML_INIT_ERROR: p = "Erreur d'initialisation du nouveau fichier XML"; break; + case MSG_XPATH_CNTX_ERR: p = "Le nouveau contexte XPath ne peut être créé"; break; + case MSG_XPATH_EVAL_ERR: p = "Impossible d'évaluer l'emplacement xpath '%s'"; break; + case MSG_XPATH_NOT_SUPP: p = "Xpath non supporté colonne %s"; break; diff --git a/storage/connect/french.msg b/storage/connect/french.msg new file mode 100644 index 00000000000..019df607be3 --- /dev/null +++ b/storage/connect/french.msg @@ -0,0 +1,366 @@ + 100 IDS_TABLES "Table Entêtes" + 101 IDS_TAB_01 "Catalogue" + 102 IDS_TAB_02 "Schéma" + 103 IDS_TAB_03 "Nom" + 104 IDS_TAB_04 "Type" + 105 IDS_TAB_05 "Remarque" + 106 IDS_COLUMNS "Colonne Entêtes" + 107 IDS_COL_01 "Cat_Table" + 108 IDS_COL_02 "Schem_Table" + 109 IDS_COL_03 "Nom_Table" + 110 IDS_COL_04 "Nom_Colonne" + 111 IDS_COL_05 "Type_Données" + 112 IDS_COL_06 "Nom_Type" + 113 IDS_COL_07 "Précision" + 114 IDS_COL_08 "Longueur" + 115 IDS_COL_09 "Echelle" + 116 IDS_COL_10 "Base" + 117 IDS_COL_11 "Nullifiable" + 118 IDS_COL_12 "Remarques" + 119 IDS_PKEY "Clé Entêtes" + 120 IDS_PKY_01 "Cat_Table" + 121 IDS_PKY_02 "Schem_Table" + 122 IDS_PKY_03 "Nom_Table" + 123 IDS_PKY_04 "Nom_Colonne" + 124 IDS_PKY_05 "Numéro_Clé" + 125 IDS_PKY_06 "Nom_Clé" + 126 IDS_STAT "Stat Entêtes" + 127 IDS_STA_01 "Table_Catalog" + 128 IDS_STA_02 "Table_Schema" + 129 IDS_STA_03 "Table_Name" + 130 IDS_STA_04 "Non_Unique" + 131 IDS_STA_05 "Index_Qualifier" + 132 IDS_STA_06 "Index_Name" + 133 IDS_STA_07 "Type" + 134 IDS_STA_08 "Seq_in_Index" + 135 IDS_STA_09 "Column_Name" + 136 IDS_STA_10 "Collation" + 137 IDS_STA_11 "Cardinality" + 138 IDS_STA_12 "Pages" + 139 IDS_STA_13 "Filter_Condition" + 140 IDS_DRIVER "Driver Entêtes" + 141 IDS_DRV_01 "Description" + 142 IDS_DRV_02 "Attributs" + 143 IDS_DSRC "DataSrc Entêtes" + 144 IDS_DSC_01 "Nom" + 145 IDS_DSC_02 "Description" + 200 ACCESS_VIOLATN "Violation accès mémoire" + 201 ADD_BAD_TYPE "Ajout d'une valeur de type %s non conforme dans un tableau %s" + 202 ALLOC_ERROR "Erreur d'allocation de %s" + 203 ANSWER_TYPE "Réponse de type" + 204 API_CONF_ERROR "Erreur SQL: API_CONFORMANCE" + 205 APPL_NOT_INIT "Application non initialisée" + 206 ARRAY_BNDS_EXCD "Hors limite de tableau" + 207 BAD_ARRAY_OPER "Les tableaux doivent utiliser l'opérateur IN" + 208 BAD_ARRAY_TYPE "Type=%d invalide pour un tableau" + 209 BAD_ARRAY_VAL "Les tableaux doivent avoir le même nombre de valeurs" + 210 BAD_BIN_FMT "Format invalide %c pour la colonne BIN %s" + 211 BAD_BLK_ESTIM "Nombre de blocs supérieur à l'estimation" + 212 BAD_BLK_SIZE "Taille du bloc %d non conforme" + 213 BAD_BYTE_NUM "Le nombre d'octets écrits est faux" + 214 BAD_BYTE_READ "Le nombre d'octets lus est faux" + 215 BAD_COL_TYPE "Type invalide %s pour la colonne %s" + 216 BAD_COL_XPATH "Xpath invalide colonne %s de la table HTML %s" + 217 BAD_CONST_TYPE "Type=%d invalide pour une constante" + 218 BAD_CONV_TYPE "Convertion de type invalide %d" + 219 BAD_DATETIME "Valeur date/temps invalide" + 220 BAD_DBF_FILE "Le fichier DBF %s est altéré" + 221 BAD_DBF_REC "Fichier DBF %s altéré enregistrement %d" + 222 BAD_DBF_TYPE "Type DBF %c non supporté colonne %s" + 223 BAD_DIRECTORY "Répertoire invalide %s: %s" + 224 BAD_FIELD_RANK "Rang %d invalide pour la colonne %s" + 225 BAD_FIELD_TYPE "Mauvais type de champ %s" + 226 BAD_FILE_HANDLE "Handle de fichier invalide: %s" + 227 BAD_FILTER "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d" + 228 BAD_FILTER_CONV "Conversion filtre incorrecte, B_T=%d,%d" + 229 BAD_FILTER_OP "Opérateur de filtre invalide %d" + 230 BAD_FLD_FORMAT "Format invalide pour le champs %d de %s" + 231 BAD_FLD_LENGTH "Champs %s trop long (%s --> %d) ligne %d de %s" + 232 BAD_FREQ_SET "Spécification erronnée de Freq pour la colonne %s" + 233 BAD_FUNC_MODE "%s: mode invalide %d" + 234 BAD_HANDLE_VAL "Valeur Handle invalide" + 235 BAD_HEADER "Fichier %s: bloc en-tête altéré" + 236 BAD_HEAD_END "Lecture fin d'en-tête impossible" + 237 BAD_INDEX_FILE "Fichier index %s corrompu" + 238 BAD_LINEFLD_FMT "Format invalide ligne %d champs %d de %s" + 239 BAD_LINE_LEN "Longueur ligne non égale à Lrecl" + 240 BAD_LRECL "Disparité lrecl table/fichier (%d,%hd)" + 241 BAD_NODE_TYPE "Type noeud erroné pour la table" + 242 BAD_OFFSET_VAL "Nul offset invalide pour une table CSV" + 243 BAD_OPEN_MODE "Mode d'ouverture invalide %d" + 244 BAD_PARAM_TYPE "%.8s: Paramètre de type=%d invalide" + 245 BAD_PARM_COUNT "Nombre de paramètres incohérent" + 246 BAD_QUOTE_FIELD "Quote manquante dans %s champs %d ligne %d" + 247 BAD_READ_NUMBER "Mauvais nombre %d de valeurs lues dans %s" + 248 BAD_RECFM "Recfm type %d invalide pour DOSCOL" + 249 BAD_RECFM_VAL "Valeur invalide %d de Recfm" + 250 BAD_SET_CASE "La casse d'un tableau ne peut pas passer de non respect à respecter" + 251 BAD_SET_STRING "SetValue: appel invalide pour STRING" + 252 BAD_SPECIAL_COL "Colonne spéciale invalide %s" + 253 BAD_SPEC_COLUMN "Colonne spéciale invalide pour ce type de table" + 254 BAD_TABLE_TYPE "Type invalide %s pour la table %s" + 255 BAD_TYPE_LIKE "Type(%d)= %d invalide pour LIKE" + 256 BAD_VALBLK_INDX "Valeur hors limites de l'index du bloc de valeurs" + 257 BAD_VALBLK_TYPE "Type=%d invalide pour un bloc de valeurs" + 258 BAD_VALNODE "Type %d invalide pour le noeud valeur colonne %s" + 259 BAD_VALUE_TYPE "Type de valeur invalide %d" + 260 BAD_VAL_UPDATE "Impossible de déterminer quelle valeur %s doit être mise à jour" + 261 BAS_NS_LIST "Format invalide de la liste des espace-noms" + 262 BIN_F_TOO_LONG "Valeur trop longue pour le champ %s (%d --> %d)" + 263 BIN_MODE_FAIL "Echec mode binaire: %s" + 264 BLKTYPLEN_MISM "Disparité types/longueurs de bloc dans SetValue" + 265 BLK_IS_NULL "Blk est nul" + 266 BREAKPOINT "Point de contrôle" + 267 BUILD_INDEX "Construction index %s sur %s" + 268 CANNOT_OPEN "Ouverture impossible de %s" + 269 CHSIZE_ERROR "Erreur dans chsize: %s" + 270 COL_ALLOC_ERR "Allocation impossible du noeud colonne" + 271 COL_ISNOT_TABLE "La colonne %s n'est pas dans la table %s" + 272 COL_NOT_SORTED "La colonne %s de la table %s n'est pas triée" + 273 COL_NUM_MISM "Disparité du nombre de colonnes" + 274 COM_ERROR "Erreur Com" + 275 CONCAT_SUBNODE "Concaténation de sous-noeuds impossible" + 276 CONNECT_CANCEL "Connection interrompue par l'utilisateur" + 277 CONTROL_C_EXIT "Exit par Ctrl-C" + 278 DATABASE_LOADED "Base de données %s chargée" + 279 DATA_MISALIGN "Mauvais alignement pour ce type de données" + 280 DBASE_FILE "Fichier dBASE dbf: " + 281 DEF_ALLOC_ERROR "Erreur d'allocation de la classe DEF %s" + 282 DEL_FILE_ERR "Erreur à l'effacement de %s" + 283 DEL_READ_ERROR "Delete: erreur en lecture req=%d len=%d" + 284 DEL_WRITE_ERROR "Delete: erreur en écriture: %s" + 285 DEPREC_FLAG "Option Flag périmée, utiliser Coltype" + 286 DLL_LOAD_ERROR "Erreur %d au chargement du module %s" + 287 DOM_NOT_SUPP "MS-DOM non supporté par cette version" + 288 DVAL_NOTIN_LIST "Valeur %s non trouvée dans la liste des valeurs distinctes de la colonne %s" + 289 EMPTY_DOC "Document vide" + 290 EMPTY_FILE "%s du fichier vide %s: " + 291 EOF_AFTER_LINE "Fin de fichier après la ligne %d" + 292 EOF_INDEX_FILE "EOF lisant le fichier index" + 293 ERROR_IN_LSK "Erreur %d dans lseek64" + 294 ERROR_IN_SFP "Erreur %d dans SetFilePointer" + 295 ERR_READING_REC "Erreur lisant l'enregistrement %d de %s" + 296 FAIL_ADD_NODE "L'ajout du noeud %s dans la table a échoué" + 297 FETCH_NO_RES "Fetch: Pas de Résultats" + 298 FIELD_TOO_LONG "Valeur trop longue pour le champs %d ligne %d" + 299 FILELEN_ERROR "Erreur dans %s pour %s" + 300 FILE_IS_EMPTY "Le fichier %s est vide" + 301 FILE_MAP_ERR "Erreur de File mapping" + 302 FILE_MAP_ERROR "CreateFileMapping %s erreur rc=%d" + 303 FILE_OPEN_YET "Fichier %s déjà ouvert" + 304 FILE_UNFOUND "Fichier %s non trouvé" + 305 FLD_TOO_LNG_FOR "Champs %d trop long pour %s ligne %d de %s" + 306 FLT_BAD_RESULT "Virgule flottante: résultat inexacte" + 307 FLT_DENORMAL_OP "Opérande virgule flottante non normalisé" + 308 FLT_INVALID_OP "Opération virgule flottante invalide" + 309 FLT_OVERFLOW "Dépassement de capacité virgule flottante" + 310 FLT_STACK_CHECK "Virgule flottante: Erreur de la pile" + 311 FLT_UNDERFLOW "Sous-dépassement de capacité virgule flottante" + 312 FLT_ZERO_DIVIDE "Virgule flottante: division par zéro" + 313 FMT_WRITE_NIY "L'écriture des fichiers %s n'est pas encore implémentée" + 314 FOXPRO_FILE "Fichier FoxPro: " + 315 FPUTS_ERROR "Erreur dans fputs: %s" + 316 FSEEK_ERROR "Erreur dans fseek: %s" + 317 FSETPOS_ERROR "Erreur dans fseek pour i=%d" + 318 FTELL_ERROR "Erreur dans ftell enregistrement=%d: %s" + 319 FUNCTION_ERROR "Erreur dans %s: %d" + 320 FUNC_ERRNO "Erreur %d dans %s" + 321 FUNC_ERROR "Erreur dans %s" + 322 FUNC_ERR_S "Erreur dans %s: %s" + 323 FWRITE_ERROR "Erreur dans fwrite: %s" + 324 GET_DIST_VALS "Récupération des valeurs distinctes de " + 325 GET_FUNC_ERR "Erreur en recherche de la fonction %s: %s" + 326 GLOBAL_ERROR "Erreur d'allocation de Global (taille=%d)\n" + 327 GUARD_PAGE "Violation de page de garde" + 328 GZOPEN_ERROR "gzopen %s: erreur %d sur %s" + 329 ILLEGAL_INSTR "Instruction illégale" + 330 ILL_FILTER_CONV "Conversion implicite illégale dans un filtre" + 331 INDEX_NOT_UNIQ "L'index n'est pas Unique" + 332 INDEX_YET_ON "L'index %s existe déjà sur %s" + 333 INDX_COL_NOTIN "La colonne index %s n'existe pas dans la table %s" + 334 INDX_EXIST_YET "L'entrée index existe déjà" + 335 INIT_FAILED "L'initialisation de %s a échoué" + 336 INT_COL_ERROR "Erreur interne sur la colonne index %s" + 337 INT_OVERFLOW "Dépassement de capacité sur entier" + 338 INT_ZERO_DIVIDE "Division entière par zéro" + 339 INVALID_DISP "Disposition invalide" + 340 INVALID_FTYPE "SBV: Ftype %d invalide" + 341 INVALID_HANDLE "Poignée invalide" + 342 INVALID_OPER "Opérateur invalide %d pour %s" + 343 INV_COLUMN_TYPE "Type %d Invalide pour la colonne %s" + 344 INV_COL_TYPE "Type de colonne %s invalide" + 345 INV_DEF_READ "Lecture différée invalide rc=%d" + 346 INV_DIRCOL_OFST "Offset invalide pour une colonne DIR" + 347 INV_MAP_POS "Position mémoire invalide" + 348 INV_RAND_ACC "L'accès aléatoire d'une table non optimisée est impossible" + 349 INV_REC_POS "Position d'enregistrement invalide" + 350 INV_RESULT_TYPE "Type de résultat invalide %s" + 351 INV_UPDT_TABLE "Table %s invalide pour Update" + 352 IN_WITHOUT_SUB "IN ou EXISTS sans tableau ou subquery" + 353 KEY_ALLOC_ERR "Erreur d'allocation d'un bloc offset clé" + 354 KEY_ALLOC_ERROR "Erreur d'allocation mémoire, Klen=%d n=%d" + 355 LINE_TOO_LONG "La nouvelle ligne est trop longue" + 356 LIST "--Liste--" + 357 LOADING_FAILED "Le chargement de %s a échoué" + 358 LRECL_TOO_SMALL "Lrecl trop petit (longueur en-tête = %d)" + 359 MAKE_EMPTY_FILE "Génération du fichier vide %s: %s" + 360 MAKING "Génération" + 361 MALLOC_ERROR "Allocation mémoire impossible par %s" + 362 MAP_VIEW_ERROR "MapViewOfFile %s erreur rc=%d" + 363 MAXSIZE_ERROR "Maxsize incalculable sur table ouverte" + 364 MEM_ALLOC_ERR "Erreur d'allocation mémoire, taille %s = %d" + 365 MEM_ALLOC_ERROR "Erreur d'allocation mémoire" + 366 MISPLACED_QUOTE "Appostrophe mal placée ligne %d" + 367 MISSING_ARG "Argument manquant pour l'opérateur %d" + 368 MISSING_FIELD "Champs %d manquant dans %s ligne %d" + 369 MISSING_FNAME "Nom du fichier manquant" + 370 MISSING_NODE "Noeud %s manquant dans %s" + 371 MISSING_ROWNODE "Impossible de trouver le noeud de la ligne %d" + 372 MIS_TAG_LIST "Liste des balises colonne manquante" + 373 MUL_MAKECOL_ERR "Erreur logique dans TABMUL::MakeCol" + 374 NAME_CONV_ERR "Erreur de convertion du nom de noeud" + 375 NEW_DOC_FAILED "Impossible de créer le nouveau document" + 376 NEW_RETURN_NULL "NULL renvoyé par New dans PlugEvalLike" + 377 NEXT_FILE_ERROR "Erreur en recherche du fichier suivant. rc=%s" + 378 NONCONT_EXCEPT "Exception non-continuable" + 379 NOP_ZLIB_INDEX "L'indexage d'une table zlib non optimisée est impossible" + 380 NOT_A_DBF_FILE "Le fichier n'a pas le format dBASE dbf " + 381 NOT_FIXED_LEN "Fichier %s non fixe, len=%d lrecl=%d" + 382 NO_0DH_HEAD "0DH manquant en fin d'en-tête (dbc=%d)" + 383 NO_ACTIVE_DB "Pas de base de données active" + 384 NO_CHAR_FROM "Conversion de type %d en caractères impossible" + 385 NO_DATE_FMT "Pas de format date pour le valblock de type %d" + 386 NO_DEF_FNCCOL "Colonne fonction par défaut introuvable" + 387 NO_DEF_PIVOTCOL "Colonne pivot par défaut introuvable" + 388 NO_DIR_INDX_RD "Pas d'accès directe des tables %s" + 389 NO_FEAT_SUPPORT "%s non supporté dans cette version" + 390 NO_FLD_FORMAT "Format absent pour le champs %d de %s" + 391 NO_FORMAT_COL "Type COLUMN informattable" + 392 NO_FORMAT_TYPE "Le format ne peut pas être défini à partir du type %d" + 393 NO_INDEX_READ "Pas d'accès directe des tables multiples" + 394 NO_KEY_COL "Pas de colonne clé trouvée" + 395 NO_KEY_UPDATE "Le nom des clés ne peut pas être modifié" + 396 NO_MAP_INSERT "MAP incompatible avec Insert" + 397 NO_MATCHING_COL "Pas de colonne correspondant à %s dans %s" + 398 NO_MATCH_COL "Colonne correspondante introuvable" + 399 NO_MEMORY "Mémoire pleine" + 400 NO_MODE_PADDED "Mode non supporté pour les fichiers 'padded'" + 401 NO_MUL_VCT "Les tables VCT ne peuvent pas être multiples" + 402 NO_ODBC_DELETE "Delete ne devrait pas être appelé pour les tables ODBC" + 403 NO_ODBC_DIRECT "Accès directe des tables ODBC non encore implémenté" + 404 NO_ODBC_MUL "Multiple(2) non supporté pour les tables ODBC" + 405 NO_ODBC_SPECOL "Pas de colonne spéciale ODBC" + 406 NO_PART_DEL "Delete partiel des fichier %s impossible" + 407 NO_PART_MAP "Mapping partiel non implémenté pour cet OS" + 408 NO_PAR_BLK_INS "Insertion de bloc partiel impossible" + 409 NO_PIV_DIR_ACC "Pas d'accès directe aux tables PIVOT" + 410 NO_READ_32 "Lecture de 32 octets impossible" + 411 NO_RECOV_SPACE "Espace non recouvrable dans le fichier index" + 412 NO_ROWID_FOR_AM "Accès direct impossible de ROWID pour les tables de type %s" + 413 NO_ROW_NODE "Le nom du Rownode n'est pas défini" + 414 NO_SECTION_NAME "Nom de section manquant" + 415 NO_SEC_UPDATE "Les noms de section ne peuvent pas être modifiés" + 416 NO_SETPOS_YET "SetPos pas encore implémenté pour les fichier %s" + 417 NO_SPEC_COL "Pas de colonne spéciales MYSQL" + 418 NO_SUB_VAL "Pas de sous-value d'un tableau de type %d" + 419 NO_TABCOL_DATA "Pas de données pour la table %s colonne %s" + 420 NO_TABLE_DEL "Delete non autorisé pour les tables %s " + 421 NO_TAB_DATA "Pas de données pour la table %s" + 422 NO_VCT_DELETE "Délétion Partielle non implémentée pour les fichiers VCT" + 423 NO_ZIP_DELETE "Delete sur fichier Zip non encore implementé" + 424 OPENING "Ouverture" + 425 OPEN_EMPTY_FILE "Ouverture du fichier vide %s: %s" + 426 OPEN_ERROR "Erreur d'ouverture %d en mode %d sur %s: " + 427 OPEN_ERROR_IS "Erreur à l'ouverture de %s: %s" + 428 OPEN_MODE_ERROR "Erreur d'ouverture(%s) %d sur %s" + 429 OPEN_STRERROR "Erreur à l'ouverture: %s" + 430 OPTBLK_RD_ERR "Erreur à la lecture d'un bloc optimisation: %s" + 431 OPTBLK_WR_ERR "Erreur à l'écriture d'un bloc optimisation: %s" + 432 OPTIMIZING "Optimisation de " + 433 OPT_BMAP_RD_ERR "Erreur en lecture des bitmaps d'optimisation: %s" + 434 OPT_BMAP_WR_ERR "Erreur en écriture des bitmaps d'optimisation: %s" + 435 OPT_CANCELLED "Optimisation interrompue par l'utilisateur" + 436 OPT_DVAL_RD_ERR "Erreur en lecture des valeurs distinctes: %s" + 437 OPT_DVAL_WR_ERR "Erreur en écriture des valeurs distinctes: %s" + 438 OPT_HEAD_RD_ERR "Erreur en lecture de l'entête du fichier opt: %s" + 439 OPT_HEAD_WR_ERR "Erreur en écriture de l'entête du fichier opt: %s" + 440 OPT_LOGIC_ERR "Erreur logique dans SetBitmap, i=%d" + 441 OPT_MAX_RD_ERR "Erreur en lecture des valeurs maxi: %s" + 442 OPT_MAX_WR_ERR "Erreur en écriture des valeurs maxi: %s" + 443 OPT_MIN_RD_ERR "Erreur en lecture des valeurs mini: %s" + 444 OPT_MIN_WR_ERR "Erreur en écriture des valeurs mini: %s" + 445 OPT_NOT_MATCH "Le fichier opt %s n'est pas à jour" + 446 PAGE_ERROR "Erreur de pagination" + 447 PARM_CNT_MISS "Disparité du nombre de Paramètres" + 448 PREC_VBLP_NULL "ARRAY SetPrecision: Vblp est NULL" + 449 PRIV_INSTR "Instruction privilégiée" + 450 PROCADD_ERROR "Erreur %d sur l'adresse de %s" + 451 QUERY_CANCELLED "Requête interrompue par l'utilisateur" + 452 RANGE_NO_JOIN "Range non compatible avec les index de jointure" + 453 RC_READING "rc=%d en lecture de la table %s" + 454 READY "Prêt" + 455 READ_ERROR "Erreur en lecture sur %s: %s" + 456 READ_ONLY "Cette table protégée en lecture seule ne peut être modifiée" + 457 READ_SEEK_ERROR "Erreur de recherche en lecture: %s" + 458 REGISTER_ERR "Enregistrement NS impossible, préfix='%s' et href='%s'" + 459 REMOVE_ERROR "Erreur en supprimant %s: %s" + 460 RENAME_ERROR "Erreur renommant %s en %s: %s" + 461 ROWID_NOT_IMPL "RowNumber non implémenté pour les tables de type %s" + 462 SEC_KEY_FIRST "Les sections et clés doivent être insérées en premier" + 463 SEC_NAME_FIRST "Le nom de section doit être en tête de liste en insertion" + 464 SEP_IN_FIELD "Le champ %d contient le caractère séparateur" + 465 SEQUENCE_ERROR "HSTMT: Allocation hors séquence" + 466 SETEOF_ERROR "Erreur %d dans SetEndOfFile" + 467 SETRECPOS_NIY "SetRecpos non implémenté pour ce type de table" + 468 SET_STR_TRUNC "SetValue: Chaîne de caractères tronquée" + 469 SFP_ERROR "Erreur sur SetFilePointer: %s" + 470 SHARED_LIB_ERR "Erreur au chargement de la librairie partagée %s: %s" + 471 SINGLE_STEP "Pas à pas" + 472 SORTING_VAL "Tri de %d valeurs" + 473 SPCOL_READONLY "La colonne spéciale %s est en lecture seulement" + 474 SQL_CONF_ERROR "Erreur SQL: SQL_CONFORMANCE" + 475 SRCH_CLOSE_ERR "Erreur à la fermeture de l'Handle de recherche" + 476 SRC_TABLE_UNDEF "La table source n'est pas définie" + 477 STACK_OVERFLOW "Dépassement de capacité de la pile" + 478 TABDIR_READONLY "Les tables DIR sont en lecture seulement" + 479 TABLE_NOT_OPT "Table non optimisable" + 480 TABLE_NO_INDEX "La table %s n'est pas indexable" + 481 TABLE_READ_ONLY "Les tables %s sont en lecture seulement " + 482 TABMUL_READONLY "Les tables multiples sont en lecture seulement" + 483 TOO_MANY_FIELDS "Trop de champs ligne %d de %s" + 484 TOO_MANY_JUMPS "Trop de niveaux de saut" + 485 TOO_MANY_KEYS "Trop de clés (%d)" + 486 TO_BLK_IS_NULL "To Blk est nul" + 487 TRUNCATE_ERROR "Erreur en troncation: %s" + 488 TRUNC_BY_ESTIM "Tronqué par l'option Estimate" + 489 TYPE_MISMATCH "Clé et source ne sont pas du même type" + 490 TYPE_VALUE_ERR "Colonne %s: disparité type(%s)/valeur(%s)" + 491 UNBALANCE_QUOTE "Appostrophe en trop ligne %d" + 492 UNDEFINED_AM "COLBLK %s: méthode d'accès indéfinie" + 493 UNKNOWN_EXCPT "Exception non répertoriée" + 494 UNMATCH_FIL_ARG "Argument de filtre dépareillé" + 495 UPDATE_ERROR "Erreur en Update sur %s" + 496 UPD_ZIP_NOT_IMP "Mise à jour des tables ZDOS non encore implementé" + 497 VALSTR_TOO_LONG "Valeur %s trop longue pour une chaîne de longueur %d" + 498 VALTYPE_NOMATCH "Disparité types de valeur" + 499 VALUE_ERROR "Colonne %s: bloc valeur nul" + 500 VALUE_TOO_BIG "Valeur %lld trop grande pour la colonne %s" + 501 VALUE_TOO_LONG "Valeur %s trop longue pour la colonne %s de longueur %d" + 502 VAL_ALLOC_ERR "Allocation impossible du noeud valeur" + 503 VIR_NO_DELETE "Delete impossible sur les tables %s" + 504 VIR_READ_ONLY "Les tables virtuelles %s sont en lecture seulement" + 505 VOID_FIRST_ARG "Le premier argument ne doit pas être vide" + 506 WORK_AREA "Espace de travail: %s" + 507 WRITE_SEEK_ERR "Erreur de recherche en écriture: %s" + 508 WRITE_STRERROR "Erreur en écriture sur %s: %s" + 509 WRITING "Ecriture" + 510 WRITING_ERROR "Erreur à l'écriture de %s: %s" + 511 WS_CONV_ERR "Erreur de convertion de %s en WS" + 512 XCOL_MISMATCH "La colonne %s ne correspond pas à l'index" + 513 XFILE_READERR "Erreur %d en lisant le fichier index" + 514 XFILE_WRITERR "Erreur en écrivant le fichier index: %s" + 515 XMLTAB_INIT_ERR "Erreur d'initialisation de la table XML" + 516 XML_INIT_ERROR "Erreur d'initialisation du nouveau fichier XML" + 517 XPATH_CNTX_ERR "Le nouveau contexte XPath ne peut être créé" + 518 XPATH_EVAL_ERR "Impossible d'évaluer l'emplacement xpath '%s'" + 519 XPATH_NOT_SUPP "Xpath non supporté colonne %s" diff --git a/storage/connect/frids.h b/storage/connect/frids.h new file mode 100644 index 00000000000..561dbb68837 --- /dev/null +++ b/storage/connect/frids.h @@ -0,0 +1,46 @@ + case IDS_TABLES: p = "Table Entêtes"; break; + case IDS_TAB_01: p = "Catalogue"; break; + case IDS_TAB_02: p = "Schéma"; break; + case IDS_TAB_03: p = "Nom"; break; + case IDS_TAB_04: p = "Type"; break; + case IDS_TAB_05: p = "Remarque"; break; + case IDS_COLUMNS: p = "Colonne Entêtes"; break; + case IDS_COL_01: p = "Cat_Table"; break; + case IDS_COL_02: p = "Schem_Table"; break; + case IDS_COL_03: p = "Nom_Table"; break; + case IDS_COL_04: p = "Nom_Colonne"; break; + case IDS_COL_05: p = "Type_Données"; break; + case IDS_COL_06: p = "Nom_Type"; break; + case IDS_COL_07: p = "Précision"; break; + case IDS_COL_08: p = "Longueur"; break; + case IDS_COL_09: p = "Echelle"; break; + case IDS_COL_10: p = "Base"; break; + case IDS_COL_11: p = "Nullifiable"; break; + case IDS_COL_12: p = "Remarques"; break; + case IDS_PKEY: p = "Clé Entêtes"; break; + case IDS_PKY_01: p = "Cat_Table"; break; + case IDS_PKY_02: p = "Schem_Table"; break; + case IDS_PKY_03: p = "Nom_Table"; break; + case IDS_PKY_04: p = "Nom_Colonne"; break; + case IDS_PKY_05: p = "Numéro_Clé"; break; + case IDS_PKY_06: p = "Nom_Clé"; break; + case IDS_STAT: p = "Stat Entêtes"; break; + case IDS_STA_01: p = "Table_Catalog"; break; + case IDS_STA_02: p = "Table_Schema"; break; + case IDS_STA_03: p = "Table_Name"; break; + case IDS_STA_04: p = "Non_Unique"; break; + case IDS_STA_05: p = "Index_Qualifier"; break; + case IDS_STA_06: p = "Index_Name"; break; + case IDS_STA_07: p = "Type"; break; + case IDS_STA_08: p = "Seq_in_Index"; break; + case IDS_STA_09: p = "Column_Name"; break; + case IDS_STA_10: p = "Collation"; break; + case IDS_STA_11: p = "Cardinality"; break; + case IDS_STA_12: p = "Pages"; break; + case IDS_STA_13: p = "Filter_Condition"; break; + case IDS_DRIVER: p = "Driver Entêtes"; break; + case IDS_DRV_01: p = "Description"; break; + case IDS_DRV_02: p = "Attributs"; break; + case IDS_DSRC: p = "DataSrc Entêtes"; break; + case IDS_DSC_01: p = "Nom"; break; + case IDS_DSC_02: p = "Description"; break; diff --git a/storage/connect/frmsg.h b/storage/connect/frmsg.h new file mode 100644 index 00000000000..d58779b948f --- /dev/null +++ b/storage/connect/frmsg.h @@ -0,0 +1,320 @@ +#define MSG_ACCESS_VIOLATN "Violation accès mémoire" +#define MSG_ADD_BAD_TYPE "Ajout d'une valeur de type %s non conforme dans un tableau %s" +#define MSG_ALLOC_ERROR "Erreur d'allocation de %s" +#define MSG_ANSWER_TYPE "Réponse de type" +#define MSG_API_CONF_ERROR "Erreur SQL: API_CONFORMANCE" +#define MSG_APPL_NOT_INIT "Application non initialisée" +#define MSG_ARRAY_BNDS_EXCD "Hors limite de tableau" +#define MSG_BAD_ARRAY_OPER "Les tableaux doivent utiliser l'opérateur IN" +#define MSG_BAD_ARRAY_TYPE "Type=%d invalide pour un tableau" +#define MSG_BAD_ARRAY_VAL "Les tableaux doivent avoir le même nombre de valeurs" +#define MSG_BAD_BIN_FMT "Format invalide %c pour la colonne BIN %s" +#define MSG_BAD_BLK_ESTIM "Nombre de blocs supérieur à l'estimation" +#define MSG_BAD_BLK_SIZE "Taille du bloc %d non conforme" +#define MSG_BAD_BYTE_NUM "Le nombre d'octets écrits est faux" +#define MSG_BAD_BYTE_READ "Le nombre d'octets lus est faux" +#define MSG_BAD_COL_TYPE "Type invalide %s pour la colonne %s" +#define MSG_BAD_COL_XPATH "Xpath invalide colonne %s de la table HTML %s" +#define MSG_BAD_CONST_TYPE "Type=%d invalide pour une constante" +#define MSG_BAD_CONV_TYPE "Convertion de type invalide %d" +#define MSG_BAD_DATETIME "Valeur date/temps invalide" +#define MSG_BAD_DBF_FILE "Le fichier DBF %s est altéré" +#define MSG_BAD_DBF_REC "Fichier DBF %s altéré enregistrement %d" +#define MSG_BAD_DBF_TYPE "Type DBF %c non supporté colonne %s" +#define MSG_BAD_DIRECTORY "Répertoire invalide %s: %s" +#define MSG_BAD_FIELD_RANK "Rang %d invalide pour la colonne %s" +#define MSG_BAD_FIELD_TYPE "Mauvais type de champ %s" +#define MSG_BAD_FILE_HANDLE "Handle de fichier invalide: %s" +#define MSG_BAD_FILTER "Mauvais filtre: Opc=%d B_T=%d %d Type=%d %d" +#define MSG_BAD_FILTER_CONV "Conversion filtre incorrecte, B_T=%d,%d" +#define MSG_BAD_FILTER_OP "Opérateur de filtre invalide %d" +#define MSG_BAD_FLD_FORMAT "Format invalide pour le champs %d de %s" +#define MSG_BAD_FLD_LENGTH "Champs %s trop long (%s --> %d) ligne %d de %s" +#define MSG_BAD_FREQ_SET "Spécification erronnée de Freq pour la colonne %s" +#define MSG_BAD_FUNC_MODE "%s: mode invalide %d" +#define MSG_BAD_HANDLE_VAL "Valeur Handle invalide" +#define MSG_BAD_HEADER "Fichier %s: bloc en-tête altéré" +#define MSG_BAD_HEAD_END "Lecture fin d'en-tête impossible" +#define MSG_BAD_INDEX_FILE "Fichier index %s corrompu" +#define MSG_BAD_LINEFLD_FMT "Format invalide ligne %d champs %d de %s" +#define MSG_BAD_LINE_LEN "Longueur ligne non égale à Lrecl" +#define MSG_BAD_LRECL "Disparité lrecl table/fichier (%d,%hd)" +#define MSG_BAD_NODE_TYPE "Type noeud erroné pour la table" +#define MSG_BAD_OFFSET_VAL "Nul offset invalide pour une table CSV" +#define MSG_BAD_OPEN_MODE "Mode d'ouverture invalide %d" +#define MSG_BAD_PARAM_TYPE "%.8s: Paramètre de type=%d invalide" +#define MSG_BAD_PARM_COUNT "Nombre de paramètres incohérent" +#define MSG_BAD_QUOTE_FIELD "Quote manquante dans %s champs %d ligne %d" +#define MSG_BAD_READ_NUMBER "Mauvais nombre %d de valeurs lues dans %s" +#define MSG_BAD_RECFM "Recfm type %d invalide pour DOSCOL" +#define MSG_BAD_RECFM_VAL "Valeur invalide %d de Recfm" +#define MSG_BAD_SET_CASE "La casse d'un tableau ne peut pas passer de non respect à respecter" +#define MSG_BAD_SET_STRING "SetValue: appel invalide pour STRING" +#define MSG_BAD_SPECIAL_COL "Colonne spéciale invalide %s" +#define MSG_BAD_SPEC_COLUMN "Colonne spéciale invalide pour ce type de table" +#define MSG_BAD_TABLE_TYPE "Type invalide %s pour la table %s" +#define MSG_BAD_TYPE_LIKE "Type(%d)= %d invalide pour LIKE" +#define MSG_BAD_VALBLK_INDX "Valeur hors limites de l'index du bloc de valeurs" +#define MSG_BAD_VALBLK_TYPE "Type=%d invalide pour un bloc de valeurs" +#define MSG_BAD_VALNODE "Type %d invalide pour le noeud valeur colonne %s" +#define MSG_BAD_VALUE_TYPE "Type de valeur invalide %d" +#define MSG_BAD_VAL_UPDATE "Impossible de déterminer quelle valeur %s doit être mise à jour" +#define MSG_BAS_NS_LIST "Format invalide de la liste des espace-noms" +#define MSG_BIN_F_TOO_LONG "Valeur trop longue pour le champ %s (%d --> %d)" +#define MSG_BIN_MODE_FAIL "Echec mode binaire: %s" +#define MSG_BLKTYPLEN_MISM "Disparité types/longueurs de bloc dans SetValue" +#define MSG_BLK_IS_NULL "Blk est nul" +#define MSG_BREAKPOINT "Point de contrôle" +#define MSG_BUILD_INDEX "Construction index %s sur %s" +#define MSG_CANNOT_OPEN "Ouverture impossible de %s" +#define MSG_CHSIZE_ERROR "Erreur dans chsize: %s" +#define MSG_COL_ALLOC_ERR "Allocation impossible du noeud colonne" +#define MSG_COL_ISNOT_TABLE "La colonne %s n'est pas dans la table %s" +#define MSG_COL_NOT_SORTED "La colonne %s de la table %s n'est pas triée" +#define MSG_COL_NUM_MISM "Disparité du nombre de colonnes" +#define MSG_COM_ERROR "Erreur Com" +#define MSG_CONCAT_SUBNODE "Concaténation de sous-noeuds impossible" +#define MSG_CONNECT_CANCEL "Connection interrompue par l'utilisateur" +#define MSG_CONTROL_C_EXIT "Exit par Ctrl-C" +#define MSG_DATABASE_LOADED "Base de données %s chargée" +#define MSG_DATA_MISALIGN "Mauvais alignement pour ce type de données" +#define MSG_DBASE_FILE "Fichier dBASE dbf: " +#define MSG_DEF_ALLOC_ERROR "Erreur d'allocation de la classe DEF %s" +#define MSG_DEL_FILE_ERR "Erreur à l'effacement de %s" +#define MSG_DEL_READ_ERROR "Delete: erreur en lecture req=%d len=%d" +#define MSG_DEL_WRITE_ERROR "Delete: erreur en écriture: %s" +#define MSG_DEPREC_FLAG "Option Flag périmée, utiliser Coltype" +#define MSG_DLL_LOAD_ERROR "Erreur %d au chargement du module %s" +#define MSG_DOM_NOT_SUPP "MS-DOM non supporté par cette version" +#define MSG_DVAL_NOTIN_LIST "Valeur %s non trouvée dans la liste des valeurs distinctes de la colonne %s" +#define MSG_EMPTY_DOC "Document vide" +#define MSG_EMPTY_FILE "%s du fichier vide %s: " +#define MSG_EOF_AFTER_LINE "Fin de fichier après la ligne %d" +#define MSG_EOF_INDEX_FILE "EOF lisant le fichier index" +#define MSG_ERROR_IN_LSK "Erreur %d dans lseek64" +#define MSG_ERROR_IN_SFP "Erreur %d dans SetFilePointer" +#define MSG_ERR_READING_REC "Erreur lisant l'enregistrement %d de %s" +#define MSG_FAIL_ADD_NODE "L'ajout du noeud %s dans la table a échoué" +#define MSG_FETCH_NO_RES "Fetch: Pas de Résultats" +#define MSG_FIELD_TOO_LONG "Valeur trop longue pour le champs %d ligne %d" +#define MSG_FILELEN_ERROR "Erreur dans %s pour %s" +#define MSG_FILE_IS_EMPTY "Le fichier %s est vide" +#define MSG_FILE_MAP_ERR "Erreur de File mapping" +#define MSG_FILE_MAP_ERROR "CreateFileMapping %s erreur rc=%d" +#define MSG_FILE_OPEN_YET "Fichier %s déjà ouvert" +#define MSG_FILE_UNFOUND "Fichier %s non trouvé" +#define MSG_FLD_TOO_LNG_FOR "Champs %d trop long pour %s ligne %d de %s" +#define MSG_FLT_BAD_RESULT "Virgule flottante: résultat inexacte" +#define MSG_FLT_DENORMAL_OP "Opérande virgule flottante non normalisé" +#define MSG_FLT_INVALID_OP "Opération virgule flottante invalide" +#define MSG_FLT_OVERFLOW "Dépassement de capacité virgule flottante" +#define MSG_FLT_STACK_CHECK "Virgule flottante: Erreur de la pile" +#define MSG_FLT_UNDERFLOW "Sous-dépassement de capacité virgule flottante" +#define MSG_FLT_ZERO_DIVIDE "Virgule flottante: division par zéro" +#define MSG_FMT_WRITE_NIY "L'écriture des fichiers %s n'est pas encore implémentée" +#define MSG_FOXPRO_FILE "Fichier FoxPro: " +#define MSG_FPUTS_ERROR "Erreur dans fputs: %s" +#define MSG_FSEEK_ERROR "Erreur dans fseek: %s" +#define MSG_FSETPOS_ERROR "Erreur dans fseek pour i=%d" +#define MSG_FTELL_ERROR "Erreur dans ftell enregistrement=%d: %s" +#define MSG_FUNCTION_ERROR "Erreur dans %s: %d" +#define MSG_FUNC_ERRNO "Erreur %d dans %s" +#define MSG_FUNC_ERROR "Erreur dans %s" +#define MSG_FUNC_ERR_S "Erreur dans %s: %s" +#define MSG_FWRITE_ERROR "Erreur dans fwrite: %s" +#define MSG_GET_DIST_VALS "Récupération des valeurs distinctes de " +#define MSG_GET_FUNC_ERR "Erreur en recherche de la fonction %s: %s" +#define MSG_GLOBAL_ERROR "Erreur d'allocation de Global (taille=%d)\n" +#define MSG_GUARD_PAGE "Violation de page de garde" +#define MSG_GZOPEN_ERROR "gzopen %s: erreur %d sur %s" +#define MSG_ILLEGAL_INSTR "Instruction illégale" +#define MSG_ILL_FILTER_CONV "Conversion implicite illégale dans un filtre" +#define MSG_INDEX_NOT_UNIQ "L'index n'est pas Unique" +#define MSG_INDEX_YET_ON "L'index %s existe déjà sur %s" +#define MSG_INDX_COL_NOTIN "La colonne index %s n'existe pas dans la table %s" +#define MSG_INDX_EXIST_YET "L'entrée index existe déjà" +#define MSG_INIT_FAILED "L'initialisation de %s a échoué" +#define MSG_INT_COL_ERROR "Erreur interne sur la colonne index %s" +#define MSG_INT_OVERFLOW "Dépassement de capacité sur entier" +#define MSG_INT_ZERO_DIVIDE "Division entière par zéro" +#define MSG_INVALID_DISP "Disposition invalide" +#define MSG_INVALID_FTYPE "SBV: Ftype %d invalide" +#define MSG_INVALID_HANDLE "Poignée invalide" +#define MSG_INVALID_OPER "Opérateur invalide %d pour %s" +#define MSG_INV_COLUMN_TYPE "Type %d Invalide pour la colonne %s" +#define MSG_INV_COL_TYPE "Type de colonne %s invalide" +#define MSG_INV_DEF_READ "Lecture différée invalide rc=%d" +#define MSG_INV_DIRCOL_OFST "Offset invalide pour une colonne DIR" +#define MSG_INV_MAP_POS "Position mémoire invalide" +#define MSG_INV_RAND_ACC "L'accès aléatoire d'une table non optimisée est impossible" +#define MSG_INV_REC_POS "Position d'enregistrement invalide" +#define MSG_INV_RESULT_TYPE "Type de résultat invalide %s" +#define MSG_INV_UPDT_TABLE "Table %s invalide pour Update" +#define MSG_IN_WITHOUT_SUB "IN ou EXISTS sans tableau ou subquery" +#define MSG_KEY_ALLOC_ERR "Erreur d'allocation d'un bloc offset clé" +#define MSG_KEY_ALLOC_ERROR "Erreur d'allocation mémoire, Klen=%d n=%d" +#define MSG_LINE_TOO_LONG "La nouvelle ligne est trop longue" +#define MSG_LIST "--Liste--" +#define MSG_LOADING_FAILED "Le chargement de %s a échoué" +#define MSG_LRECL_TOO_SMALL "Lrecl trop petit (longueur en-tête = %d)" +#define MSG_MAKE_EMPTY_FILE "Génération du fichier vide %s: %s" +#define MSG_MAKING "Génération" +#define MSG_MALLOC_ERROR "Allocation mémoire impossible par %s" +#define MSG_MAP_VIEW_ERROR "MapViewOfFile %s erreur rc=%d" +#define MSG_MAXSIZE_ERROR "Maxsize incalculable sur table ouverte" +#define MSG_MEM_ALLOC_ERR "Erreur d'allocation mémoire, taille %s = %d" +#define MSG_MEM_ALLOC_ERROR "Erreur d'allocation mémoire" +#define MSG_MISPLACED_QUOTE "Appostrophe mal placée ligne %d" +#define MSG_MISSING_ARG "Argument manquant pour l'opérateur %d" +#define MSG_MISSING_FIELD "Champs %d manquant dans %s ligne %d" +#define MSG_MISSING_FNAME "Nom du fichier manquant" +#define MSG_MISSING_NODE "Noeud %s manquant dans %s" +#define MSG_MISSING_ROWNODE "Impossible de trouver le noeud de la ligne %d" +#define MSG_MIS_TAG_LIST "Liste des balises colonne manquante" +#define MSG_MUL_MAKECOL_ERR "Erreur logique dans TABMUL::MakeCol" +#define MSG_NAME_CONV_ERR "Erreur de convertion du nom de noeud" +#define MSG_NEW_DOC_FAILED "Impossible de créer le nouveau document" +#define MSG_NEW_RETURN_NULL "NULL renvoyé par New dans PlugEvalLike" +#define MSG_NEXT_FILE_ERROR "Erreur en recherche du fichier suivant. rc=%s" +#define MSG_NONCONT_EXCEPT "Exception non-continuable" +#define MSG_NOP_ZLIB_INDEX "L'indexage d'une table zlib non optimisée est impossible" +#define MSG_NOT_A_DBF_FILE "Le fichier n'a pas le format dBASE dbf " +#define MSG_NOT_FIXED_LEN "Fichier %s non fixe, len=%d lrecl=%d" +#define MSG_NO_0DH_HEAD "0DH manquant en fin d'en-tête (dbc=%d)" +#define MSG_NO_ACTIVE_DB "Pas de base de données active" +#define MSG_NO_CHAR_FROM "Conversion de type %d en caractères impossible" +#define MSG_NO_DATE_FMT "Pas de format date pour le valblock de type %d" +#define MSG_NO_DEF_FNCCOL "Colonne fonction par défaut introuvable" +#define MSG_NO_DEF_PIVOTCOL "Colonne pivot par défaut introuvable" +#define MSG_NO_DIR_INDX_RD "Pas d'accès directe des tables %s" +#define MSG_NO_FEAT_SUPPORT "%s non supporté dans cette version" +#define MSG_NO_FLD_FORMAT "Format absent pour le champs %d de %s" +#define MSG_NO_FORMAT_COL "Type COLUMN informattable" +#define MSG_NO_FORMAT_TYPE "Le format ne peut pas être défini à partir du type %d" +#define MSG_NO_INDEX_READ "Pas d'accès directe des tables multiples" +#define MSG_NO_KEY_COL "Pas de colonne clé trouvée" +#define MSG_NO_KEY_UPDATE "Le nom des clés ne peut pas être modifié" +#define MSG_NO_MAP_INSERT "MAP incompatible avec Insert" +#define MSG_NO_MATCHING_COL "Pas de colonne correspondant à %s dans %s" +#define MSG_NO_MATCH_COL "Colonne correspondante introuvable" +#define MSG_NO_MEMORY "Mémoire pleine" +#define MSG_NO_MODE_PADDED "Mode non supporté pour les fichiers 'padded'" +#define MSG_NO_MUL_VCT "Les tables VCT ne peuvent pas être multiples" +#define MSG_NO_ODBC_DELETE "Delete ne devrait pas être appelé pour les tables ODBC" +#define MSG_NO_ODBC_DIRECT "Accès directe des tables ODBC non encore implémenté" +#define MSG_NO_ODBC_MUL "Multiple(2) non supporté pour les tables ODBC" +#define MSG_NO_ODBC_SPECOL "Pas de colonne spéciale ODBC" +#define MSG_NO_PART_DEL "Delete partiel des fichier %s impossible" +#define MSG_NO_PART_MAP "Mapping partiel non implémenté pour cet OS" +#define MSG_NO_PAR_BLK_INS "Insertion de bloc partiel impossible" +#define MSG_NO_PIV_DIR_ACC "Pas d'accès directe aux tables PIVOT" +#define MSG_NO_READ_32 "Lecture de 32 octets impossible" +#define MSG_NO_RECOV_SPACE "Espace non recouvrable dans le fichier index" +#define MSG_NO_ROWID_FOR_AM "Accès direct impossible de ROWID pour les tables de type %s" +#define MSG_NO_ROW_NODE "Le nom du Rownode n'est pas défini" +#define MSG_NO_SECTION_NAME "Nom de section manquant" +#define MSG_NO_SEC_UPDATE "Les noms de section ne peuvent pas être modifiés" +#define MSG_NO_SETPOS_YET "SetPos pas encore implémenté pour les fichier %s" +#define MSG_NO_SPEC_COL "Pas de colonne spéciales MYSQL" +#define MSG_NO_SUB_VAL "Pas de sous-value d'un tableau de type %d" +#define MSG_NO_TABCOL_DATA "Pas de données pour la table %s colonne %s" +#define MSG_NO_TABLE_DEL "Delete non autorisé pour les tables %s " +#define MSG_NO_TAB_DATA "Pas de données pour la table %s" +#define MSG_NO_VCT_DELETE "Délétion Partielle non implémentée pour les fichiers VCT" +#define MSG_NO_ZIP_DELETE "Delete sur fichier Zip non encore implementé" +#define MSG_OPENING "Ouverture" +#define MSG_OPEN_EMPTY_FILE "Ouverture du fichier vide %s: %s" +#define MSG_OPEN_ERROR "Erreur d'ouverture %d en mode %d sur %s: " +#define MSG_OPEN_ERROR_IS "Erreur à l'ouverture de %s: %s" +#define MSG_OPEN_MODE_ERROR "Erreur d'ouverture(%s) %d sur %s" +#define MSG_OPEN_STRERROR "Erreur à l'ouverture: %s" +#define MSG_OPTBLK_RD_ERR "Erreur à la lecture d'un bloc optimisation: %s" +#define MSG_OPTBLK_WR_ERR "Erreur à l'écriture d'un bloc optimisation: %s" +#define MSG_OPTIMIZING "Optimisation de " +#define MSG_OPT_BMAP_RD_ERR "Erreur en lecture des bitmaps d'optimisation: %s" +#define MSG_OPT_BMAP_WR_ERR "Erreur en écriture des bitmaps d'optimisation: %s" +#define MSG_OPT_CANCELLED "Optimisation interrompue par l'utilisateur" +#define MSG_OPT_DVAL_RD_ERR "Erreur en lecture des valeurs distinctes: %s" +#define MSG_OPT_DVAL_WR_ERR "Erreur en écriture des valeurs distinctes: %s" +#define MSG_OPT_HEAD_RD_ERR "Erreur en lecture de l'entête du fichier opt: %s" +#define MSG_OPT_HEAD_WR_ERR "Erreur en écriture de l'entête du fichier opt: %s" +#define MSG_OPT_LOGIC_ERR "Erreur logique dans SetBitmap, i=%d" +#define MSG_OPT_MAX_RD_ERR "Erreur en lecture des valeurs maxi: %s" +#define MSG_OPT_MAX_WR_ERR "Erreur en écriture des valeurs maxi: %s" +#define MSG_OPT_MIN_RD_ERR "Erreur en lecture des valeurs mini: %s" +#define MSG_OPT_MIN_WR_ERR "Erreur en écriture des valeurs mini: %s" +#define MSG_OPT_NOT_MATCH "Le fichier opt %s n'est pas à jour" +#define MSG_PAGE_ERROR "Erreur de pagination" +#define MSG_PARM_CNT_MISS "Disparité du nombre de Paramètres" +#define MSG_PREC_VBLP_NULL "ARRAY SetPrecision: Vblp est NULL" +#define MSG_PRIV_INSTR "Instruction privilégiée" +#define MSG_PROCADD_ERROR "Erreur %d sur l'adresse de %s" +#define MSG_QUERY_CANCELLED "Requête interrompue par l'utilisateur" +#define MSG_RANGE_NO_JOIN "Range non compatible avec les index de jointure" +#define MSG_RC_READING "rc=%d en lecture de la table %s" +#define MSG_READY "Prêt" +#define MSG_READ_ERROR "Erreur en lecture sur %s: %s" +#define MSG_READ_ONLY "Cette table protégée en lecture seule ne peut être modifiée" +#define MSG_READ_SEEK_ERROR "Erreur de recherche en lecture: %s" +#define MSG_REGISTER_ERR "Enregistrement NS impossible, préfix='%s' et href='%s'" +#define MSG_REMOVE_ERROR "Erreur en supprimant %s: %s" +#define MSG_RENAME_ERROR "Erreur renommant %s en %s: %s" +#define MSG_ROWID_NOT_IMPL "RowNumber non implémenté pour les tables de type %s" +#define MSG_SEC_KEY_FIRST "Les sections et clés doivent être insérées en premier" +#define MSG_SEC_NAME_FIRST "Le nom de section doit être en tête de liste en insertion" +#define MSG_SEP_IN_FIELD "Le champ %d contient le caractère séparateur" +#define MSG_SEQUENCE_ERROR "HSTMT: Allocation hors séquence" +#define MSG_SETEOF_ERROR "Erreur %d dans SetEndOfFile" +#define MSG_SETRECPOS_NIY "SetRecpos non implémenté pour ce type de table" +#define MSG_SET_STR_TRUNC "SetValue: Chaîne de caractères tronquée" +#define MSG_SFP_ERROR "Erreur sur SetFilePointer: %s" +#define MSG_SHARED_LIB_ERR "Erreur au chargement de la librairie partagée %s: %s" +#define MSG_SINGLE_STEP "Pas à pas" +#define MSG_SORTING_VAL "Tri de %d valeurs" +#define MSG_SPCOL_READONLY "La colonne spéciale %s est en lecture seulement" +#define MSG_SQL_CONF_ERROR "Erreur SQL: SQL_CONFORMANCE" +#define MSG_SRCH_CLOSE_ERR "Erreur à la fermeture de l'Handle de recherche" +#define MSG_SRC_TABLE_UNDEF "La table source n'est pas définie" +#define MSG_STACK_OVERFLOW "Dépassement de capacité de la pile" +#define MSG_TABDIR_READONLY "Les tables DIR sont en lecture seulement" +#define MSG_TABLE_NOT_OPT "Table non optimisable" +#define MSG_TABLE_NO_INDEX "La table %s n'est pas indexable" +#define MSG_TABLE_READ_ONLY "Les tables %s sont en lecture seulement " +#define MSG_TABMUL_READONLY "Les tables multiples sont en lecture seulement" +#define MSG_TOO_MANY_FIELDS "Trop de champs ligne %d de %s" +#define MSG_TOO_MANY_JUMPS "Trop de niveaux de saut" +#define MSG_TOO_MANY_KEYS "Trop de clés (%d)" +#define MSG_TO_BLK_IS_NULL "To Blk est nul" +#define MSG_TRUNCATE_ERROR "Erreur en troncation: %s" +#define MSG_TRUNC_BY_ESTIM "Tronqué par l'option Estimate" +#define MSG_TYPE_MISMATCH "Clé et source ne sont pas du même type" +#define MSG_TYPE_VALUE_ERR "Colonne %s: disparité type(%s)/valeur(%s)" +#define MSG_UNBALANCE_QUOTE "Appostrophe en trop ligne %d" +#define MSG_UNDEFINED_AM "COLBLK %s: méthode d'accès indéfinie" +#define MSG_UNKNOWN_EXCPT "Exception non répertoriée" +#define MSG_UNMATCH_FIL_ARG "Argument de filtre dépareillé" +#define MSG_UPDATE_ERROR "Erreur en Update sur %s" +#define MSG_UPD_ZIP_NOT_IMP "Mise à jour des tables ZDOS non encore implementé" +#define MSG_VALSTR_TOO_LONG "Valeur %s trop longue pour une chaîne de longueur %d" +#define MSG_VALTYPE_NOMATCH "Disparité types de valeur" +#define MSG_VALUE_ERROR "Colonne %s: bloc valeur nul" +#define MSG_VALUE_TOO_BIG "Valeur %lld trop grande pour la colonne %s" +#define MSG_VALUE_TOO_LONG "Valeur %s trop longue pour la colonne %s de longueur %d" +#define MSG_VAL_ALLOC_ERR "Allocation impossible du noeud valeur" +#define MSG_VIR_NO_DELETE "Delete impossible sur les tables %s" +#define MSG_VIR_READ_ONLY "Les tables virtuelles %s sont en lecture seulement" +#define MSG_VOID_FIRST_ARG "Le premier argument ne doit pas être vide" +#define MSG_WORK_AREA "Espace de travail: %s" +#define MSG_WRITE_SEEK_ERR "Erreur de recherche en écriture: %s" +#define MSG_WRITE_STRERROR "Erreur en écriture sur %s: %s" +#define MSG_WRITING "Ecriture" +#define MSG_WRITING_ERROR "Erreur à l'écriture de %s: %s" +#define MSG_WS_CONV_ERR "Erreur de convertion de %s en WS" +#define MSG_XCOL_MISMATCH "La colonne %s ne correspond pas à l'index" +#define MSG_XFILE_READERR "Erreur %d en lisant le fichier index" +#define MSG_XFILE_WRITERR "Erreur en écrivant le fichier index: %s" +#define MSG_XMLTAB_INIT_ERR "Erreur d'initialisation de la table XML" +#define MSG_XML_INIT_ERROR "Erreur d'initialisation du nouveau fichier XML" +#define MSG_XPATH_CNTX_ERR "Le nouveau contexte XPath ne peut être créé" +#define MSG_XPATH_EVAL_ERR "Impossible d'évaluer l'emplacement xpath '%s'" +#define MSG_XPATH_NOT_SUPP "Xpath non supporté colonne %s" diff --git a/storage/connect/global.h b/storage/connect/global.h index d35cef2de6f..88e5094d6d2 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -24,11 +24,13 @@ #endif #if defined(XMSG) +//#error Option XMSG is not yet fully implemented // Definition used to read messages from message file. #include "msgid.h" #define MSG(I) PlugReadMessage(NULL, MSG_##I, #I) #define STEP(I) PlugReadMessage(g, MSG_##I, #I) #elif defined(NEWMSG) +//#error Option NEWMSG is not yet fully implemented // Definition used to get messages from resource. #include "msgid.h" #define MSG(I) PlugGetMessage(NULL, MSG_##I) @@ -46,6 +48,11 @@ #define CRLF 1 #endif // !WIN32 +/***********************************************************************/ +/* Define access to the thread based trace value. */ +/***********************************************************************/ +#define trace GetTraceValue() + /***********************************************************************/ /* Miscellaneous Constants */ /***********************************************************************/ @@ -205,7 +212,10 @@ typedef struct _activity { /* Describes activity and language */ /*---------------- UNIT ?????????? VERSION ? ----------------------*/ typedef struct _parm { - void *Value; + union { + void *Value; + int Intval; + }; // end union short Type, Domain; PPARM Next; } PARM; @@ -252,6 +262,7 @@ DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t); DllExport char *PlugDup(PGLOBAL g, const char *str); DllExport void *MakePtr(void *, OFFSET); DllExport void htrc(char const *fmt, ...); +DllExport int GetTraceValue(void); #if defined(__cplusplus) } // extern "C" diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 2e1d59ff632..ebf286a049b 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,8 +170,8 @@ #define SZWMIN 4194304 // Minimum work area size 4M extern "C" { - char version[]= "Version 1.03.0003 August 22, 2014"; - char compver[]= "Version 1.03.0003 " __DATE__ " " __TIME__; + char version[]= "Version 1.03.0005 November 08, 2014"; + char compver[]= "Version 1.03.0005 " __DATE__ " " __TIME__; #if defined(WIN32) char slash= '\\'; @@ -179,65 +179,172 @@ extern "C" { char slash= '/'; #endif // !WIN32 -#if defined(XMSG) - char msglang[]; // Default message language -#endif - int trace= 0; // The general trace value - int xconv= 0; // The type conversion option - int zconv= SZCONV; // The text conversion size - USETEMP Use_Temp= TMP_AUTO; // The temporary file use +// int trace= 0; // The general trace value + ulong xconv= 0; // The type conversion option + int zconv= 0; // The text conversion size } // extern "C" #if defined(XMAP) - bool xmap= false; + my_bool xmap= false; #endif // XMAP - bool xinfo= false; - uint worksize= SZWORK; +// uint worksize= 0; ulong ha_connect::num= 0; //int DTVAL::Shift= 0; /* CONNECT system variables */ -static int xtrace= 0; -static int conv_size= SZCONV; -static uint work_size= SZWORK; -static ulong type_conv= 0; -static ulong use_tempfile= 1; +//atic int conv_size= 0; +//atic uint work_size= 0; +//atic ulong type_conv= 0; #if defined(XMAP) -static my_bool indx_map= 0; +//atic my_bool indx_map= 0; #endif // XMAP -static my_bool exact_info= 0; +#if defined(XMSG) +extern "C" { + char *msg_path; +} // extern "C" +#endif // XMSG /***********************************************************************/ /* Utility functions. */ /***********************************************************************/ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); -void PushWarning(PGLOBAL g, THD *thd, int level); -bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, - const char *db, char *tab, const char *src, int port); - +PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info); +void PushWarning(PGLOBAL g, THD *thd, int level); +bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, + const char *db, char *tab, const char *src, int port); +bool ExactInfo(void); +USETEMP UseTemp(void); +uint GetWorkSize(void); +void SetWorkSize(uint); +extern "C" const char *msglang(void); static PCONNECT GetUser(THD *thd, PCONNECT xp); static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); static handler *connect_create_handler(handlerton *hton, - TABLE_SHARE *table, - MEM_ROOT *mem_root); + TABLE_SHARE *table, + MEM_ROOT *mem_root); static int connect_assisted_discovery(handlerton *hton, THD* thd, TABLE_SHARE *table_s, HA_CREATE_INFO *info); +/****************************************************************************/ +/* Return str as a zero terminated string. */ +/****************************************************************************/ +static char *strz(PGLOBAL g, LEX_STRING &ls) +{ + char *str= (char*)PlugSubAlloc(g, NULL, ls.length + 1); + + memcpy(str, ls.str, ls.length); + str[ls.length]= 0; + return str; +} // end of strz + +/***********************************************************************/ +/* CONNECT session variables definitions. */ +/***********************************************************************/ +// Tracing: 0 no, 1 yes, >1 more tracing +static MYSQL_THDVAR_INT(xtrace, + PLUGIN_VAR_RQCMDARG, "Console trace value.", + NULL, NULL, 0, 0, INT_MAX, 1); + +// Getting exact info values +static MYSQL_THDVAR_BOOL(exact_info, PLUGIN_VAR_RQCMDARG, + "Getting exact info values", + NULL, NULL, 0); + +/** + Temporary file usage: + no: Not using temporary file + auto: Using temporary file when needed + yes: Allways using temporary file + force: Force using temporary file (no MAP) + test: Reserved +*/ +const char *usetemp_names[]= +{ + "NO", "AUTO", "YES", "FORCE", "TEST", NullS +}; + +TYPELIB usetemp_typelib= +{ + array_elements(usetemp_names) - 1, "usetemp_typelib", + usetemp_names, NULL +}; + +static MYSQL_THDVAR_ENUM( + use_tempfile, // name + PLUGIN_VAR_RQCMDARG, // opt + "Temporary file use.", // comment + NULL, // check + NULL, // update function + 1, // def (AUTO) + &usetemp_typelib); // typelib + +// Size used for g->Sarea_Size +static MYSQL_THDVAR_UINT(work_size, + PLUGIN_VAR_RQCMDARG, + "Size of the CONNECT work area.", + NULL, NULL, SZWORK, SZWMIN, UINT_MAX, 1); + +#if defined(XMSG) || defined(NEWMSG) +const char *language_names[]= +{ + "default", "english", "french", NullS +}; + +TYPELIB language_typelib= +{ + array_elements(language_names) - 1, "language_typelib", + language_names, NULL +}; + +static MYSQL_THDVAR_ENUM( + msg_lang, // name + PLUGIN_VAR_RQCMDARG, // opt + "Message language", // comment + NULL, // check + NULL, // update + 1, // def (ENGLISH) + &language_typelib); // typelib +#endif // XMSG || NEWMSG + +/***********************************************************************/ +/* Function to export session variable values to other source files. */ +/***********************************************************************/ +extern "C" int GetTraceValue(void) {return THDVAR(current_thd, xtrace);} +bool ExactInfo(void) {return THDVAR(current_thd, exact_info);} +USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);} +uint GetWorkSize(void) {return THDVAR(current_thd, work_size);} +void SetWorkSize(uint n) +{ + // Changing the session variable value seems to be impossible here + // and should be done in a check function + push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, + "Work size too big, try setting a smaller value"); +} // end of SetWorkSize +#if defined(XMSG) || defined(NEWMSG) +extern "C" const char *msglang(void) +{ + return language_names[THDVAR(current_thd, msg_lang)]; +} // end of msglang +#else // !XMSG && !NEWMSG +extern "C" const char *msglang(void) +{ +#if defined(FRENCH) + return "french"; +#else // DEFAULT + return "english"; +#endif // DEFAULT +} // end of msglang +#endif // !XMSG && !NEWMSG + +#if 0 /***********************************************************************/ /* Global variables update functions. */ /***********************************************************************/ -static void update_connect_xtrace(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save) -{ - trace= *(int *)var_ptr= *(int *)save; -} // end of update_connect_xtrace - static void update_connect_zconv(MYSQL_THD thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save) @@ -252,35 +359,57 @@ static void update_connect_xconv(MYSQL_THD thd, xconv= (int)(*(ulong *)var_ptr= *(ulong *)save); } // end of update_connect_xconv -static void update_connect_worksize(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save) -{ - worksize= (uint)(*(ulong *)var_ptr= *(ulong *)save); -} // end of update_connect_worksize - -static void update_connect_usetemp(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save) -{ - Use_Temp= (USETEMP)(*(ulong *)var_ptr= *(ulong *)save); -} // end of update_connect_usetemp - #if defined(XMAP) static void update_connect_xmap(MYSQL_THD thd, struct st_mysql_sys_var *var, void *var_ptr, const void *save) { - xmap= (bool)(*(my_bool *)var_ptr= *(my_bool *)save); + xmap= (my_bool)(*(my_bool *)var_ptr= *(my_bool *)save); } // end of update_connect_xmap #endif // XMAP +#endif // 0 -static void update_connect_xinfo(MYSQL_THD thd, - struct st_mysql_sys_var *var, - void *var_ptr, const void *save) +#if 0 // (was XMSG) Unuseful because not called for default value +static void update_msg_path(MYSQL_THD thd, + struct st_mysql_sys_var *var, + void *var_ptr, const void *save) { - xinfo= (bool)(*(my_bool *)var_ptr= *(my_bool *)save); -} // end of update_connect_xinfo + char *value= *(char**)save; + char *old= *(char**)var_ptr; + + if (value) + *(char**)var_ptr= my_strdup(value, MYF(0)); + else + *(char**)var_ptr= 0; + + my_free(old); +} // end of update_msg_path + +static int check_msg_path (MYSQL_THD thd, struct st_mysql_sys_var *var, + void *save, struct st_mysql_value *value) +{ + const char *path; + char buff[512]; + int len= sizeof(buff); + + path= value->val_str(value, buff, &len); + + if (path && *path != '*') { + /* Save a pointer to the name in the + 'file_format_name_map' constant array. */ + *(char**)save= my_strdup(path, MYF(0)); + return(0); + } else { + push_warning_printf(thd, + Sql_condition::WARN_LEVEL_WARN, + ER_WRONG_ARGUMENTS, + "CONNECT: invalid message path"); + } // endif path + + *(char**)save= NULL; + return(1); +} // end of check_msg_path +#endif // 0 /***********************************************************************/ /* The CONNECT handlerton object. */ @@ -451,10 +580,25 @@ static int connect_init_func(void *p) { DBUG_ENTER("connect_init_func"); - sql_print_information("CONNECT: %s", compver); +// added from Sergei mail +#if 0 // (defined(LINUX)) + Dl_info dl_info; + if (dladdr(&connect_hton, &dl_info)) + { + if (dlopen(dl_info.dli_fname, RTLD_NOLOAD | RTLD_NOW | RTLD_GLOBAL) == 0) + { + sql_print_information("CONNECT: dlopen() failed, OEM table type is not supported"); + sql_print_information("CONNECT: %s", dlerror()); + } + } + else + { + sql_print_information("CONNECT: dladdr() failed, OEM table type is not supported"); + sql_print_information("CONNECT: %s", dlerror()); + } +#endif // 0 (LINUX) - // xtrace is now a system variable - trace= xtrace; + sql_print_information("CONNECT: %s", compver); #ifdef LIBXML2_SUPPORT XmlInitParserLib(); @@ -473,7 +617,7 @@ static int connect_init_func(void *p) connect_hton->tablefile_extensions= ha_connect_exts; connect_hton->discover_table_structure= connect_assisted_discovery; - if (xtrace) + if (trace) sql_print_information("connect_init: hton=%p", p); DTVAL::SetTimeShift(); // Initialize time zone shift once for all @@ -546,9 +690,10 @@ static handler* connect_create_handler(handlerton *hton, { handler *h= new (mem_root) ha_connect(hton, table); - if (xtrace) - htrc("New CONNECT %p, table: %s\n", - h, table ? table->table_name.str : ""); + if (trace) + htrc("New CONNECT %p, table: %.*s\n", h, + table ? table->table_name.length : 6, + table ? table->table_name.str : ""); return h; } // end of connect_create_handler @@ -601,8 +746,9 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg) /****************************************************************************/ ha_connect::~ha_connect(void) { - if (xtrace) - htrc("Delete CONNECT %p, table: %s, xp=%p count=%d\n", this, + if (trace) + htrc("Delete CONNECT %p, table: %.*s, xp=%p count=%d\n", this, + table ? table->s->table_name.length : 6, table ? table->s->table_name.str : "", xp, xp ? xp->count : 0); @@ -711,6 +857,7 @@ const char *ha_connect::index_type(uint inx) return "XINDEX"; case 2: return "REMOTE"; + case 3: return "VIRTUAL"; } // endswitch return "Unknown"; @@ -867,10 +1014,11 @@ char *ha_connect::GetStringOption(char *opname, char *sdef) PTOS options= GetTableOptionStruct(); if (!stricmp(opname, "Connect")) { - LEX_STRING cnc= (tshp) ? tshp->connect_string : table->s->connect_string; + LEX_STRING cnc= (tshp) ? tshp->connect_string + : table->s->connect_string; if (cnc.length) - opval= GetRealString(cnc.str); + opval= GetRealString(strz(xp->g, cnc)); } else if (!stricmp(opname, "Query_String")) opval= thd_query_string(table->in_use)->str; @@ -960,6 +1108,8 @@ bool ha_connect::GetBooleanOption(char *opname, bool bdef) opval= options->readonly; else if (!stricmp(opname, "SepIndex")) opval= options->sepindex; + else if (!stricmp(opname, "Header")) + opval= (options->header != 0); // Is Boolean for some table types else if (options->oplist) if ((pv= GetListOption(xp->g, opname, options->oplist))) opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0); @@ -1184,6 +1334,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Length= (len) ? len : 11; } // endelse + // For Value setting + pcf->Precision= MY_MAX(pcf->Precision, pcf->Length); break; default: break; @@ -1206,11 +1358,9 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Key= 0; // Not used when called from MySQL // Get the comment if any - if (fp->comment.str && fp->comment.length) { - pcf->Remark= (char*)PlugSubAlloc(g, NULL, fp->comment.length + 1); - memcpy(pcf->Remark, fp->comment.str, fp->comment.length); - pcf->Remark[fp->comment.length]= 0; - } else + if (fp->comment.str && fp->comment.length) + pcf->Remark= strz(g, fp->comment); + else pcf->Remark= NULL; return fldp; @@ -1238,8 +1388,8 @@ bool ha_connect::GetIndexOption(KEY *kp, char *opname) else if (!stricmp(opname, "Mapped")) opval= options->mapped; - } else if (kp->comment.str != NULL) { - char *pv, *oplist= kp->comment.str; + } else if (kp->comment.str && kp->comment.length) { + char *pv, *oplist= strz(xp->g, kp->comment); if ((pv= GetListOption(xp->g, opname, oplist))) opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0); @@ -1276,7 +1426,7 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s) s= table->s; for (int n= 0; (unsigned)n < s->keynames.count; n++) { - if (xtrace) + if (trace) htrc("Getting created index %d info\n", n + 1); // Find the index to describe @@ -1336,6 +1486,42 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s) return toidx; } // end of GetIndexInfo +/****************************************************************************/ +/* Returns the index description structure used to make the index. */ +/****************************************************************************/ +bool ha_connect::CheckVirtualIndex(TABLE_SHARE *s) +{ + + char *rid; + KEY kp; + Field *fp; + PGLOBAL& g= xp->g; + + if (!s) + s= table->s; + + for (int n= 0; (unsigned)n < s->keynames.count; n++) { + kp= s->key_info[n]; + + // Now get index information + + // Get the the key parts info + for (int k= 0; (unsigned)k < kp.user_defined_key_parts; k++) { + fp= kp.key_part[k].field; + rid= (fp->option_struct) ? fp->option_struct->special : NULL; + + if (!rid || (stricmp(rid, "ROWID") && stricmp(rid, "ROWNUM"))) { + strcpy(g->Message, "Invalid virtual index"); + return true; + } // endif rowid + + } // endfor k + + } // endfor n + + return false; +} // end of CheckVirtualIndex + bool ha_connect::IsPartitioned(void) { if (tshp) @@ -1354,7 +1540,7 @@ const char *ha_connect::GetDBName(const char* name) const char *ha_connect::GetTableName(void) { - return (tshp) ? tshp->table_name.str : table_share->table_name.str; + return tshp ? tshp->table_name.str : table_share->table_name.str; } // end of GetTableName char *ha_connect::GetPartName(void) @@ -1647,7 +1833,7 @@ int ha_connect::MakeRecord(char *buf) PCOL colp= NULL; DBUG_ENTER("ha_connect::MakeRecord"); - if (xtrace > 1) + if (trace > 1) htrc("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n", *table->read_set->bitmap, *table->write_set->bitmap, *table->vcol_set->bitmap, @@ -1836,6 +2022,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf) } // endswitch type ((DTVAL*)sdvalin)->SetFormat(g, fmt, strlen(fmt)); + sdvalin->SetNullable(colp->IsNullable()); fp->val_str(&attribute); sdvalin->SetValue_psz(attribute.c_ptr_safe()); value->SetValue_pval(sdvalin); @@ -2076,14 +2263,14 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) if (!cond) return NULL; - if (xtrace) + if (trace) htrc("Cond type=%d\n", cond->type()); if (cond->type() == COND::COND_ITEM) { PFIL fp; Item_cond *cond_item= (Item_cond *)cond; - if (xtrace) + if (trace) htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(), cond_item->func_name()); @@ -2117,9 +2304,9 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) Item_func *condf= (Item_func *)cond; Item* *args= condf->arguments(); - if (xtrace) + if (trace) htrc("Func type=%d argnum=%d\n", condf->functype(), - condf->argument_count()); + condf->argument_count()); switch (condf->functype()) { case Item_func::EQUAL_FUNC: @@ -2146,11 +2333,11 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) return NULL; for (i= 0; i < condf->argument_count(); i++) { - if (xtrace) + if (trace) htrc("Argtype(%d)=%d\n", i, args[i]->type()); if (i >= 2 && !ismul) { - if (xtrace) + if (trace) htrc("Unexpected arg for vop=%d\n", vop); continue; @@ -2167,10 +2354,10 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) !(colp[i]= tdbp->ColDB(g, (PSZ)pField->field->field_name, 0))) return NULL; // Column does not belong to this table - if (xtrace) { + if (trace) { htrc("Field index=%d\n", pField->field->field_index); htrc("Field name=%s\n", pField->field->field_name); - } // endif xtrace + } // endif trace } else { char buff[256]; @@ -2187,9 +2374,8 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) switch (args[i]->real_type()) { case COND::STRING_ITEM: - pp->Type= TYPE_STRING; - pp->Value= PlugSubAlloc(g, NULL, res->length() + 1); - strncpy((char*)pp->Value, res->ptr(), res->length() + 1); + pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length()); + pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR; break; case COND::INT_ITEM: pp->Type= TYPE_INT; @@ -2217,7 +2403,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) return NULL; } // endswitch type - if (xtrace) + if (trace) htrc("Value=%.*s\n", res->length(), res->ptr()); // Append the value to the argument list @@ -2235,7 +2421,7 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) filp= MakeFilter(g, colp, pop, pfirst, neg); } else { - if (xtrace) + if (trace) htrc("Unsupported condition\n"); return NULL; @@ -2257,7 +2443,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) if (!cond) return NULL; - if (xtrace) + if (trace) htrc("Cond type=%d\n", cond->type()); if (cond->type() == COND::COND_ITEM) { @@ -2267,7 +2453,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) if (x) return NULL; - if (xtrace) + if (trace) htrc("Cond: Ftype=%d name=%s\n", cond_item->functype(), cond_item->func_name()); @@ -2314,7 +2500,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) Item_func *condf= (Item_func *)cond; Item* *args= condf->arguments(); - if (xtrace) + if (trace) htrc("Func type=%d argnum=%d\n", condf->functype(), condf->argument_count()); @@ -2345,11 +2531,11 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) return NULL; for (i= 0; i < condf->argument_count(); i++) { - if (xtrace) + if (trace) htrc("Argtype(%d)=%d\n", i, args[i]->type()); if (i >= 2 && !ismul) { - if (xtrace) + if (trace) htrc("Unexpected arg for vop=%d\n", vop); continue; @@ -2381,10 +2567,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) else fnm= pField->field->field_name; - if (xtrace) { + if (trace) { htrc("Field index=%d\n", pField->field->field_index); htrc("Field name=%s\n", pField->field->field_name); - } // endif xtrace + } // endif trace // IN and BETWEEN clauses should be col VOP list if (i && ismul) @@ -2420,7 +2606,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) if ((res= pval->val_str(&tmp)) == NULL) return NULL; // To be clarified - if (xtrace) + if (trace) htrc("Value=%.*s\n", res->length(), res->ptr()); // IN and BETWEEN clauses should be col VOP list @@ -2430,14 +2616,14 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) if (!x) { // Append the value to the filter if (args[i]->field_type() == MYSQL_TYPE_VARCHAR) - strcat(strcat(strcat(body, "'"), res->ptr()), "'"); + strcat(strncat(strcat(body, "'"), res->ptr(), res->length()), "'"); else strncat(body, res->ptr(), res->length()); } else { if (args[i]->field_type() == MYSQL_TYPE_VARCHAR) { // Add the command to the list - PCMD *ncp, cmdp= new(g) CMD(g, (char*)res->ptr()); + PCMD *ncp, cmdp= new(g) CMD(g, (char*)res->c_ptr()); for (ncp= &filp->Cmds; *ncp; ncp= &(*ncp)->Next) ; @@ -2465,7 +2651,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) filp->Op= vop; } else { - if (xtrace) + if (trace) htrc("Unsupported condition\n"); return NULL; @@ -2499,6 +2685,7 @@ const COND *ha_connect::cond_push(const COND *cond) DBUG_ENTER("ha_connect::cond_push"); if (tdbp) { + int rc; PGLOBAL& g= xp->g; AMT tty= tdbp->GetAmType(); bool x= (tty == TYPE_AM_MYX || tty == TYPE_AM_XDBC); @@ -2506,6 +2693,16 @@ const COND *ha_connect::cond_push(const COND *cond) tty == TYPE_AM_TBL || tty == TYPE_AM_MYSQL || tty == TYPE_AM_PLG || x); + // Save stack and allocation environment and prepare error return + if (g->jump_level == MAX_JUMP) { + strcpy(g->Message, MSG(TOO_MANY_JUMPS)); + DBUG_RETURN(cond); + } // endif jump_level + + // This should never happen but is done to avoid crashing + if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) + goto fin; + if (b) { PCFIL filp= (PCFIL)PlugSubAlloc(g, NULL, sizeof(CONDFIL)); @@ -2515,7 +2712,7 @@ const COND *ha_connect::cond_push(const COND *cond) filp->Cmds= NULL; if (CheckCond(g, filp, tty, (Item *)cond)) { - if (xtrace) + if (trace) htrc("cond_push: %s\n", filp->Body); if (!x) @@ -2530,6 +2727,8 @@ const COND *ha_connect::cond_push(const COND *cond) } else tdbp->SetFilter(CondFilter(g, (Item *)cond)); + fin: + g->jump_level--; } // endif tdbp // Let MySQL do the filtering @@ -2628,7 +2827,7 @@ int ha_connect::open(const char *name, int mode, uint test_if_locked) int rc= 0; DBUG_ENTER("ha_connect::open"); - if (xtrace) + if (trace) htrc("open: name=%s mode=%d test=%u\n", name, mode, test_if_locked); if (!(share= get_share())) @@ -2840,7 +3039,7 @@ int ha_connect::update_row(const uchar *old_data, uchar *new_data) PGLOBAL& g= xp->g; DBUG_ENTER("ha_connect::update_row"); - if (xtrace > 1) + if (trace > 1) htrc("update_row: old=%s new=%s\n", old_data, new_data); // Check values for possible change in indexed column @@ -2901,7 +3100,7 @@ int ha_connect::index_init(uint idx, bool sorted) PGLOBAL& g= xp->g; DBUG_ENTER("index_init"); - if (xtrace) + if (trace) htrc("index_init: this=%p idx=%u sorted=%d\n", this, idx, sorted); if (GetIndexType(GetRealType()) == 2) { @@ -2954,7 +3153,7 @@ int ha_connect::index_init(uint idx, bool sorted) rc= 0; } // endif indexing - if (xtrace) + if (trace) htrc("index_init: rc=%d indexing=%d active_index=%d\n", rc, indexing, active_index); @@ -3001,7 +3200,7 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const uchar *key, uint key_len break; } // endswitch RC - if (xtrace > 1) + if (trace > 1) htrc("ReadIndexed: op=%d rc=%d\n", op, rc); table->status= (rc == RC_OK) ? 0 : STATUS_NOT_FOUND; @@ -3044,7 +3243,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len, default: DBUG_RETURN(-1); break; } // endswitch find_flag - if (xtrace > 1) + if (trace > 1) htrc("%p index_read: op=%d\n", this, op); if (indexing > 0) { @@ -3202,7 +3401,7 @@ int ha_connect::rnd_init(bool scan) alter= 1; } // endif xmod - if (xtrace) + if (trace) htrc("rnd_init: this=%p scan=%d xmod=%d alter=%d\n", this, scan, xmod, alter); @@ -3308,7 +3507,7 @@ int ha_connect::rnd_next(uchar *buf) break; } // endswitch RC - if (xtrace > 1 && (rc || !(xp->nrd++ % 16384))) { + if (trace > 1 && (rc || !(xp->nrd++ % 16384))) { ulonglong tb2= my_interval_timer(); double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL; DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n", @@ -3440,7 +3639,7 @@ int ha_connect::info(uint flag) DBUG_ENTER("ha_connect::info"); - if (xtrace) + if (trace) htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info); // tdbp must be available to get updated info @@ -3455,8 +3654,6 @@ int ha_connect::info(uint flag) } // endif xmod // This is necessary for getting file length -// if (cat && table) -// cat->SetDataPath(g, table->s->db.str); if (table) SetDataPath(g, table->s->db.str); else @@ -3646,6 +3843,7 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn) case TAB_PRX: case TAB_OCCUR: case TAB_PIVOT: + case TAB_VIR: return false; } // endswitch type @@ -3681,11 +3879,11 @@ bool ha_connect::IsSameIndex(PIXDEF xp1, PIXDEF xp2) MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, MODE newmode, bool *chk, bool *cras) { - if ((trace= xtrace)) { + if (trace) { LEX_STRING *query_string= thd_query_string(thd); htrc("%p check_mode: cmdtype=%d\n", this, thd_sql_command(thd)); htrc("Cmd=%.*s\n", (int) query_string->length, query_string->str); - } // endif xtrace + } // endif trace // Next code is temporarily replaced until sql_command is set stop= false; @@ -3717,6 +3915,8 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, case SQLCOM_OPTIMIZE: newmode= MODE_READ; break; + case SQLCOM_FLUSH: + locked= 0; case SQLCOM_DROP_TABLE: case SQLCOM_RENAME_TABLE: newmode= MODE_ANY; @@ -3794,7 +3994,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, } // endif's newmode - if (xtrace) + if (trace) htrc("New mode=%d\n", newmode); return newmode; @@ -3869,7 +4069,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) DBUG_ASSERT(thd == current_thd); - if (xtrace) + if (trace) htrc("external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d\n", this, thd, xp, g, lock_type); @@ -3896,6 +4096,8 @@ int ha_connect::external_lock(THD *thd, int lock_type) // This is unlocking, do it by closing the table if (xp->CheckQueryID() && sqlcom != SQLCOM_UNLOCK_TABLES && sqlcom != SQLCOM_LOCK_TABLES + && sqlcom != SQLCOM_FLUSH + && sqlcom != SQLCOM_BEGIN && sqlcom != SQLCOM_DROP_TABLE) { sprintf(g->Message, "external_lock: unexpected command %d", sqlcom); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); @@ -3990,6 +4192,14 @@ int ha_connect::external_lock(THD *thd, int lock_type) rc= 0; } // endif MakeIndex + } else if (((PTDBASE)tdbp)->GetDef()->Indexable() == 3) { + if (CheckVirtualIndex(NULL)) { + // Make it a warning to avoid crash + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + 0, g->Message); + rc= 0; + } // endif Check + } // endif indexable } // endif Tdbp @@ -4044,7 +4254,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) if (cras) g->Createas= 1; // To tell created table to ignore FLAG - if (xtrace) { + if (trace) { #if 0 htrc("xcheck=%d cras=%d\n", xcheck, cras); @@ -4053,7 +4263,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix); #endif // 0 htrc("Calling CntCheckDB db=%s cras=%d\n", GetDBName(NULL), cras); - } // endif xtrace + } // endif trace // Set or reset the good database environment if (CntCheckDB(g, this, GetDBName(NULL))) { @@ -4077,7 +4287,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) // Delay open until used fields are known } // endif tdbp - if (xtrace) + if (trace) htrc("external_lock: rc=%d\n", rc); DBUG_RETURN(rc); @@ -4213,7 +4423,7 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to) THD *thd= current_thd; int sqlcom= thd_sql_command(thd); - if (xtrace) { + if (trace) { if (to) htrc("rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s\n", this, thd, sqlcom, name, to); @@ -4221,7 +4431,7 @@ int ha_connect::delete_or_rename_table(const char *name, const char *to) htrc("delete_table: this=%p thd=%p sqlcom=%d name=%s\n", this, thd, sqlcom, name); - } // endif xtrace + } // endif trace if (to && (filename_to_dbname_and_tablename(to, db, sizeof(db), tabname, sizeof(tabname)) @@ -4321,7 +4531,7 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key, if (index_init(inx, false)) DBUG_RETURN(HA_POS_ERROR); - if (xtrace) + if (trace) htrc("records_in_range: inx=%d indexing=%d\n", inx, indexing); if (indexing > 0) { @@ -4375,85 +4585,8 @@ static char *encode(PGLOBAL g, const char *cnm) @return Return 0 if ok */ -#if defined(NEW_WAY) -static bool add_fields(PGLOBAL g, - THD *thd, - Alter_info *alter_info, - char *name, - int typ, int len, int dec, - uint type_modifier, - char *rem, -// CHARSET_INFO *cs, -// void *vcolinfo, -// engine_option_value *create_options, - int flg, - bool dbf, - char v) -{ - register Create_field *new_field; - char *length, *decimals= NULL; - enum_field_types type; -//Virtual_column_info *vcol_info= (Virtual_column_info *)vcolinfo; - engine_option_value *crop; - LEX_STRING *comment; - LEX_STRING *field_name; - - DBUG_ENTER("ha_connect::add_fields"); - - if (len) { - if (!v && typ == TYPE_STRING && len > 255) - v= 'V'; // Change CHAR to VARCHAR - - length= (char*)PlugSubAlloc(g, NULL, 8); - sprintf(length, "%d", len); - - if (typ == TYPE_DOUBLE) { - decimals= (char*)PlugSubAlloc(g, NULL, 8); - sprintf(decimals, "%d", min(dec, (min(len, 31) - 1))); - } // endif dec - - } else - length= NULL; - - if (!rem) - rem= ""; - - type= PLGtoMYSQL(typ, dbf, v); - comment= thd->make_lex_string(rem, strlen(rem)); - field_name= thd->make_lex_string(name, strlen(name)); - - switch (v) { - case 'Z': type_modifier|= ZEROFILL_FLAG; - case 'U': type_modifier|= UNSIGNED_FLAG; break; - } // endswitch v - - if (flg) { - engine_option_value *start= NULL, *end= NULL; - LEX_STRING *flag= thd->make_lex_string("flag", 4); - - crop= new(thd->mem_root) engine_option_value(*flag, (ulonglong)flg, - &start, &end, thd->mem_root); - } else - crop= NULL; - - if (check_string_char_length(field_name, "", NAME_CHAR_LEN, - system_charset_info, 1)) { - my_error(ER_TOO_LONG_IDENT, MYF(0), field_name->str); /* purecov: inspected */ - DBUG_RETURN(1); /* purecov: inspected */ - } // endif field_name - - if (!(new_field= new Create_field()) || - new_field->init(thd, field_name->str, type, length, decimals, - type_modifier, NULL, NULL, comment, NULL, - NULL, NULL, 0, NULL, crop, true)) - DBUG_RETURN(1); - - alter_info->create_list.push_back(new_field); - DBUG_RETURN(0); -} // end of add_fields -#else // !NEW_WAY static bool add_field(String *sql, const char *field_name, int typ, - int len, int dec, uint tm, const char *rem, + int len, int dec, char *key, uint tm, const char *rem, char *dft, char *xtra, int flag, bool dbf, char v) { char var = (len > 255) ? 'V' : v; @@ -4487,6 +4620,11 @@ static bool add_field(String *sql, const char *field_name, int typ, else if (v == 'Z') error|= sql->append(" ZEROFILL"); + if (key && *key) { + error|= sql->append(" "); + error|= sql->append(key); + } // endif key + if (tm) error|= sql->append(STRING_WITH_LEN(" NOT NULL"), system_charset_info); @@ -4521,7 +4659,6 @@ static bool add_field(String *sql, const char *field_name, int typ, error|= sql->append(','); return error; } // end of add_field -#endif // !NEW_WAY /** Initialise the table share with the new columns. @@ -4529,114 +4666,9 @@ static bool add_field(String *sql, const char *field_name, int typ, @return Return 0 if ok */ -#if defined(NEW_WAY) -//static bool sql_unusable_for_discovery(THD *thd, const char *sql); - -static int init_table_share(THD *thd, - TABLE_SHARE *table_s, - HA_CREATE_INFO *create_info, - Alter_info *alter_info) -{ - KEY *not_used_1; - uint not_used_2; - int rc= 0; - handler *file; - LEX_CUSTRING frm= {0,0}; - - DBUG_ENTER("init_table_share"); - -#if 0 - ulonglong saved_mode= thd->variables.sql_mode; - CHARSET_INFO *old_cs= thd->variables.character_set_client; - Parser_state parser_state; - char *sql_copy; - LEX *old_lex; - Query_arena *arena, backup; - LEX tmp_lex; - - /* - Ouch. Parser may *change* the string it's working on. - Currently (2013-02-26) it is used to permanently disable - conditional comments. - Anyway, let's copy the caller's string... - */ - if (!(sql_copy= thd->strmake(sql, sql_length))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - - if (parser_state.init(thd, sql_copy, sql_length)) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - - thd->variables.sql_mode= MODE_NO_ENGINE_SUBSTITUTION | MODE_NO_DIR_IN_CREATE; - thd->variables.character_set_client= system_charset_info; - old_lex= thd->lex; - thd->lex= &tmp_lex; - - arena= thd->stmt_arena; - - if (arena->is_conventional()) - arena= 0; - else - thd->set_n_backup_active_arena(arena, &backup); - - lex_start(thd); - - if ((error= parse_sql(thd, & parser_state, NULL))) - goto ret; - - if (table_s->sql_unusable_for_discovery(thd, NULL)) { - my_error(ER_SQL_DISCOVER_ERROR, MYF(0), plugin_name(db_plugin)->str, - db.str, table_name.str, sql_copy); - goto ret; - } // endif unusable - - thd->lex->create_info.db_type= plugin_data(db_plugin, handlerton *); - - if (tabledef_version.str) - thd->lex->create_info.tabledef_version= tabledef_version; -#endif // 0 - - tmp_disable_binlog(thd); - - file= mysql_create_frm_image(thd, table_s->db.str, table_s->table_name.str, - create_info, alter_info, C_ORDINARY_CREATE, - ¬_used_1, ¬_used_2, &frm); - if (file) - delete file; - else - rc= OPEN_FRM_CORRUPTED; - - if (!rc && frm.str) { - table_s->option_list= 0; // cleanup existing options ... - table_s->option_struct= 0; // ... if it's an assisted discovery - rc= table_s->init_from_binary_frm_image(thd, true, frm.str, frm.length); - } // endif frm - -//ret: - my_free(const_cast(frm.str)); - reenable_binlog(thd); -#if 0 - lex_end(thd->lex); - thd->lex= old_lex; - if (arena) - thd->restore_active_arena(arena, &backup); - thd->variables.sql_mode= saved_mode; - thd->variables.character_set_client= old_cs; -#endif // 0 - - if (thd->is_error() || rc) { - thd->clear_error(); - my_error(ER_NO_SUCH_TABLE, MYF(0), table_s->db.str, - table_s->table_name.str); - DBUG_RETURN(HA_ERR_NOT_A_TABLE); - } else - DBUG_RETURN(0); - -} // end of init_table_share -#else // !NEW_WAY static int init_table_share(THD* thd, TABLE_SHARE *table_s, HA_CREATE_INFO *create_info, -// char *dsn, String *sql) { bool oom= false; @@ -4695,12 +4727,10 @@ static int init_table_share(THD* thd, } // endfor opt if (create_info->connect_string.length) { -//if (dsn) { oom|= sql->append(' '); oom|= sql->append("CONNECTION='"); oom|= sql->append_for_single_quote(create_info->connect_string.str, create_info->connect_string.length); -// oom|= sql->append_for_single_quote(dsn, strlen(dsn)); oom|= sql->append('\''); if (oom) @@ -4718,29 +4748,12 @@ static int init_table_share(THD* thd, } // endif charset - if (xtrace) + if (trace) htrc("s_init: %.*s\n", sql->length(), sql->ptr()); return table_s->init_from_sql_statement_string(thd, true, sql->ptr(), sql->length()); } // end of init_table_share -#endif // !NEW_WAY - -// Add an option to the create_info option list -static void add_option(THD* thd, HA_CREATE_INFO *create_info, - const char *opname, const char *opval) -{ -#if defined(NEW_WAY) - LEX_STRING *opn= thd->make_lex_string(opname, strlen(opname)); - LEX_STRING *val= thd->make_lex_string(opval, strlen(opval)); - engine_option_value *pov, **start= &create_info->option_list, *end= NULL; - - for (pov= *start; pov; pov= pov->next) - end= pov; - - pov= new(thd->mem_root) engine_option_value(*opn, *val, false, start, &end); -#endif // NEW_WAY -} // end of add_option // Used to check whether a MYSQL table is created on itself bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, @@ -4857,7 +4870,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, } // endif option_list if (!(shm= (char*)db)) - db= table_s->db.str; // Default value + db= table_s->db.str; // Default value // Check table type if (ttp == TAB_UNDEF) { @@ -4865,13 +4878,24 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ttp= GetTypeID(topt->type); sprintf(g->Message, "No table_type. Was set to %s", topt->type); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); - add_option(thd, create_info, "table_type", topt->type); } else if (ttp == TAB_NIY) { sprintf(g->Message, "Unsupported table type %s", topt->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); return HA_ERR_INTERNAL_ERROR; } // endif ttp + // Save stack and allocation environment and prepare error return + if (g->jump_level == MAX_JUMP) { + strcpy(g->Message, MSG(TOO_MANY_JUMPS)); + return HA_ERR_INTERNAL_ERROR; + } // endif jump_level + + if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) { + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + goto err; + } // endif rc + + if (!tab) { if (ttp == TAB_TBL) { // Make tab the first table of the list @@ -4880,7 +4904,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (!tbl) { strcpy(g->Message, "Missing table list"); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif tbl tab= (char*)PlugSubAlloc(g, NULL, strlen(tbl) + 1); @@ -4896,7 +4920,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, } // endif p } else if (ttp != TAB_ODBC || !(fnc & (FNC_TABLE | FNC_COL))) - tab= table_s->table_name.str; // Default value + tab= table_s->table_name.str; // Default value #if defined(NEW_WAY) // add_option(thd, create_info, "tabname", tab); @@ -4906,7 +4930,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, switch (ttp) { #if defined(ODBC_SUPPORT) case TAB_ODBC: - dsn= create_info->connect_string.str; + dsn= strz(g, create_info->connect_string); if (fnc & (FNC_DSN | FNC_DRIVER)) { ok= true; @@ -4941,13 +4965,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, case TAB_MYSQL: ok= true; - if (create_info->connect_string.str) { - int len= create_info->connect_string.length; + if (create_info->connect_string.str && + create_info->connect_string.length) { PMYDEF mydef= new(g) MYSQLDEF(); - dsn= (char*)PlugSubAlloc(g, NULL, len + 1); - strncpy(dsn, create_info->connect_string.str, len); - dsn[len]= 0; + dsn= strz(g, create_info->connect_string); mydef->SetName(create_info->alias); if (!mydef->ParseURL(g, dsn, false)) { @@ -5004,6 +5026,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, else strcpy(g->Message, "Missing OEM module or subtype"); + break; + case TAB_VIR: + ok= true; break; default: sprintf(g->Message, "Cannot get column info for table type %s", topt->type); @@ -5023,7 +5048,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, } // endif src if (ok) { - char *cnm, *rem, *dft, *xtra; + char *cnm, *rem, *dft, *xtra, *key; int i, len, prec, dec, typ, flg; // if (cat) @@ -5039,7 +5064,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (qrp && ttp == TAB_OCCUR) if (OcrSrcCols(g, qrp, col, ocl, rnk)) { my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif OcrSrcCols } else switch (ttp) { @@ -5101,13 +5126,16 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (qrp && ttp == TAB_OCCUR && fnc != FNC_COL) if (OcrColumns(g, qrp, col, ocl, rnk)) { my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif OcrColumns break; case TAB_PIVOT: qrp= PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port); break; + case TAB_VIR: + qrp= VirColumns(g, tab, (char*)db, fnc == FNC_COL); + break; case TAB_OEM: qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL); break; @@ -5118,7 +5146,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (!qrp) { my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif !qrp if (fnc != FNC_NO || src || ttp == TAB_PIVOT) { @@ -5139,7 +5167,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, rc= add_fields(g, thd, &alter_info, cnm, typ, len, dec, NOT_NULL_FLAG, "", flg, dbf, v); #else // !NEW_WAY - if (add_field(&sql, cnm, typ, len, dec, NOT_NULL_FLAG, + if (add_field(&sql, cnm, typ, len, dec, NULL, NOT_NULL_FLAG, NULL, NULL, NULL, flg, dbf, v)) rc= HA_ERR_OUT_OF_MEM; #endif // !NEW_WAY @@ -5154,14 +5182,14 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, strcpy(g->Message, "Fail to retrieve columns"); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } // endif !nblin for (i= 0; !rc && i < qrp->Nblin; i++) { typ= len= prec= dec= 0; tm= NOT_NULL_FLAG; cnm= (char*)"noname"; - dft= xtra= NULL; + dft= xtra= key= NULL; #if defined(NEW_WAY) rem= ""; // cs= NULL; @@ -5212,6 +5240,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (!stricmp(xtra, "AUTO_INCREMENT")) xtra= NULL; + break; + case FLD_KEY: + if (ttp == TAB_VIR) + key= crp->Kdata->GetCharValue(i); + break; default: break; // Ignore @@ -5225,7 +5258,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, if (!(plgtyp= TranslateSQLType(typ, dec, prec, v))) { sprintf(g->Message, "Unsupported SQL type %d", typ); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - return HA_ERR_INTERNAL_ERROR; + goto err; } else typ= plgtyp; @@ -5253,7 +5286,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, rc= add_fields(g, thd, &alter_info, cnm, typ, prec, dec, tm, rem, 0, dbf, v); #else // !NEW_WAY - if (add_field(&sql, cnm, typ, prec, dec, tm, rem, dft, xtra, + if (add_field(&sql, cnm, typ, prec, dec, key, tm, rem, dft, xtra, 0, dbf, v)) rc= HA_ERR_OUT_OF_MEM; #endif // !NEW_WAY @@ -5269,10 +5302,14 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, // rc= init_table_share(thd, table_s, create_info, dsn, &sql); #endif // !NEW_WAY + g->jump_level--; return rc; } // endif ok my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + + err: + g->jump_level--; return HA_ERR_INTERNAL_ERROR; } // end of connect_assisted_discovery @@ -5345,7 +5382,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, table= table_arg; // Used by called functions - if (xtrace) + if (trace) htrc("create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s\n", this, thd, xp, g, sqlcom, GetTableName()); @@ -5411,7 +5448,8 @@ int ha_connect::create(const char *name, TABLE *table_arg, push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); } else if (options->tabname) { if (!stricmp(options->tabname, create_info->alias) && - (!options->dbname || !stricmp(options->dbname, table_arg->s->db.str))) { + (!options->dbname || + !stricmp(options->dbname, table_arg->s->db.str))) { sprintf(g->Message, "A %s table cannot refer to itself", options->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); @@ -5436,14 +5474,11 @@ int ha_connect::create(const char *name, TABLE *table_arg, db= GetStringOption("database", NULL); port= atoi(GetListOption(g, "port", options->oplist, "0")); - if (create_info->connect_string.str) { - char *dsn; - int len= create_info->connect_string.length; + if (create_info->connect_string.str && + create_info->connect_string.length) { + char *dsn= strz(g, create_info->connect_string); PMYDEF mydef= new(g) MYSQLDEF(); - dsn= (char*)PlugSubAlloc(g, NULL, len + 1); - strncpy(dsn, create_info->connect_string.str, len); - dsn[len]= 0; mydef->SetName(create_info->alias); if (!mydef->ParseURL(g, dsn, false)) { @@ -5543,6 +5578,14 @@ int ha_connect::create(const char *name, TABLE *table_arg, DBUG_RETURN(rc); } // endif flags + if (type == TAB_VIR) + if (!fp->option_struct || !fp->option_struct->special) { + strcpy(g->Message, "Virtual tables accept only special or virtual columns"); + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + rc= HA_ERR_INTERNAL_ERROR; + DBUG_RETURN(rc); + } // endif special + switch (fp->type()) { case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONG: @@ -5626,7 +5669,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, // the database directory named table_name.table_type. // (temporarily not done for XML because a void file causes // the XML parsers to report an error on the first Insert) - char buf[256], fn[_MAX_PATH], dbpath[128], lwt[12]; + char buf[_MAX_PATH], fn[_MAX_PATH], dbpath[_MAX_PATH], lwt[12]; int h; // Check for incompatible options @@ -5696,7 +5739,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, } // endif sqlcom - if (xtrace) + if (trace) htrc("xchk=%p createas=%d\n", g->Xchk, g->Createas); // To check whether indexes have to be made or remade @@ -5767,6 +5810,12 @@ int ha_connect::create(const char *name, TABLE *table_arg, } // endif cat + } else if (GetIndexType(type) == 3) { + if (CheckVirtualIndex(table_arg->s)) { + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + rc= HA_ERR_UNSUPPORTED; + } // endif Check + } else if (!GetIndexType(type)) { sprintf(g->Message, "Table type %s is not indexable", options->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); @@ -5800,7 +5849,7 @@ bool ha_connect::FileExists(const char *fn, bool bf) return true; if (table) { - char *s, tfn[_MAX_PATH], filename[_MAX_PATH], path[128]; + char *s, tfn[_MAX_PATH], filename[_MAX_PATH], path[_MAX_PATH]; bool b= false; int n; struct stat info; @@ -6038,7 +6087,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table, xcp->newsep= xcp->SetName(g, GetStringOption("optname")); tshp= NULL; - if (xtrace && g->Xchk) + if (trace && g->Xchk) htrc( "oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p\n", xcp->oldsep, xcp->newsep, @@ -6050,6 +6099,12 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table, else DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK); + } else if (GetIndexType(type) == 3) { + if (CheckVirtualIndex(altered_table->s)) { + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + DBUG_RETURN(HA_ALTER_ERROR); + } // endif Check + } else if (!GetIndexType(type)) { sprintf(g->Message, "Table type %s is not indexable", oldopt->type); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); @@ -6243,15 +6298,18 @@ struct st_mysql_storage_engine connect_storage_engine= /***********************************************************************/ /* CONNECT global variables definitions. */ /***********************************************************************/ -// Tracing: 0 no, 1 yes, >1 more tracing -static MYSQL_SYSVAR_INT(xtrace, xtrace, - PLUGIN_VAR_RQCMDARG, "Console trace value.", - NULL, update_connect_xtrace, 0, 0, INT_MAX, 1); - // Size used when converting TEXT columns to VARCHAR -static MYSQL_SYSVAR_INT(conv_size, conv_size, - PLUGIN_VAR_RQCMDARG, "Size used when converting TEXT columns.", - NULL, update_connect_zconv, SZCONV, 0, 65500, 1); +#if defined(_DEBUG) +static MYSQL_SYSVAR_INT(conv_size, zconv, + PLUGIN_VAR_RQCMDARG, // opt + "Size used when converting TEXT columns.", + NULL, NULL, SZCONV, 0, 65500, 1); +#else +static MYSQL_SYSVAR_INT(conv_size, zconv, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, // opt + "Size used when converting TEXT columns.", + NULL, NULL, SZCONV, 0, 65500, 1); +#endif /** Type conversion: @@ -6270,61 +6328,43 @@ TYPELIB xconv_typelib= xconv_names, NULL }; +#if defined(_DEBUG) static MYSQL_SYSVAR_ENUM( type_conv, // name - type_conv, // varname + xconv, // varname PLUGIN_VAR_RQCMDARG, // opt "Unsupported types conversion.", // comment NULL, // check - update_connect_xconv, // update function + NULL, // update function 0, // def (no) &xconv_typelib); // typelib - -/** - Temporary file usage: - no: Not using temporary file - auto: Using temporary file when needed - yes: Allways using temporary file - force: Force using temporary file (no MAP) - test: Reserved -*/ -const char *usetemp_names[]= -{ - "NO", "AUTO", "YES", "FORCE", "TEST", NullS -}; - -TYPELIB usetemp_typelib= -{ - array_elements(usetemp_names) - 1, "usetemp_typelib", - usetemp_names, NULL -}; - +#else static MYSQL_SYSVAR_ENUM( - use_tempfile, // name - use_tempfile, // varname - PLUGIN_VAR_RQCMDARG, // opt - "Temporary file use.", // comment + type_conv, // name + xconv, // varname + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Unsupported types conversion.", // comment NULL, // check - update_connect_usetemp, // update function - 1, // def (AUTO) - &usetemp_typelib); // typelib + NULL, // update function + 0, // def (no) + &xconv_typelib); // typelib +#endif #if defined(XMAP) // Using file mapping for indexes if true -static MYSQL_SYSVAR_BOOL(indx_map, indx_map, PLUGIN_VAR_RQCMDARG, - "Using file mapping for indexes", - NULL, update_connect_xmap, 0); +static MYSQL_SYSVAR_BOOL(indx_map, xmap, PLUGIN_VAR_RQCMDARG, + "Using file mapping for indexes", NULL, NULL, 0); #endif // XMAP -// Size used for g->Sarea_Size -static MYSQL_SYSVAR_UINT(work_size, work_size, - PLUGIN_VAR_RQCMDARG, "Size of the CONNECT work area.", - NULL, update_connect_worksize, SZWORK, SZWMIN, UINT_MAX, 1); - -// Getting exact info values -static MYSQL_SYSVAR_BOOL(exact_info, exact_info, PLUGIN_VAR_RQCMDARG, - "Getting exact info values", - NULL, update_connect_xinfo, 0); +#if defined(XMSG) +static MYSQL_SYSVAR_STR(errmsg_dir_path, msg_path, +// PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Path to the directory where are the message files", +// check_msg_path, update_msg_path, + NULL, NULL, + "../../../../storage/connect/"); // for testing +#endif // XMSG static struct st_mysql_sys_var* connect_system_variables[]= { MYSQL_SYSVAR(xtrace), @@ -6336,6 +6376,12 @@ static struct st_mysql_sys_var* connect_system_variables[]= { MYSQL_SYSVAR(work_size), MYSQL_SYSVAR(use_tempfile), MYSQL_SYSVAR(exact_info), +#if defined(XMSG) || defined(NEWMSG) + MYSQL_SYSVAR(msg_lang), +#endif // XMSG || NEWMSG +#if defined(XMSG) + MYSQL_SYSVAR(errmsg_dir_path), +#endif // XMSG NULL }; @@ -6352,7 +6398,7 @@ maria_declare_plugin(connect) 0x0103, /* version number (1.03) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.03", /* string version */ + "1.03.0005", /* string version */ MariaDB_PLUGIN_MATURITY_BETA /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 9a73c85cdc7..6c3ed87d5f6 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -26,6 +26,8 @@ #pragma interface /* gcc class implementation */ #endif +static char *strz(PGLOBAL g, LEX_STRING &ls); + /****************************************************************************/ /* Structures used to pass info between CONNECT and ha_connect. */ /****************************************************************************/ @@ -174,6 +176,19 @@ class ha_connect: public handler CONNECT_SHARE *share; ///< Shared lock info CONNECT_SHARE *get_share(); +protected: + char *PlugSubAllocStr(PGLOBAL g, void *memp, const char *str, size_t length) + { + char *ptr= (char*)PlgDBSubAlloc(g, memp, length + 1); + + if (ptr) { + memcpy(ptr, str, length); + ptr[length]= '\0'; + } // endif ptr + + return ptr; + } // end of PlugSubAllocStr + public: ha_connect(handlerton *hton, TABLE_SHARE *table_arg); ~ha_connect(); @@ -200,6 +215,7 @@ public: void *GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf); PXOS GetIndexOptionStruct(KEY *kp); PIXDEF GetIndexInfo(TABLE_SHARE *s= NULL); + bool CheckVirtualIndex(TABLE_SHARE *s); const char *GetDBName(const char *name); const char *GetTableName(void); char *GetPartName(void); @@ -225,6 +241,8 @@ public: uint key_len= 0); bool MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q, const void *key, int klen); + inline char *Strz(LEX_STRING &ls); + /** @brief The name that will be used for display purposes. diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.c index 9f1c06a9222..542b807f899 100644 --- a/storage/connect/inihandl.c +++ b/storage/connect/inihandl.c @@ -18,6 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "my_global.h" + #include //#include #include @@ -28,7 +30,6 @@ #include //#include //#include -#include "my_global.h" #include "osutil.h" #include "global.h" #include "inihandl.h" diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp index e6046a07c5c..e576c1cf5fa 100644 --- a/storage/connect/libdoc.cpp +++ b/storage/connect/libdoc.cpp @@ -2,6 +2,7 @@ /* Implementation of XML document processing using libxml2 */ /* Author: Olivier Bertrand 2007-2013 */ /******************************************************************/ +#include "my_global.h" #include #include #include @@ -11,11 +12,6 @@ #include #include #include -//#if defined(WIN32) -//#include -//#else // !WIN32 -#include "my_global.h" -//#endif // !WIN32 #if !defined(LIBXML_TREE_ENABLED) || !defined(LIBXML_OUTPUT_ENABLED) #error "tree support not compiled in" @@ -184,7 +180,6 @@ class XML2ATTR : public XMLATTRIBUTE { extern "C" { extern char version[]; -extern int trace; } // "C" #if defined(MEMORY_TRACE) diff --git a/storage/connect/msgid.h b/storage/connect/msgid.h index 7a9f9438472..4496994afa3 100644 --- a/storage/connect/msgid.h +++ b/storage/connect/msgid.h @@ -1,1013 +1,320 @@ -#define MSG_BAD_ARRAY_VAL 239 -#define MSG_BAD_SET_CASE 240 -#define MSG_MISSING_ARG 241 -#define MSG_NO_SUB_VAL 242 -#define MSG_PREC_VBLP_NULL 243 -#define MSG_X_ON_TAB 244 -#define MSG_BAD_COLCRT_ARG 245 -#define MSG_BAD_COLSIZE 246 -#define MSG_BAD_COL_ENTRY 247 -#define MSG_BAD_COL_TYPE 248 -#define MSG_BAD_FILE_LIST 249 -#define MSG_BAD_GETVIEW_RET 250 -#define MSG_BAD_OFFSET_VAL 251 -#define MSG_BAD_TABLE_LINE 252 -#define MSG_BAD_TABLE_TYPE 253 -#define MSG_COLSEC_TOO_BIG 254 -#define MSG_COL_HAS_NO_DEF 255 -#define MSG_COL_NOT_CODED 256 -#define MSG_ERASED 257 -#define MSG_ERASE_FAILED 258 -#define MSG_INDEX_DROPPED 259 -#define MSG_INDX_ALL_DROP 260 -#define MSG_INV_QUALIFIER 261 -#define MSG_LOADING_DB 262 -#define MSG_NO_COL_FOUND 263 -#define MSG_NO_COL_SECTION 264 -#define MSG_NO_FEAT_SUPPORT 265 -#define MSG_NO_FILE_LIST 266 -#define MSG_NO_INDEX 267 -#define MSG_NO_MORE_VAR 268 -#define MSG_NO_MUL_VCT 269 -#define MSG_NO_OPT_COLUMN 270 -#define MSG_NO_SUCH_INDEX 271 -#define MSG_NO_SUCH_TABLE 272 -#define MSG_NO_TABLE_INDEX 273 -#define MSG_OPEN_ERROR_ON 274 -#define MSG_RECORD_ERROR 275 -#define MSG_SUBSET_ERROR 276 -#define MSG_TABLE_ALREADY 277 -#define MSG_TABLE_NOT_IN_DB 278 -#define MSG_TABLE_NO_OPT 279 -#define MSG_TAB_NOT_LOADED 280 -#define MSG_TAB_NOT_SPEC 281 -#define MSG_TB_VW_NOTIN_DB 282 -#define MSG_TOO_MANY_COLTAB 283 -#define MSG_TOO_MANY_JUMPS 284 -#define MSG_TOO_MANY_TABLES 285 -#define MSG_VIEW_ALREADY 286 -#define MSG_VIEW_NOT_IN_DB 287 -#define MSG_WRITE_ERROR 288 -#define MSG_XDB_DEL_ERROR 289 -#define MSG_COL_NOTIN_GRPBY 290 -#define MSG_DOMAIN_ERROR 291 -#define MSG_NO_TOKEN_DB 292 -#define MSG_SPCOL_READONLY 293 -#define MSG_TYPE_VALUE_ERR 294 -#define MSG_UNDEFINED_AM 295 -#define MSG_VALUE_ERROR 296 -#define MSG_SORTING_VAL 297 -#define MSG_NAME_CONV_ERR 298 -#define MSG_WS_CONV_ERR 299 -#define MSG_BAD_COMPARE_OP 300 -#define MSG_BAD_EXP_ARGTYPE 301 -#define MSG_BAD_IN_ARGTYPE 302 -#define MSG_BAD_SUBSEL_IN_X 303 -#define MSG_IN_ARGTYPE_MISM 304 -#define MSG_ROW_ARGNB_ERR 305 -#define MSG_TYPE_CONV_ERROR 306 -#define MSG_NO_MAP_INSERT 307 -#define MSG_SEEK_ERROR 308 -#define MSG_BAD_DBF_FILE 309 -#define MSG_BAD_DBF_REC 310 -#define MSG_BAD_DBF_TYPE 311 -#define MSG_BAD_HEADER 312 -#define MSG_BAD_HEAD_END 313 -#define MSG_BAD_LRECL 314 -#define MSG_BIN_MODE_FAIL 315 -#define MSG_DBASE_FILE 316 -#define MSG_FOXPRO_FILE 317 -#define MSG_NOT_A_DBF_FILE 318 -#define MSG_NO_0DH_HEAD 319 -#define MSG_NO_DBF_INSERT 320 -#define MSG_NO_READ_32 321 -#define MSG_NO_MODE_PADDED 322 -#define MSG_SETEOF_ERROR 323 -#define MSG_REMOVE_ERROR 324 -#define MSG_RENAME_ERROR 325 -#define MSG_BAD_HEADER_VAL 326 -#define MSG_BAD_MAX_NREC 327 -#define MSG_HEAD_OPEN_ERROR 328 -#define MSG_HEAD_READ_ERROR 329 -#define MSG_HEAD_WRITE_ERR 330 -#define MSG_MAP_VEC_ONLY 331 -#define MSG_MKEMPTY_NIY 332 -#define MSG_BAD_BLK_SIZE 333 -#define MSG_BAD_LINE_LEN 334 -#define MSG_FUNC_ERR_S 335 -#define MSG_INV_RAND_ACC 336 -#define MSG_NOP_ZLIB_INDEX 337 -#define MSG_NO_PART_DEL 338 -#define MSG_NO_PAR_BLK_INS 339 -#define MSG_NO_SETPOS_YET 340 -#define MSG_BAD_ARRAY_OPER 341 -#define MSG_BAD_FILTER 342 -#define MSG_BAD_FILTER_CONV 343 -#define MSG_BAD_HAV_FILTYPE 344 -#define MSG_BAD_TYPE_LIKE 345 -#define MSG_ILL_FILTER_CONV 346 -#define MSG_IN_WITHOUT_SUB 347 -#define MSG_UNMATCH_FIL_ARG 348 -#define MSG_VALUE_NOT_ALLOC 349 -#define MSG_VOID_FIRST_ARG 350 -#define MSG_DISTINCT_ERROR 351 -#define MSG_INV_FNC_BUFTYPE 352 -#define MSG_INV_SET_SUBTYPE 353 -#define MSG_NO_AGGR_FUNC 354 -#define MSG_APP_STILL_ACTIV 355 -#define MSG_AREAFILE_NOTFND 356 -#define MSG_BAD_LANG_SIZE 357 -#define MSG_BAD_PARAMETERS 358 -#define MSG_BAD_PARAM_TYPE 359 -#define MSG_GRAM_ALLOC_ERR 360 -#define MSG_GRAM_MISMATCH 361 -#define MSG_GRAM_SUBSET_ERR 362 -#define MSG_INVALID_BIP 363 -#define MSG_LANGUAGE_QUIT 364 -#define MSG_LANG_ALREADY_UP 365 -#define MSG_LANG_BAD_SAVE 366 -#define MSG_LANG_NOT_FREED 367 -#define MSG_LANG_SAVED 368 -#define MSG_LANG_WR_LEN_ERR 369 -#define MSG_LDF_ALLOC_ERROR 370 -#define MSG_LDF_W_LEN_ERROR 371 -#define MSG_LNG_NOT_IN_LIST 372 -#define MSG_METAFILE_NOTFND 373 -#define MSG_NODE_SUBSET_ERR 374 -#define MSG_NO_LANG_TO_QUIT 375 -#define MSG_NO_MORE_LANG 376 -#define MSG_ONE_LANG_YET 377 -#define MSG_ON_LANGUAGE 378 -#define MSG_OPEN_W_ERROR 379 -#define MSG_RULE_SUBSET_ERR 380 -#define MSG_UP_LANGUAGE 381 -#define MSG_VM_LANG 382 -#define MSG_BUILD_INDEX 383 -#define MSG_CD_ORDER_ERROR 384 -#define MSG_DSORT_LOG_ERROR 385 -#define MSG_JOIN_KEY_NO_COL 386 -#define MSG_KEY_ALLOC_ERROR 387 -#define MSG_LOGICAL_ERROR 388 -#define MSG_MEM_ALLOC_ERR 389 -#define MSG_QUERY_CANCELLED 390 -#define MSG_RC_READING 391 -#define MSG_REORDER_INDEX 392 -#define MSG_SORTING_INDEX 393 -#define MSG_SORT_JOIN_INDEX 394 -#define MSG_TOO_MANY_KEYS 395 -#define MSG_TYPE_MISMATCH 396 -#define MSG_REGISTER_ERR 397 -#define MSG_XPATH_CNTX_ERR 398 -#define MSG_XPATH_EVAL_ERR 399 -#define MSG_API_CONF_ERROR 400 -#define MSG_BAD_HANDLE_VAL 401 -#define MSG_COL_NUM_MISM 402 -#define MSG_CONNECT_CANCEL 403 -#define MSG_INV_COLUMN_TYPE 404 -#define MSG_NO_CONNECT_ADDR 405 -#define MSG_NO_TABCOL_DATA 406 -#define MSG_NO_TAB_DATA 407 -#define MSG_SEQUENCE_ERROR 408 -#define MSG_SQL_CONF_ERROR 409 -#define MSG_CONNECTED 410 -#define MSG_CONN_CLOSED 411 -#define MSG_CONN_CREATED 412 -#define MSG_CONN_DROPPED 413 -#define MSG_CONN_OPEN 414 -#define MSG_CONN_SUC_OPEN 415 -#define MSG_DISCONNECTED 416 -#define MSG_IS_NOT_CONN 417 -#define MSG_NAME_IS_USED 418 -#define MSG_NO_SUCH_SERVER 419 -#define MSG_BAD_COLIST_ITEM 420 -#define MSG_BAD_COLIST_TYPE 421 -#define MSG_BAD_COL_IN_FILT 422 -#define MSG_BAD_FUNC_ARG 423 -#define MSG_BAD_FUNC_ARGTYP 424 -#define MSG_BAD_OPERATOR 425 -#define MSG_BAD_PROJNUM 426 -#define MSG_BAD_SEM_DOMAIN 427 -#define MSG_CLN_NOT_IN_JOIN 428 -#define MSG_COLIST_BAD_TYPE 429 -#define MSG_COLUMN_ERROR 430 -#define MSG_COL_NOT_EXIST 431 -#define MSG_COL_NOT_FOUND 432 -#define MSG_COL_NOT_IN_JOIN 433 -#define MSG_DUPLICAT_COUNT 434 -#define MSG_DUP_PROJNUM 435 -#define MSG_FILTER_ATTACH 436 -#define MSG_GRBY_TAB_NOTIMP 437 -#define MSG_NON_DUP_HAVING 438 -#define MSG_NOT_IMPL_JOIN 439 -#define MSG_NOT_IMPL_SET 440 -#define MSG_NO_COL_IN_TABLE 441 -#define MSG_NO_MULT_HAVING 442 -#define MSG_NO_TABLE_DESC 443 -#define MSG_REMOVE_NOT_IMPL 444 -#define MSG_TYPE_TO_VERIFY 445 -#define MSG_UNDEF_COL_COUNT 446 -#define MSG_UNKNOWN_NAME 447 -#define MSG_WRONG_COL_NUM 448 -#define MSG_ALL_DELETED 449 -#define MSG_BAD_LOCALE 450 -#define MSG_BAD_QUERY_TYPE 451 -#define MSG_BUFSIZE_ERROR 452 -#define MSG_END_OF_DELETE 453 -#define MSG_END_OF_INSERT 454 -#define MSG_END_OF_QUERY 455 -#define MSG_END_OF_UPDATE 456 -#define MSG_NCOL_GT_MAXCOL 457 -#define MSG_OPEN_ERROR_IS 458 -#define MSG_SET_LOCALE 459 -#define MSG_X_ARG_ADDED 460 -#define MSG_ALG_CHOICE_AUTO 461 -#define MSG_ALG_CHOICE_BAD 462 -#define MSG_ALG_CHOICE_QRY 463 -#define MSG_ALG_CURLY_BRK 464 -#define MSG_ALTER_DB_ERR 465 -#define MSG_APPL_IS_ACTIVE 466 -#define MSG_APPL_NOT_INIT 467 -#define MSG_AVGLEN_ERROR 468 -#define MSG_BAD_DEF_TYPE 469 -#define MSG_BAD_DIST_JN_FIL 470 -#define MSG_BAD_DIST_JOIN 471 -#define MSG_BAD_DOM_COL_DEF 472 -#define MSG_BAD_FIELD_FMT 473 -#define MSG_BAD_OUTER_JOIN 474 -#define MSG_BAD_SETTINGS 475 -#define MSG_BAD_XMODE_VAL 476 -#define MSG_DATABASE_ACTIVE 477 -#define MSG_DATABASE_LOADED 478 -#define MSG_DB_ALREADY_DEF 479 -#define MSG_DB_ALTERED 480 -#define MSG_DB_CREATED 481 -#define MSG_DB_REMOVED 482 -#define MSG_DB_STOPPED 483 -#define MSG_DIS_NOHEAD_JOIN 484 -#define MSG_DROP_DB_ERR 485 -#define MSG_DUP_COL_NAME 486 -#define MSG_EXECUTING 487 -#define MSG_EXEC_MODE_SET 488 -#define MSG_INDEX_CREATED 489 -#define MSG_INV_DATA_PATH 490 -#define MSG_INV_WORK_PATH 491 -#define MSG_IN_USE 492 -#define MSG_LIC_NO_MYSQL 493 -#define MSG_LINE_LENGTH 494 -#define MSG_LINE_MAXLIN 495 -#define MSG_LINE_MAXRES 496 -#define MSG_LINE_MAXTMP 497 -#define MSG_MAC_WIN_ONLY 498 -#define MSG_MALLOC_NULL 499 -#define MSG_MAP_NO_MORE 500 -#define MSG_MISSING_COL_DEF 501 -#define MSG_MISSING_CONNECT 502 -#define MSG_MISSING_SERV_DB 503 -#define MSG_MISS_NAME_LRECL 504 -#define MSG_MISS_TABLE_LIST 505 -#define MSG_MISS_VCT_ELMT 506 -#define MSG_NEW_CHAR_NULL 507 -#define MSG_NODEF_FROM_VIEW 508 -#define MSG_NO_COL_ADDING 509 -#define MSG_NO_COL_DEF_AS 510 -#define MSG_NO_DATABASE 511 -#define MSG_NO_FULL_JOIN 512 -#define MSG_NO_FUL_OUT_JOIN 513 -#define MSG_NO_HEAD_JOIN 514 -#define MSG_NO_ODBC_COL 515 -#define MSG_NO_SELECTED_DB 516 -#define MSG_NO_SELF_PIVOT 517 -#define MSG_NULL_QUERY 518 -#define MSG_READY 519 -#define MSG_SEC_NOT_FOUND 520 -#define MSG_SET_OP_NOT_IMPL 521 -#define MSG_TABLE_ALTERED 522 -#define MSG_TABLE_CREATED 523 -#define MSG_TABLE_DROPPED 524 -#define MSG_TDB_NXT_NOT_NUL 525 -#define MSG_TYPE_DEF_MISM 526 -#define MSG_TYPE_RECFM_MISM 527 -#define MSG_VIEW_CREATED 528 -#define MSG_VIEW_DROPPED 529 -#define MSG_ANSWER_TYPE 530 -#define MSG_COPY_BAD_PHASE 531 -#define MSG_LIST 532 -#define MSG_MEM_ALLOC_ERROR 533 -#define MSG_PTR_NOT_FOUND 534 -#define MSG_SEMANTIC_TREE 535 -#define MSG_WRONG_TYPE 536 -#define MSG_ARRAY_ERROR 537 -#define MSG_BAD_EVAL_TYPE 538 -#define MSG_BAD_FILTER_LINK 539 -#define MSG_BAD_IN_ENDING 540 -#define MSG_BAD_IN_STRING 541 -#define MSG_BAD_LIST_TYPE 542 -#define MSG_BAD_ORDER_MODE 543 -#define MSG_BAD_ORDER_TYPE 544 -#define MSG_GROUP_ON_FUNC 545 -#define MSG_GRP_LIST_MISMAT 546 -#define MSG_LINEAR_ERROR 547 -#define MSG_NO_FUNC_ORDER 548 -#define MSG_NO_OP_MODIF 549 -#define MSG_NO_TABLE_LIST 550 -#define MSG_ORDER_TWICE 551 -#define MSG_UNKNOWN_ERROR 552 -#define MSG_VOID_IN_STRING 553 -#define MSG_VOID_ORDER_LIST 554 -#define MSG_ACCESS_VIOLATN 555 -#define MSG_ARRAY_BNDS_EXCD 556 -#define MSG_BREAKPOINT 557 -#define MSG_CONTROL_C_EXIT 558 -#define MSG_DATA_MISALIGN 559 -#define MSG_FLT_BAD_RESULT 560 -#define MSG_FLT_DENORMAL_OP 561 -#define MSG_FLT_INVALID_OP 562 -#define MSG_FLT_OVERFLOW 563 -#define MSG_FLT_STACK_CHECK 564 -#define MSG_FLT_UNDERFLOW 565 -#define MSG_FLT_ZERO_DIVIDE 566 -#define MSG_GUARD_PAGE 567 -#define MSG_ILLEGAL_INSTR 568 -#define MSG_INT_OVERFLOW 569 -#define MSG_INT_ZERO_DIVIDE 570 -#define MSG_INVALID_DISP 571 -#define MSG_INVALID_HANDLE 572 -#define MSG_NEW_RETURN_NULL 573 -#define MSG_NONCONT_EXCEPT 574 -#define MSG_NO_ACTIVE_DB 575 -#define MSG_NO_MEMORY 576 -#define MSG_PAGE_ERROR 577 -#define MSG_PARSING_QUERY 578 -#define MSG_PRIV_INSTR 579 -#define MSG_SINGLE_STEP 580 -#define MSG_SQL_BAD_TYPE 581 -#define MSG_UNKNOWN_EXCPT 582 -#define MSG_WRONG_FUNCTION 583 -#define MSG_BAD_RESULT_TYPE 584 -#define MSG_BUFF_TOO_SMALL 585 -#define MSG_COL_ALLOC_ERROR 586 -#define MSG_DATA_IS_NULL 587 -#define MSG_GET_ERROR 588 -#define MSG_INV_COL_DATATYP 589 -#define MSG_INV_INIPATH 590 -#define MSG_NO_NBLIN_CONT 591 -#define MSG_NO_SERVER_FOUND 592 -#define MSG_TYPES_ERROR 593 -#define MSG_UNDEFINED_PATH 594 -#define MSG_UNKNOWN_PATH 595 -#define MSG_WRONG_DB_LIST 596 -#define MSG_BAD_SPECIAL_CMD 597 -#define MSG_CURSOR_SET 598 -#define MSG_EVAL_EXPIRED 599 -#define MSG_EVAL_ONLY 600 -#define MSG_INV_SPECIAL_CMD 601 -#define MSG_PROGRESS_INFO 602 -#define MSG_PROMPT_CANCEL 603 -#define MSG_ARG_ALREADY_SET 604 -#define MSG_BAD_ARG_NUM 605 -#define MSG_BAD_CHECK_VAL 606 -#define MSG_BAD_EXEC_MODE 607 -#define MSG_BAD_MAX_PARAM 608 -#define MSG_BAD_MAX_SETTING 609 -#define MSG_BAD_USETEMP 610 -#define MSG_BAD_USETEMP_VAL 611 -#define MSG_CHECK_LEVEL 612 -#define MSG_COLS_REDUCED 613 -#define MSG_COLUMN_MISMATCH 614 -#define MSG_COL_NOT_IN_DB 615 -#define MSG_DB_NOT_SPEC 616 -#define MSG_DONE 617 -#define MSG_EXEC_MODE_IS 618 -#define MSG_EXEC_MODE_RESET 619 -#define MSG_HUGE_DEFAULT 620 -#define MSG_INDEX_ONE_SAVE 621 -#define MSG_INDEX_SEP_SAVE 622 -#define MSG_INVALID_OPTION 623 -#define MSG_INV_COL_NUM 624 -#define MSG_INV_INFO_TYPE 625 -#define MSG_INV_RESULT_TYPE 626 -#define MSG_LANG_ACTIVE 627 -#define MSG_MAX_BITMAP 628 -#define MSG_MYSQL_CNC_OFF 629 -#define MSG_MYSQL_CNC_ON 630 -#define MSG_MYSQL_NOT_SUP 631 -#define MSG_MY_CNC_ALREADY 632 -#define MSG_NO_AVAIL_RESULT 633 -#define MSG_NO_HQL_CONV 634 -#define MSG_NO_MYSQL_CONN 635 -#define MSG_NO_UNIX_CATINFO 636 -#define MSG_OPENING 637 -#define MSG_PLUG_NOT_RUN 638 -#define MSG_PROMPT_NIY 639 -#define MSG_QUERY_SAVED 640 -#define MSG_REC_SKIPPED 641 -#define MSG_ROWS_SELECTED 642 -#define MSG_ROWS_TRUNCATED 643 -#define MSG_SLEEP 644 -#define MSG_SPEC_CMD_SEP 645 -#define MSG_SYSTEM_ERROR 646 -#define MSG_UNLOADABLE 647 -#define MSG_UNLOADABLE_PRM 648 -#define MSG_USETEMP_IS 649 -#define MSG_USETEMP_RESET 650 -#define MSG_USETEMP_SET 651 -#define MSG_USING_INDEX 652 -#define MSG_VOID_QUERY 653 -#define MSG_WORK_TOO_SMALL 654 -#define MSG_WRITING_QUERY 655 -#define MSG_X_ARG_SET 656 -#define MSG_BAS_NS_LIST 657 -#define MSG_DOM_NOT_SUPP 658 -#define MSG_AFTER 659 -#define MSG_ARG_OUT_CONTEXT 660 -#define MSG_ARG_OUT_RANGE 661 -#define MSG_ARG_PTR_NOSEM 662 -#define MSG_ARG_PTR_NOSEMS 663 -#define MSG_BAD_ARG_TYPE 664 -#define MSG_ERR_RET_RULE 665 -#define MSG_ERR_RET_TYPE 666 -#define MSG_FUNC_REF_DEL 667 -#define MSG_INV_TOPSEM_CMD 668 -#define MSG_NON_EVAL_SEM 669 -#define MSG_N_FULL_PARSES 670 -#define MSG_PARSE_NULL_SEM 671 -#define MSG_PNODE_RULE 672 -#define MSG_SCAN_NOT_IMP 673 -#define MSG_SEM_BAD_REF 674 -#define MSG_SEM_UNKNOWN 675 -#define MSG_SUBARG_NOSEM 676 -#define MSG_SUBARG_OUTRANGE 677 -#define MSG_SYNTAX_ERROR 678 -#define MSG_TOPSEM_ERROR 679 -#define MSG_UNKN_ERR_CODE 680 -#define MSG_ATTRIBUTE_ERROR 681 -#define MSG_BAD_PHRASE_NB 682 -#define MSG_INV_OPERATOR 683 -#define MSG_NO_LANGUAGE 684 -#define MSG_PIX_ERROR 685 -#define MSG_PIX_TEST_ERROR 686 -#define MSG_PLUG_NOT_INIT 687 -#define MSG_STACK_ERROR 688 -#define MSG_STACK_OVERFLOW 689 -#define MSG_APPL_ACCESSIBLE 690 -#define MSG_APPL_BAD_SAVE 691 -#define MSG_APPL_CREATED 692 -#define MSG_APPL_NOT_LOADED 693 -#define MSG_APPL_QUIT 694 -#define MSG_APPL_SAVED 695 -#define MSG_ARG_NOT_AN_ATTR 696 -#define MSG_ATT_NOT_CASE 697 -#define MSG_ATT_POSCODE_BIG 698 -#define MSG_BAD_EDIT_INIT 699 -#define MSG_BAD_FPARM_NEXT 700 -#define MSG_BAD_PHASE_NUM 701 -#define MSG_BAD_SUBLST_TYPE 702 -#define MSG_BAD_USERBLK_LEN 703 -#define MSG_COPY_INV_TYPE 704 -#define MSG_DEBUG_NOT_ACTIV 705 -#define MSG_DEBUG_SET_INV 706 -#define MSG_DICTIONARY 707 -#define MSG_ENDSTR_MISMATCH 708 -#define MSG_ERROR_NO_PARM 709 -#define MSG_EXECUTION_ERROR 710 -#define MSG_FILE_NOT_FOUND 711 -#define MSG_INPUT 712 -#define MSG_INPUT_KEYBD_YET 713 -#define MSG_INV_CONC_BIP 714 -#define MSG_INV_DOMAIN_TYPE 715 -#define MSG_INV_PARAMETER 716 -#define MSG_INV_PARM_TYPE 717 -#define MSG_INV_TRANSF_USE 718 -#define MSG_INV_TYPE_SPEC 719 -#define MSG_LDF_RN_MISMATCH 720 -#define MSG_LDF_WLEN_ERROR 721 -#define MSG_MOVE_INV_TYPE 722 -#define MSG_NODE_FOR_CHAR 723 -#define MSG_NOT_IMPLEMENTED 724 -#define MSG_NOT_IMPL_YET 725 -#define MSG_NOT_MODIFIABLE 726 -#define MSG_NO_ACTIVE_APPL 727 -#define MSG_NO_ACTIVE_UDIC 728 -#define MSG_NO_AREA_FILE 729 -#define MSG_NO_EDITED_LANG 730 -#define MSG_NO_PARAMETER 731 -#define MSG_NO_RCUR_DSK_YET 732 -#define MSG_NO_SOURCE 733 -#define MSG_ONE_PARAM_ONLY 734 -#define MSG_READING_FROM 735 -#define MSG_RESET_TO 736 -#define MSG_STRING_INV_LIST 737 -#define MSG_UNKNOWN_SEM 738 -#define MSG_USED_FREE_MEM 739 -#define MSG_WRONG_PASSWORD 740 -#define MSG_WRONG_USERFILE 741 -#define MSG_ACT_ALLOC_FAIL 742 -#define MSG_APPL_ACTIVE 743 -#define MSG_BAD_CASE_SPEC 744 -#define MSG_DOSALMEM_NOMEM 745 -#define MSG_EXIT_FROM_LANG 746 -#define MSG_GLOBAL_ERROR 747 -#define MSG_HUGE_WARNING_1 748 -#define MSG_HUGE_WARNING_2 749 -#define MSG_LANG_ALLOC_FAIL 750 -#define MSG_MALLOC_ERROR 751 -#define MSG_NO_INIT_LANG 752 -#define MSG_NULL_ENTRY 753 -#define MSG_READ_MEM_ERROR 754 -#define MSG_READ_SEG_ERROR 755 -#define MSG_RECEIVED 756 -#define MSG_RET_FROM_LANG 757 -#define MSG_STRG_NOT_FOUND 758 -#define MSG_SUBALLOC_ERROR 759 -#define MSG_SUBAL_HUGE_ERR 760 -#define MSG_S_ACCESS_DENIED 761 -#define MSG_S_ERROR 762 -#define MSG_S_ERROR_NUM 763 -#define MSG_S_INTRUPT_ERROR 764 -#define MSG_S_INVALID_PARM 765 -#define MSG_S_INV_ADDRESS 766 -#define MSG_S_UNKNOWN_ERROR 767 -#define MSG_VOID_POS_DICT 768 -#define MSG_WORK_AREA 769 -#define MSG_BAD_AGGREG_FUNC 770 -#define MSG_BAD_MAX_HAVING 771 -#define MSG_BUILDING_GROUPS 772 -#define MSG_CD_ONE_STEP 773 -#define MSG_CNTDIS_COL_LOST 774 -#define MSG_COMPUTING 775 -#define MSG_DISTINCT_ROWS 776 -#define MSG_DISTINCT_VALUES 777 -#define MSG_FETCHING_DATA 778 -#define MSG_FETCHING_ROWS 779 -#define MSG_GROUPBY_NOT_ALL 780 -#define MSG_HAVING_FILTER 781 -#define MSG_IDLE 782 -#define MSG_INTERNAL 783 -#define MSG_INV_QUERY_TYPE 784 -#define MSG_MAKING_DISTINCT 785 -#define MSG_MAXTMP_TRUNCATE 786 -#define MSG_MEM_ALLOC_YET 787 -#define MSG_NOT_ENOUGH_MEM 788 -#define MSG_NO_NULL_CONST 789 -#define MSG_OFFSET_NOT_SUPP 790 -#define MSG_OPENING_QUERY 791 -#define MSG_OPEN_SORT_ERROR 792 -#define MSG_PROC_WOULD_LOOP 793 -#define MSG_RSC_ALLOC_ERROR 794 -#define MSG_SMART_SORTING 795 -#define MSG_SMART_SORT_ERR 796 -#define MSG_SORTING 797 -#define MSG_DEF_ALLOC_ERROR 798 -#define MSG_GET_FUNC_ERR 799 -#define MSG_PROCADD_ERROR 800 -#define MSG_PXDEF_IS_NULL 801 -#define MSG_SHARED_LIB_ERR 802 -#define MSG_ADPOS_IN_DICTP 803 -#define MSG_BAD_CHAR_SPEC 804 -#define MSG_BAD_GENRE 805 -#define MSG_BAD_INPUT 806 -#define MSG_BAD_LOCDFON_ARG 807 -#define MSG_BAD_LOCNODE_USE 808 -#define MSG_BAD_POS_CODE 809 -#define MSG_BAD_POS_TYPE 810 -#define MSG_BAD_TYPE_FOR_S 811 -#define MSG_BLOCK_NO_MATCH 812 -#define MSG_BXP_NULL 813 -#define MSG_DIRECT_VARTOK 814 -#define MSG_FSBPARP_NULL 815 -#define MSG_LOCSTRG_TOO_BIG 816 -#define MSG_MISSING_POS 817 -#define MSG_NO_POS_ADDED 818 -#define MSG_NO_TERM_IN_TOK 819 -#define MSG_POS_TOO_LONG 820 -#define MSG_RENUM_RULES 821 -#define MSG_RULE_ENTERED 822 -#define MSG_TOO_MANY_POS 823 -#define MSG_TO_FTR_NOT_NULL 824 -#define MSG_TO_PIX_NOT_NULL 825 -#define MSG_TO_SEM_NOT_NULL 826 -#define MSG_UNKNOWN_POS 827 -#define MSG_UNKNOWN_SYNONYM 828 -#define MSG_USE_NO_MATCH 829 -#define MSG_ALLOC_ERROR 830 -#define MSG_ARG_TWO_CONST 831 -#define MSG_BAD_ARGTYPES 832 -#define MSG_BAD_ARGUMENTS 833 -#define MSG_BAD_ROW_VALIST 834 -#define MSG_BAD_ROW_VALNB 835 -#define MSG_BAD_SCF_ARGTYPE 836 -#define MSG_BAD_SUB_SELECT 837 -#define MSG_BAD_TYPE_FOR_IN 838 -#define MSG_CONNECT_ERROR 839 -#define MSG_EXIT_EVAL_ERR 840 -#define MSG_FORMAT_ERROR 841 -#define MSG_INIT_ERROR 842 -#define MSG_INVALID_OPER 843 -#define MSG_NO_SFEXIT_UNIX 844 -#define MSG_READING_RECORD 845 -#define MSG_REQU_ARG_NUM 846 -#define MSG_SFUNC_NOT_IMPL 847 -#define MSG_UNKNOWN_DOMAIN 848 -#define MSG_WRONG_ARG_NUM 849 -#define MSG_WRONG_OP_PARM 850 -#define MSG_WRONG_PARMS 851 -#define MSG_AMBIG_CORREL 852 -#define MSG_BAD_CHECK_TYPE 853 -#define MSG_BAD_CORREL 854 -#define MSG_BAD_XOBJ_TYPE 855 -#define MSG_HBUF_TOO_SMALL 856 -#define MSG_MISSING 857 -#define MSG_MULT_DISTINCT 858 -#define MSG_NO_TABLE_COL 859 -#define MSG_ARG_REF_LOOP 860 -#define MSG_GETCWD_ERR_NO 861 -#define MSG_UNRESOLVED_ARG 862 -#define MSG_ARGS_SYNTAX_ERR 863 -#define MSG_AMBIG_COL_QUAL 864 -#define MSG_AMBIG_SPEC_COL 865 -#define MSG_BAD_COL_QUALIF 866 -#define MSG_BAD_FETCH_RC 867 -#define MSG_BAD_FILTER_OP 868 -#define MSG_BAD_HAV_FILTER 869 -#define MSG_BAD_JOIN_FILTER 870 -#define MSG_BAD_SET_TYPE 871 -#define MSG_BAD_SPECIAL_COL 872 -#define MSG_BAD_SPEC_COLUMN 873 -#define MSG_BAD_SQL_PARAM 874 -#define MSG_BAD_TABLE_LIST 875 -#define MSG_BAD_UPD_COR 876 -#define MSG_BAD_VALUE_TYPE 877 -#define MSG_BUILD_DIST_GRPS 878 -#define MSG_CHECKING_ROWS 879 -#define MSG_COL_INVAL_TABLE 880 -#define MSG_COL_ISNOT_TABLE 881 -#define MSG_COL_NOTIN_TABLE 882 -#define MSG_COL_NOTIN_UPDT 883 -#define MSG_COMPUTING_DIST 884 -#define MSG_COMPUTING_FUNC 885 -#define MSG_DELETING_ROWS 886 -#define MSG_ERROR 887 -#define MSG_FILGRP_NO_TABLE 888 -#define MSG_FILTER_NO_TABLE 889 -#define MSG_INSERTING 890 -#define MSG_INSERT_MISMATCH 891 -#define MSG_INV_FILTER 892 -#define MSG_INV_UPDT_TABLE 893 -#define MSG_INV_VALUE_LIST 894 -#define MSG_INV_WHERE_JOIN 895 -#define MSG_NOT_LINEARIZED 896 -#define MSG_NO_CONST_FILTER 897 -#define MSG_NO_INDEX_GBX 898 -#define MSG_READB_BAD_INIT 899 -#define MSG_READING 900 -#define MSG_SEVERAL_TREES 901 -#define MSG_UNKNW_QRY_TYPE 902 -#define MSG_UNQ_COL_SEV_TAB 903 -#define MSG_UPDATING_ROWS 904 -#define MSG_VAL_TOO_LONG 905 -#define MSG_BAD_FILTEST_OP 906 -#define MSG_BAD_SUBSEL_TYPE 907 -#define MSG_BAD_SUB_RESULT 908 -#define MSG_CORREL_NO_QRY 909 -#define MSG_FLTST_NO_CORREL 910 -#define MSG_NO_MEM_CORR_SUB 911 -#define MSG_NO_QUERY_ARRAY 912 -#define MSG_PROCESS_SUBQRY 913 -#define MSG_READ_ERROR_RC 914 -#define MSG_RES_NOT_UNIQUE 915 -#define MSG_SQL_BLOCK_MISM 916 -#define MSG_SUBQRY_ONEITEM 917 -#define MSG_SUB_OPEN_YET 918 -#define MSG_FNC_NOTIN_SLIST 919 -#define MSG_NO_FORMAT_COL 920 -#define MSG_ORDER_OUT_RANGE 921 -#define MSG_SEP_IN_FIELD 922 -#define MSG_BAD_OPEN_MODE 923 -#define MSG_OPEN_MODE_ERROR 924 -#define MSG_RECORD_NO_SEP 925 -#define MSG_BAD_BLK_ESTIM 926 -#define MSG_BAD_FREQ_SET 927 -#define MSG_BAD_RECFM 928 -#define MSG_BAD_RECFM_VAL 929 -#define MSG_BIN_F_TOO_LONG 930 -#define MSG_CHSIZE_ERROR 931 -#define MSG_DEL_FILE_ERR 932 -#define MSG_DEL_READ_ERROR 933 -#define MSG_DEL_WRITE_ERROR 934 -#define MSG_DVAL_NOTIN_LIST 935 -#define MSG_FILELEN_ERROR 936 -#define MSG_FILE_IS_EMPTY 937 -#define MSG_FILE_MAP_ERROR 938 -#define MSG_FPUTS_ERROR 939 -#define MSG_FSEEK_ERROR 940 -#define MSG_FSETPOS_ERROR 941 -#define MSG_FTELL_ERROR 942 -#define MSG_FUNCTION_ERROR 943 -#define MSG_GETFILESIZE_ERR 944 -#define MSG_GET_DIST_VALS 945 -#define MSG_INDEX_NOT_DEF 946 -#define MSG_INDEX_YET_ON 947 -#define MSG_INDX_COL_NOTIN 948 -#define MSG_INDX_EXIST_YET 949 -#define MSG_INSERT_ERROR 950 -#define MSG_INV_DEF_READ 951 -#define MSG_INV_MAP_POS 952 -#define MSG_MAP_VIEW_ERROR 953 -#define MSG_NOT_FIXED_LEN 954 -#define MSG_NO_INDEX_IN 955 -#define MSG_NO_RECOV_SPACE 956 -#define MSG_NO_ROWID_FOR_AM 957 -#define MSG_OPEN_STRERROR 958 -#define MSG_OPTBLK_RD_ERR 959 -#define MSG_OPTBLK_WR_ERR 960 -#define MSG_OPT_BMAP_RD_ERR 961 -#define MSG_OPT_BMAP_WR_ERR 962 -#define MSG_OPT_DVAL_RD_ERR 963 -#define MSG_OPT_DVAL_WR_ERR 964 -#define MSG_OPT_LOGIC_ERR 965 -#define MSG_READ_ERROR 966 -#define MSG_READ_SEEK_ERROR 967 -#define MSG_TABLE_NOT_OPT 968 -#define MSG_TRUNCATE_ERROR 969 -#define MSG_VALUE_TOO_LONG 970 -#define MSG_WRITE_SEEK_ERR 971 -#define MSG_BAD_BIN_FMT 972 -#define MSG_BAD_DEF_READ 973 -#define MSG_COL_NOT_SORTED 974 -#define MSG_ERROR_IN_LSK 975 -#define MSG_ERROR_IN_SFP 976 -#define MSG_FILE_OPEN_YET 977 -#define MSG_FWRITE_ERROR 978 -#define MSG_INVALID_FTYPE 979 -#define MSG_INV_REC_POS 980 -#define MSG_NO_BIG_DELETE 981 -#define MSG_NO_CLUSTER_COL 982 -#define MSG_OPEN_ERROR 983 -#define MSG_OPTIMIZING 984 -#define MSG_OPT_CANCELLED 985 -#define MSG_OPT_HEAD_RD_ERR 986 -#define MSG_OPT_HEAD_WR_ERR 987 -#define MSG_OPT_MAX_RD_ERR 988 -#define MSG_OPT_MAX_WR_ERR 989 -#define MSG_OPT_MIN_RD_ERR 990 -#define MSG_OPT_MIN_WR_ERR 991 -#define MSG_OPT_NOT_MATCH 992 -#define MSG_VALUE_TOO_BIG 993 -#define MSG_WRITING_ERROR 994 -#define MSG_BAD_FIELD_RANK 995 -#define MSG_BAD_FLD_FORMAT 996 -#define MSG_BAD_FLD_LENGTH 997 -#define MSG_BAD_LINEFLD_FMT 998 -#define MSG_BAD_QUOTE_FIELD 999 -#define MSG_CANNOT_OPEN 1000 -#define MSG_EOF_AFTER_LINE 1001 -#define MSG_ERR_READING_REC 1002 -#define MSG_FIELD_TOO_LONG 1003 -#define MSG_FLD_TOO_LNG_FOR 1004 -#define MSG_FMT_WRITE_NIY 1005 -#define MSG_LINE_TOO_LONG 1006 -#define MSG_LRECL_TOO_SMALL 1007 -#define MSG_MISPLACED_QUOTE 1008 -#define MSG_MISSING_EOL 1009 -#define MSG_MISSING_FIELD 1010 -#define MSG_MISSING_FNAME 1011 -#define MSG_NO_FLD_FORMAT 1012 -#define MSG_QUOTE_IN_QUOTE 1013 -#define MSG_TOO_MANY_FIELDS 1014 -#define MSG_UNBALANCE_QUOTE 1015 -#define MSG_BAD_JCOL_TYPE 1016 -#define MSG_COL_USED_TWICE 1017 -#define MSG_DUMMY_NO_COLS 1018 -#define MSG_JCT_MISS_COLS 1019 -#define MSG_JCT_MISS_TABLE 1020 -#define MSG_JCT_NO_FILTER 1021 -#define MSG_JCT_NO_KEY 1022 -#define MSG_NO_DMY_DIR_ACC 1023 -#define MSG_NO_EXP_LINK 1024 -#define MSG_VIR_NO_DELETE 1025 -#define MSG_VIR_READ_ONLY 1026 -#define MSG_BAD_JOIN_EXP 1027 -#define MSG_BAD_JOIN_OP 1028 -#define MSG_COLUMN_NOT_KEY 1029 -#define MSG_DB_SORT_ERROR 1030 -#define MSG_LINJOINDB_ERROR 1031 -#define MSG_MULT_KEY_ERROR 1032 -#define MSG_NO_JOIN_TO_EXP 1033 -#define MSG_NO_MULCOL_JOIN 1034 -#define MSG_READ_ONLY 1035 -#define MSG_ROWID_NOT_IMPL 1036 -#define MSG_SETRECPOS_NIY 1037 -#define MSG_TABLE_MULT_JOIN 1038 -#define MSG_TDB_USE_ERROR 1039 -#define MSG_BAD_CARDINALITY 1040 -#define MSG_BAD_DIRECTORY 1041 -#define MSG_BAD_FILE_HANDLE 1042 -#define MSG_INV_DIRCOL_OFST 1043 -#define MSG_MAXSIZE_ERROR 1044 -#define MSG_MUL_MAKECOL_ERR 1045 -#define MSG_NEXT_FILE_ERROR 1046 -#define MSG_NO_DIR_INDX_RD 1047 -#define MSG_NO_INDEX_READ 1048 -#define MSG_NO_MUL_DIR_ACC 1049 -#define MSG_SRCH_CLOSE_ERR 1050 -#define MSG_TABDIR_READONLY 1051 -#define MSG_TABMUL_READONLY 1052 -#define MSG_NO_EXT_FILTER 1053 -#define MSG_NO_EXT_UPDATE 1054 -#define MSG_NO_ODBC_DELETE 1055 -#define MSG_NO_ODBC_DIRECT 1056 -#define MSG_NO_ODBC_MUL 1057 -#define MSG_NO_ODBC_SPECOL 1058 -#define MSG_NO_UPDEL_JOIN 1059 -#define MSG_ODBC_READ_ONLY 1060 -#define MSG_PARM_CNT_MISS 1061 -#define MSG_COLNAM_TOO_LONG 1062 -#define MSG_NOT_ENOUGH_COLS 1063 -#define MSG_NO_DEF_FNCCOL 1064 -#define MSG_NO_DEF_PIVOTCOL 1065 -#define MSG_NO_MATCH_COL 1066 -#define MSG_NO_MORE_COL 1067 -#define MSG_NO_PIV_DIR_ACC 1068 -#define MSG_NO_TABLE_DEL 1069 -#define MSG_SRC_TABLE_UNDEF 1070 -#define MSG_TABLE_READ_ONLY 1071 -#define MSG_TOO_MANY_COLS 1072 -#define MSG_BAD_COLDEF_TYPE 1073 -#define MSG_BAD_MERGE_TYPE 1074 -#define MSG_COL_NB_MISM 1075 -#define MSG_ERROR_OPENING 1076 -#define MSG_FETCH_NO_RES 1077 -#define MSG_LOAD_CDLL_ERROR 1078 -#define MSG_NO_NBCOL 1079 -#define MSG_NO_NBLIN 1080 -#define MSG_NO_PROMPTING 1081 -#define MSG_NO_REMOTE_FNC 1082 -#define MSG_NO_VIEW_COLDEF 1083 -#define MSG_PLG_READ_ONLY 1084 -#define MSG_PLM_NULL_SFP 1085 -#define MSG_QUERY_NOT_EXEC 1086 -#define MSG_REMOTE_CONN_ERR 1087 -#define MSG_RPC_SERVER_ERR 1088 -#define MSG_BAD_QUERY_OPEN 1089 -#define MSG_BAD_RETURN_TYPE 1090 -#define MSG_BAD_VIEW_OPEN 1091 -#define MSG_NO_QRY_DELETE 1092 -#define MSG_NO_SQL_DELETE 1093 -#define MSG_NO_VIEW_SORT 1094 -#define MSG_NULL_COL_VALUE 1095 -#define MSG_QRY_READ_ONLY 1096 -#define MSG_READCOL_ERROR 1097 -#define MSG_SQL_READ_ONLY 1098 -#define MSG_GET_NAME_ERR 1099 -#define MSG_INV_SUBTYPE 1100 -#define MSG_NO_CURLY_BRKT 1101 -#define MSG_NO_KEY_UPDATE 1102 -#define MSG_NO_SECTION_NAME 1103 -#define MSG_NO_SEC_UPDATE 1104 -#define MSG_SEC_KEY_FIRST 1105 -#define MSG_SEC_NAME_FIRST 1106 -#define MSG_NO_MATCHING_COL 1107 -#define MSG_BAD_BYTE_NUM 1108 -#define MSG_BAD_BYTE_READ 1109 -#define MSG_BAD_READ_NUMBER 1110 -#define MSG_BLK_IS_NULL 1111 -#define MSG_EMPTY_FILE 1112 -#define MSG_MAKE_EMPTY_FILE 1113 -#define MSG_MAKING 1114 -#define MSG_NO_VCT_DELETE 1115 -#define MSG_OPEN_EMPTY_FILE 1116 -#define MSG_OPT_INIT 1117 -#define MSG_SFP_ERROR 1118 -#define MSG_TO_BLK_IS_NULL 1119 -#define MSG_TRUNC_BY_ESTIM 1120 -#define MSG_UPDATE_ERROR 1121 -#define MSG_WRITE_STRERROR 1122 -#define MSG_WRITING 1123 -#define MSG_BAD_COL_XPATH 1124 -#define MSG_BAD_NODE_TYPE 1125 -#define MSG_BAD_VALNODE 1126 -#define MSG_BAD_VAL_UPDATE 1127 -#define MSG_COL_ALLOC_ERR 1128 -#define MSG_COM_ERROR 1129 -#define MSG_CONCAT_SUBNODE 1130 -#define MSG_CREATED_PLUGDB 1131 -#define MSG_DEPREC_FLAG 1132 -#define MSG_EMPTY_DOC 1133 -#define MSG_FAIL_ADD_NODE 1134 -#define MSG_FILE_UNFOUND 1135 -#define MSG_INIT_FAILED 1136 -#define MSG_INV_COL_TYPE 1137 -#define MSG_LOADING_FAILED 1138 -#define MSG_MISSING_NODE 1139 -#define MSG_MISSING_ROWNODE 1140 -#define MSG_MIS_TAG_LIST 1141 -#define MSG_NEW_DOC_FAILED 1142 -#define MSG_NO_ROW_NODE 1143 -#define MSG_VAL_ALLOC_ERR 1144 -#define MSG_XMLTAB_INIT_ERR 1145 -#define MSG_XML_INIT_ERROR 1146 -#define MSG_XPATH_NOT_SUPP 1147 -#define MSG_DLL_LOAD_ERROR 1148 -#define MSG_GZOPEN_ERROR 1149 -#define MSG_GZPUTS_ERROR 1150 -#define MSG_NO_ZIP_DELETE 1151 -#define MSG_NO_ZIP_DIR_ACC 1152 -#define MSG_UPD_ZIP_NOT_IMP 1153 -#define MSG_MAC_NO_DELETE 1154 -#define MSG_MAC_NO_INDEX 1155 -#define MSG_MAC_READ_ONLY 1156 -#define MSG_BAD_FIELD_TYPE 1157 -#define MSG_BAD_PARM_COUNT 1158 -#define MSG_NO_JOIN_UPDEL 1159 -#define MSG_NO_MYSQL_DELETE 1160 -#define MSG_NO_REF_DELETE 1161 -#define MSG_NO_REF_UPDATE 1162 -#define MSG_NO_SPEC_COL 1163 -#define MSG_ADD_NULL_DOM 1164 -#define MSG_BAD_DOM_VALUE 1165 -#define MSG_BAD_SET_STRING 1166 -#define MSG_BAD_VALBLK_INDX 1167 -#define MSG_BAD_VALBLK_TYPE 1168 -#define MSG_COMPUTE_NIY 1169 -#define MSG_DOMAIN_EMPTY 1170 -#define MSG_DOMAIN_FULL 1171 -#define MSG_DOM_FILE_ERROR 1172 -#define MSG_DOM_OPEN_ERROR 1173 -#define MSG_DOM_READ_ERROR 1174 -#define MSG_DOM_READ_ONLY 1175 -#define MSG_DOM_WRITE_ERROR 1176 -#define MSG_ERR_NUM_GT_MAX 1177 -#define MSG_INV_TOK_DOMAIN 1178 -#define MSG_MEMSIZE_TOO_BIG 1179 -#define MSG_NO_DOM_DELETE 1180 -#define MSG_NO_DOM_MATCH 1181 -#define MSG_SET_NULL_DOM 1182 -#define MSG_STRING_TOO_BIG 1183 -#define MSG_VALTYPE_NOMATCH 1184 -#define MSG_NO_DATE_FMT 1185 -#define MSG_NO_LISTVAL_HERE 1186 -#define MSG_BAD_COL_FORMAT 1187 -#define MSG_BAD_DATETIME 1188 -#define MSG_BAD_DATE_OPER 1189 -#define MSG_BAD_EXP_OPER 1190 -#define MSG_BAD_PAD_ARGTYP 1191 -#define MSG_BAD_TRIM_ARGTYP 1192 -#define MSG_BLKTYPLEN_MISM 1193 -#define MSG_COMPUTE_ERROR 1194 -#define MSG_FIX_OVFLW_ADD 1195 -#define MSG_FIX_OVFLW_TIMES 1196 -#define MSG_FIX_UNFLW_ADD 1197 -#define MSG_FIX_UNFLW_TIMES 1198 -#define MSG_HARRY_COMP_NIY 1199 -#define MSG_NO_CHAR_FROM 1200 -#define MSG_NO_FORMAT_TYPE 1201 -#define MSG_ONLY_LOG10_IMPL 1202 -#define MSG_OP_RES_TOO_LONG 1203 -#define MSG_SET_STR_TRUNC 1204 -#define MSG_SUB_RES_TOO_LNG 1205 -#define MSG_VALIST_MISMATCH 1206 -#define MSG_VALSTR_TOO_LONG 1207 -#define MSG_ZERO_DIVIDE 1208 -#define MSG_ADDVAL_ERROR 1209 -#define MSG_ARRAY_ALLOC_ERR 1210 -#define MSG_BAD_DEF_ARG 1211 -#define MSG_BAD_FUNC_MODE 1212 -#define MSG_BAD_INDEX_COL 1213 -#define MSG_BAD_INDEX_DEF 1214 -#define MSG_BAD_INDEX_FILE 1215 -#define MSG_BAD_INDEX_PART 1216 -#define MSG_EOF_INDEX_FILE 1217 -#define MSG_FILE_CLOSE_ERR 1218 -#define MSG_FILE_MAP_ERR 1219 -#define MSG_FUNC_ERRNO 1220 -#define MSG_FUNC_ERROR 1221 -#define MSG_GRP_COL_MISM 1222 -#define MSG_HANDLE_IS_NULL 1223 -#define MSG_HI_OFFSET_ERR 1224 -#define MSG_INDEX_DEF_ERR 1225 -#define MSG_INDEX_INIT_ERR 1226 -#define MSG_INDEX_NOT_UNIQ 1227 -#define MSG_INT_COL_ERROR 1228 -#define MSG_KEY_ALLOC_ERR 1229 -#define MSG_MAP_OBJ_ERR 1230 -#define MSG_MISS_LEAD_COL 1231 -#define MSG_NEW_TABLE_ERR 1232 -#define MSG_NO_KEY_COL 1233 -#define MSG_NO_PART_MAP 1234 -#define MSG_NUMVAL_NOMATCH 1235 -#define MSG_RANGE_NIY 1236 -#define MSG_RANGE_NO_JOIN 1237 -#define MSG_REDUCE_INDEX 1238 -#define MSG_SAVING_INDEX 1239 -#define MSG_TABLE_NO_INDEX 1240 -#define MSG_XCOL_MISMATCH 1241 -#define MSG_XFILE_READERR 1242 -#define MSG_XFILE_TOO_SMALL 1243 -#define MSG_XFILE_WRITERR 1244 -#define MSG_ADD_BAD_TYPE 1245 -#define MSG_BAD_ARRAY_TYPE 1246 -#define MSG_BAD_CONST_TYPE 1247 -#define MSG_BAD_CONV_TYPE 1248 -#define MSG_BAD_FLOAT_CONV 1249 -#define MSG_BAD_TEST_TYPE 1250 -#define MSG_FIND_BAD_TYPE 1251 +#define MSG_ACCESS_VIOLATN 200 +#define MSG_ADD_BAD_TYPE 201 +#define MSG_ALLOC_ERROR 202 +#define MSG_ANSWER_TYPE 203 +#define MSG_API_CONF_ERROR 204 +#define MSG_APPL_NOT_INIT 205 +#define MSG_ARRAY_BNDS_EXCD 206 +#define MSG_BAD_ARRAY_OPER 207 +#define MSG_BAD_ARRAY_TYPE 208 +#define MSG_BAD_ARRAY_VAL 209 +#define MSG_BAD_BIN_FMT 210 +#define MSG_BAD_BLK_ESTIM 211 +#define MSG_BAD_BLK_SIZE 212 +#define MSG_BAD_BYTE_NUM 213 +#define MSG_BAD_BYTE_READ 214 +#define MSG_BAD_COL_TYPE 215 +#define MSG_BAD_COL_XPATH 216 +#define MSG_BAD_CONST_TYPE 217 +#define MSG_BAD_CONV_TYPE 218 +#define MSG_BAD_DATETIME 219 +#define MSG_BAD_DBF_FILE 220 +#define MSG_BAD_DBF_REC 221 +#define MSG_BAD_DBF_TYPE 222 +#define MSG_BAD_DIRECTORY 223 +#define MSG_BAD_FIELD_RANK 224 +#define MSG_BAD_FIELD_TYPE 225 +#define MSG_BAD_FILE_HANDLE 226 +#define MSG_BAD_FILTER 227 +#define MSG_BAD_FILTER_CONV 228 +#define MSG_BAD_FILTER_OP 229 +#define MSG_BAD_FLD_FORMAT 230 +#define MSG_BAD_FLD_LENGTH 231 +#define MSG_BAD_FREQ_SET 232 +#define MSG_BAD_FUNC_MODE 233 +#define MSG_BAD_HANDLE_VAL 234 +#define MSG_BAD_HEADER 235 +#define MSG_BAD_HEAD_END 236 +#define MSG_BAD_INDEX_FILE 237 +#define MSG_BAD_LINEFLD_FMT 238 +#define MSG_BAD_LINE_LEN 239 +#define MSG_BAD_LRECL 240 +#define MSG_BAD_NODE_TYPE 241 +#define MSG_BAD_OFFSET_VAL 242 +#define MSG_BAD_OPEN_MODE 243 +#define MSG_BAD_PARAM_TYPE 244 +#define MSG_BAD_PARM_COUNT 245 +#define MSG_BAD_QUOTE_FIELD 246 +#define MSG_BAD_READ_NUMBER 247 +#define MSG_BAD_RECFM 248 +#define MSG_BAD_RECFM_VAL 249 +#define MSG_BAD_SET_CASE 250 +#define MSG_BAD_SET_STRING 251 +#define MSG_BAD_SPECIAL_COL 252 +#define MSG_BAD_SPEC_COLUMN 253 +#define MSG_BAD_TABLE_TYPE 254 +#define MSG_BAD_TYPE_LIKE 255 +#define MSG_BAD_VALBLK_INDX 256 +#define MSG_BAD_VALBLK_TYPE 257 +#define MSG_BAD_VALNODE 258 +#define MSG_BAD_VALUE_TYPE 259 +#define MSG_BAD_VAL_UPDATE 260 +#define MSG_BAS_NS_LIST 261 +#define MSG_BIN_F_TOO_LONG 262 +#define MSG_BIN_MODE_FAIL 263 +#define MSG_BLKTYPLEN_MISM 264 +#define MSG_BLK_IS_NULL 265 +#define MSG_BREAKPOINT 266 +#define MSG_BUILD_INDEX 267 +#define MSG_CANNOT_OPEN 268 +#define MSG_CHSIZE_ERROR 269 +#define MSG_COL_ALLOC_ERR 270 +#define MSG_COL_ISNOT_TABLE 271 +#define MSG_COL_NOT_SORTED 272 +#define MSG_COL_NUM_MISM 273 +#define MSG_COM_ERROR 274 +#define MSG_CONCAT_SUBNODE 275 +#define MSG_CONNECT_CANCEL 276 +#define MSG_CONTROL_C_EXIT 277 +#define MSG_DATABASE_LOADED 278 +#define MSG_DATA_MISALIGN 279 +#define MSG_DBASE_FILE 280 +#define MSG_DEF_ALLOC_ERROR 281 +#define MSG_DEL_FILE_ERR 282 +#define MSG_DEL_READ_ERROR 283 +#define MSG_DEL_WRITE_ERROR 284 +#define MSG_DEPREC_FLAG 285 +#define MSG_DLL_LOAD_ERROR 286 +#define MSG_DOM_NOT_SUPP 287 +#define MSG_DVAL_NOTIN_LIST 288 +#define MSG_EMPTY_DOC 289 +#define MSG_EMPTY_FILE 290 +#define MSG_EOF_AFTER_LINE 291 +#define MSG_EOF_INDEX_FILE 292 +#define MSG_ERROR_IN_LSK 293 +#define MSG_ERROR_IN_SFP 294 +#define MSG_ERR_READING_REC 295 +#define MSG_FAIL_ADD_NODE 296 +#define MSG_FETCH_NO_RES 297 +#define MSG_FIELD_TOO_LONG 298 +#define MSG_FILELEN_ERROR 299 +#define MSG_FILE_IS_EMPTY 300 +#define MSG_FILE_MAP_ERR 301 +#define MSG_FILE_MAP_ERROR 302 +#define MSG_FILE_OPEN_YET 303 +#define MSG_FILE_UNFOUND 304 +#define MSG_FLD_TOO_LNG_FOR 305 +#define MSG_FLT_BAD_RESULT 306 +#define MSG_FLT_DENORMAL_OP 307 +#define MSG_FLT_INVALID_OP 308 +#define MSG_FLT_OVERFLOW 309 +#define MSG_FLT_STACK_CHECK 310 +#define MSG_FLT_UNDERFLOW 311 +#define MSG_FLT_ZERO_DIVIDE 312 +#define MSG_FMT_WRITE_NIY 313 +#define MSG_FOXPRO_FILE 314 +#define MSG_FPUTS_ERROR 315 +#define MSG_FSEEK_ERROR 316 +#define MSG_FSETPOS_ERROR 317 +#define MSG_FTELL_ERROR 318 +#define MSG_FUNCTION_ERROR 319 +#define MSG_FUNC_ERRNO 320 +#define MSG_FUNC_ERROR 321 +#define MSG_FUNC_ERR_S 322 +#define MSG_FWRITE_ERROR 323 +#define MSG_GET_DIST_VALS 324 +#define MSG_GET_FUNC_ERR 325 +#define MSG_GLOBAL_ERROR 326 +#define MSG_GUARD_PAGE 327 +#define MSG_GZOPEN_ERROR 328 +#define MSG_ILLEGAL_INSTR 329 +#define MSG_ILL_FILTER_CONV 330 +#define MSG_INDEX_NOT_UNIQ 331 +#define MSG_INDEX_YET_ON 332 +#define MSG_INDX_COL_NOTIN 333 +#define MSG_INDX_EXIST_YET 334 +#define MSG_INIT_FAILED 335 +#define MSG_INT_COL_ERROR 336 +#define MSG_INT_OVERFLOW 337 +#define MSG_INT_ZERO_DIVIDE 338 +#define MSG_INVALID_DISP 339 +#define MSG_INVALID_FTYPE 340 +#define MSG_INVALID_HANDLE 341 +#define MSG_INVALID_OPER 342 +#define MSG_INV_COLUMN_TYPE 343 +#define MSG_INV_COL_TYPE 344 +#define MSG_INV_DEF_READ 345 +#define MSG_INV_DIRCOL_OFST 346 +#define MSG_INV_MAP_POS 347 +#define MSG_INV_RAND_ACC 348 +#define MSG_INV_REC_POS 349 +#define MSG_INV_RESULT_TYPE 350 +#define MSG_INV_UPDT_TABLE 351 +#define MSG_IN_WITHOUT_SUB 352 +#define MSG_KEY_ALLOC_ERR 353 +#define MSG_KEY_ALLOC_ERROR 354 +#define MSG_LINE_TOO_LONG 355 +#define MSG_LIST 356 +#define MSG_LOADING_FAILED 357 +#define MSG_LRECL_TOO_SMALL 358 +#define MSG_MAKE_EMPTY_FILE 359 +#define MSG_MAKING 360 +#define MSG_MALLOC_ERROR 361 +#define MSG_MAP_VIEW_ERROR 362 +#define MSG_MAXSIZE_ERROR 363 +#define MSG_MEM_ALLOC_ERR 364 +#define MSG_MEM_ALLOC_ERROR 365 +#define MSG_MISPLACED_QUOTE 366 +#define MSG_MISSING_ARG 367 +#define MSG_MISSING_FIELD 368 +#define MSG_MISSING_FNAME 369 +#define MSG_MISSING_NODE 370 +#define MSG_MISSING_ROWNODE 371 +#define MSG_MIS_TAG_LIST 372 +#define MSG_MUL_MAKECOL_ERR 373 +#define MSG_NAME_CONV_ERR 374 +#define MSG_NEW_DOC_FAILED 375 +#define MSG_NEW_RETURN_NULL 376 +#define MSG_NEXT_FILE_ERROR 377 +#define MSG_NONCONT_EXCEPT 378 +#define MSG_NOP_ZLIB_INDEX 379 +#define MSG_NOT_A_DBF_FILE 380 +#define MSG_NOT_FIXED_LEN 381 +#define MSG_NO_0DH_HEAD 382 +#define MSG_NO_ACTIVE_DB 383 +#define MSG_NO_CHAR_FROM 384 +#define MSG_NO_DATE_FMT 385 +#define MSG_NO_DEF_FNCCOL 386 +#define MSG_NO_DEF_PIVOTCOL 387 +#define MSG_NO_DIR_INDX_RD 388 +#define MSG_NO_FEAT_SUPPORT 389 +#define MSG_NO_FLD_FORMAT 390 +#define MSG_NO_FORMAT_COL 391 +#define MSG_NO_FORMAT_TYPE 392 +#define MSG_NO_INDEX_READ 393 +#define MSG_NO_KEY_COL 394 +#define MSG_NO_KEY_UPDATE 395 +#define MSG_NO_MAP_INSERT 396 +#define MSG_NO_MATCHING_COL 397 +#define MSG_NO_MATCH_COL 398 +#define MSG_NO_MEMORY 399 +#define MSG_NO_MODE_PADDED 400 +#define MSG_NO_MUL_VCT 401 +#define MSG_NO_ODBC_DELETE 402 +#define MSG_NO_ODBC_DIRECT 403 +#define MSG_NO_ODBC_MUL 404 +#define MSG_NO_ODBC_SPECOL 405 +#define MSG_NO_PART_DEL 406 +#define MSG_NO_PART_MAP 407 +#define MSG_NO_PAR_BLK_INS 408 +#define MSG_NO_PIV_DIR_ACC 409 +#define MSG_NO_READ_32 410 +#define MSG_NO_RECOV_SPACE 411 +#define MSG_NO_ROWID_FOR_AM 412 +#define MSG_NO_ROW_NODE 413 +#define MSG_NO_SECTION_NAME 414 +#define MSG_NO_SEC_UPDATE 415 +#define MSG_NO_SETPOS_YET 416 +#define MSG_NO_SPEC_COL 417 +#define MSG_NO_SUB_VAL 418 +#define MSG_NO_TABCOL_DATA 419 +#define MSG_NO_TABLE_DEL 420 +#define MSG_NO_TAB_DATA 421 +#define MSG_NO_VCT_DELETE 422 +#define MSG_NO_ZIP_DELETE 423 +#define MSG_OPENING 424 +#define MSG_OPEN_EMPTY_FILE 425 +#define MSG_OPEN_ERROR 426 +#define MSG_OPEN_ERROR_IS 427 +#define MSG_OPEN_MODE_ERROR 428 +#define MSG_OPEN_STRERROR 429 +#define MSG_OPTBLK_RD_ERR 430 +#define MSG_OPTBLK_WR_ERR 431 +#define MSG_OPTIMIZING 432 +#define MSG_OPT_BMAP_RD_ERR 433 +#define MSG_OPT_BMAP_WR_ERR 434 +#define MSG_OPT_CANCELLED 435 +#define MSG_OPT_DVAL_RD_ERR 436 +#define MSG_OPT_DVAL_WR_ERR 437 +#define MSG_OPT_HEAD_RD_ERR 438 +#define MSG_OPT_HEAD_WR_ERR 439 +#define MSG_OPT_LOGIC_ERR 440 +#define MSG_OPT_MAX_RD_ERR 441 +#define MSG_OPT_MAX_WR_ERR 442 +#define MSG_OPT_MIN_RD_ERR 443 +#define MSG_OPT_MIN_WR_ERR 444 +#define MSG_OPT_NOT_MATCH 445 +#define MSG_PAGE_ERROR 446 +#define MSG_PARM_CNT_MISS 447 +#define MSG_PREC_VBLP_NULL 448 +#define MSG_PRIV_INSTR 449 +#define MSG_PROCADD_ERROR 450 +#define MSG_QUERY_CANCELLED 451 +#define MSG_RANGE_NO_JOIN 452 +#define MSG_RC_READING 453 +#define MSG_READY 454 +#define MSG_READ_ERROR 455 +#define MSG_READ_ONLY 456 +#define MSG_READ_SEEK_ERROR 457 +#define MSG_REGISTER_ERR 458 +#define MSG_REMOVE_ERROR 459 +#define MSG_RENAME_ERROR 460 +#define MSG_ROWID_NOT_IMPL 461 +#define MSG_SEC_KEY_FIRST 462 +#define MSG_SEC_NAME_FIRST 463 +#define MSG_SEP_IN_FIELD 464 +#define MSG_SEQUENCE_ERROR 465 +#define MSG_SETEOF_ERROR 466 +#define MSG_SETRECPOS_NIY 467 +#define MSG_SET_STR_TRUNC 468 +#define MSG_SFP_ERROR 469 +#define MSG_SHARED_LIB_ERR 470 +#define MSG_SINGLE_STEP 471 +#define MSG_SORTING_VAL 472 +#define MSG_SPCOL_READONLY 473 +#define MSG_SQL_CONF_ERROR 474 +#define MSG_SRCH_CLOSE_ERR 475 +#define MSG_SRC_TABLE_UNDEF 476 +#define MSG_STACK_OVERFLOW 477 +#define MSG_TABDIR_READONLY 478 +#define MSG_TABLE_NOT_OPT 479 +#define MSG_TABLE_NO_INDEX 480 +#define MSG_TABLE_READ_ONLY 481 +#define MSG_TABMUL_READONLY 482 +#define MSG_TOO_MANY_FIELDS 483 +#define MSG_TOO_MANY_JUMPS 484 +#define MSG_TOO_MANY_KEYS 485 +#define MSG_TO_BLK_IS_NULL 486 +#define MSG_TRUNCATE_ERROR 487 +#define MSG_TRUNC_BY_ESTIM 488 +#define MSG_TYPE_MISMATCH 489 +#define MSG_TYPE_VALUE_ERR 490 +#define MSG_UNBALANCE_QUOTE 491 +#define MSG_UNDEFINED_AM 492 +#define MSG_UNKNOWN_EXCPT 493 +#define MSG_UNMATCH_FIL_ARG 494 +#define MSG_UPDATE_ERROR 495 +#define MSG_UPD_ZIP_NOT_IMP 496 +#define MSG_VALSTR_TOO_LONG 497 +#define MSG_VALTYPE_NOMATCH 498 +#define MSG_VALUE_ERROR 499 +#define MSG_VALUE_TOO_BIG 500 +#define MSG_VALUE_TOO_LONG 501 +#define MSG_VAL_ALLOC_ERR 502 +#define MSG_VIR_NO_DELETE 503 +#define MSG_VIR_READ_ONLY 504 +#define MSG_VOID_FIRST_ARG 505 +#define MSG_WORK_AREA 506 +#define MSG_WRITE_SEEK_ERR 507 +#define MSG_WRITE_STRERROR 508 +#define MSG_WRITING 509 +#define MSG_WRITING_ERROR 510 +#define MSG_WS_CONV_ERR 511 +#define MSG_XCOL_MISMATCH 512 +#define MSG_XFILE_READERR 513 +#define MSG_XFILE_WRITERR 514 +#define MSG_XMLTAB_INIT_ERR 515 +#define MSG_XML_INIT_ERROR 516 +#define MSG_XPATH_CNTX_ERR 517 +#define MSG_XPATH_EVAL_ERR 518 +#define MSG_XPATH_NOT_SUPP 519 diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index 660e2adec2f..fc6c29092a1 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -28,6 +28,8 @@ /***********************************************************************/ /* Include relevant MariaDB header file. */ /***********************************************************************/ +#include + #if defined(WIN32) //#include //#include @@ -86,6 +88,7 @@ #if defined(PIVOT_SUPPORT) #include "tabpivot.h" #endif // PIVOT_SUPPORT +#include "tabvir.h" #include "ha_connect.h" #include "mycat.h" @@ -96,8 +99,6 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #endif // !WIN32 -extern "C" int trace; - PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); /***********************************************************************/ @@ -137,6 +138,7 @@ TABTYPE GetTypeID(const char *type) #ifdef PIVOT_SUPPORT : (!stricmp(type, "PIVOT")) ? TAB_PIVOT #endif + : (!stricmp(type, "VIR")) ? TAB_VIR : (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY; } // end of GetTypeID @@ -180,6 +182,7 @@ bool IsExactType(TABTYPE type) case TAB_DBF: // case TAB_XML: depends on Multiple || Xpand || Coltype case TAB_VEC: + case TAB_VIR: exact= true; break; default: @@ -278,6 +281,9 @@ int GetIndexType(TABTYPE type) // case TAB_ODBC: xtyp= 2; break; + case TAB_VIR: + xtyp= 3; + break; case TAB_ODBC: default: xtyp= 0; @@ -531,6 +537,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) #if defined(PIVOT_SUPPORT) case TAB_PIVOT: tdp= new(g) PIVOTDEF; break; #endif // PIVOT_SUPPORT + case TAB_VIR: tdp= new(g) VIRDEF; break; default: sprintf(g->Message, MSG(BAD_TABLE_TYPE), am, name); } // endswitch diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 0c4b50f1d0b..92c2faea676 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -46,11 +46,11 @@ #include "plgcnx.h" // For DB types #include "resource.h" //#include "value.h" -#include "valblk.h" +//#include "valblk.h" +#include "xobject.h" #define DLL_EXPORT // Items are exported from this DLL #include "myconn.h" -extern "C" int trace; extern "C" int zconv; extern MYSQL_PLUGIN_IMPORT uint mysqld_port; extern MYSQL_PLUGIN_IMPORT char *mysqld_unix_port; @@ -135,7 +135,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, FLD_REM, FLD_NO, FLD_DEFAULT, FLD_EXTRA, FLD_CHARSET}; unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0}; - char *fld, *colname, *chset, *fmt, v, cmd[128], uns[16], zero[16]; + char *fld, *colname, *chset, *fmt, v, buf[128], uns[16], zero[16]; int i, n, nf, ncol = sizeof(buftyp) / sizeof(int); int len, type, prec, rc, k = 0; PQRYRES qrp; @@ -155,16 +155,26 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, /********************************************************************/ /* Do an evaluation of the result size. */ /********************************************************************/ - sprintf(cmd, "SHOW FULL COLUMNS FROM %s", table); - strcat(strcat(cmd, " FROM "), (db) ? db : PlgGetUser(g)->DBName); + STRING cmd(g, 64, "SHOW FULL COLUMNS FROM "); + bool b = cmd.Append((PSZ)table); - if (colpat) - strcat(strcat(cmd, " LIKE "), colpat); + b |= cmd.Append(" FROM "); + b |= cmd.Append((PSZ)(db ? db : PlgGetUser(g)->DBName)); + + if (colpat) { + b |= cmd.Append(" LIKE "); + b |= cmd.Append((PSZ)colpat); + } // endif colpat + + if (b) { + strcpy(g->Message, "Out of memory"); + return NULL; + } // endif b if (trace) - htrc("MyColumns: cmd='%s'\n", cmd); + htrc("MyColumns: cmd='%s'\n", cmd.GetStr()); - if ((n = myc.GetResultSize(g, cmd)) < 0) { + if ((n = myc.GetResultSize(g, cmd.GetStr())) < 0) { myc.Close(); return NULL; } // endif n @@ -225,15 +235,15 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, *uns = 0; *zero = 0; - switch ((nf = sscanf(fld, "%[^(](%d,%d", cmd, &len, &prec))) { + switch ((nf = sscanf(fld, "%[^(](%d,%d", buf, &len, &prec))) { case 3: - nf = sscanf(fld, "%[^(](%d,%d) %s %s", cmd, &len, &prec, uns, zero); + nf = sscanf(fld, "%[^(](%d,%d) %s %s", buf, &len, &prec, uns, zero); break; case 2: - nf = sscanf(fld, "%[^(](%d) %s %s", cmd, &len, uns, zero) + 1; + nf = sscanf(fld, "%[^(](%d) %s %s", buf, &len, uns, zero) + 1; break; case 1: - nf = sscanf(fld, "%s %s %s", cmd, uns, zero) + 2; + nf = sscanf(fld, "%s %s %s", buf, uns, zero) + 2; break; default: sprintf(g->Message, MSG(BAD_FIELD_TYPE), fld); @@ -241,16 +251,16 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, return NULL; } // endswitch nf - if ((type = MYSQLtoPLG(cmd, &v)) == TYPE_ERROR) { + if ((type = MYSQLtoPLG(buf, &v)) == TYPE_ERROR) { if (v == 'K') { // Skip this column sprintf(g->Message, "Column %s skipped (unsupported type %s)", - colname, cmd); + colname, buf); PushWarning(g, thd); continue; } // endif v - sprintf(g->Message, "Column %s unsupported type %s", colname, cmd); + sprintf(g->Message, "Column %s unsupported type %s", colname, buf); myc.Close(); return NULL; } else if (type == TYPE_STRING) { @@ -276,11 +286,11 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, } // endswitch nf crp = crp->Next; // Type_Name - crp->Kdata->SetValue(cmd, i); + crp->Kdata->SetValue(buf, i); if (type == TYPE_DATE) { // When creating tables we do need info about date columns - fmt = MyDateFmt(cmd); + fmt = MyDateFmt(buf); len = strlen(fmt); } else fmt = NULL; diff --git a/storage/connect/mysql-test/connect/r/datest.result b/storage/connect/mysql-test/connect/r/datest.result new file mode 100644 index 00000000000..203a7419a8e --- /dev/null +++ b/storage/connect/mysql-test/connect/r/datest.result @@ -0,0 +1,32 @@ +# +# Testing out of range dates as (var)char +# +CREATE TABLE t1 ( +id INT NOT NULL, +dat CHAR(10) NOT NULL, +tim CHAR(8) DEFAULT '09:35:08', +datim CHAR(19) DEFAULT '1789-08-10 14:20:30') +ENGINE=CONNECT TABLE_TYPE=FIX; +Warnings: +Warning 1105 No file name. Table will use t1.fix +INSERT INTO t1(id,dat) VALUES(1,'1515-04-01'),(2,'2014-07-26'),(3,'2118-11-02'); +SELECT * FROM t1; +id dat tim datim +1 1515-04-01 09:35:08 1789-08-10 14:20:30 +2 2014-07-26 09:35:08 1789-08-10 14:20:30 +3 2118-11-02 09:35:08 1789-08-10 14:20:30 +SELECT id, DATE(datim) FROM t1 LIMIT 1; +id DATE(datim) +1 1789-08-10 +SELECT id, DAYNAME(dat) FROM t1; +id DAYNAME(dat) +1 Thursday +2 Saturday +3 Wednesday +SELECT id, DAYNAME(datim) FROM t1 LIMIT 1; +id DAYNAME(datim) +1 Monday +SELECT id, TIME(tim) FROM t1 LIMIT 1; +id TIME(tim) +1 09:35:08.000000 +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/mrr.result b/storage/connect/mysql-test/connect/r/mrr.result new file mode 100644 index 00000000000..0d31daa736c --- /dev/null +++ b/storage/connect/mysql-test/connect/r/mrr.result @@ -0,0 +1,117 @@ +# +# Show MRR setting. The way it is done is because the t3 table cannot be directly based on +# the information_schema.session_variables table. Not being a CONNECT table, it would be +# read using an intermediate MYSQL table using the MySQL API and could not reflect the +# current session variable change (the call would create another session) This would be +# correct only for querying GLOBAL variables but is not what we want to do here. +# +CREATE TABLE t2 ( +name VARCHAR(64) NOT NULL, +value VARCHAR(1024) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=DOS; +Warnings: +Warning 1105 No file name. Table will use t2.dos +INSERT INTO t2 SELECT * FROM information_schema.session_variables WHERE variable_name = 'OPTIMIZER_SWITCH'; +create table t3 ( +name CHAR(32) NOT NULL, +value CHAR(64) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=t2 OPTION_LIST='Colname=value'; +SELECT value FROM t3 WHERE value LIKE 'mrr%'; +value +mrr=off +mrr_cost_based=off +mrr_sort_keys=off +# +# Testing indexing with MRR OFF +# +CREATE TABLE t1 +( +matricule INT(4) KEY NOT NULL field_format='Z', +nom VARCHAR(16) NOT NULL, +prenom VARCHAR(20) NOT NULL, +sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F', +aanais INT(4) NOT NULL, +mmnais INT(2) NOT NULL, +ddentree DATE NOT NULL date_format='YYYYMM', +ddnom DATE NOT NULL date_format='YYYYMM', +brut INT(5) NOT NULL, +net DOUBLE(8,2) NOT NULL, +service INT(2) NOT NULL, +sitmat CHAR(1) NOT NULL, +formation CHAR(5) NOT NULL, +INDEX NP(nom,prenom) +) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2; +SELECT * FROM t1 LIMIT 10; +matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation +5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN +9692 VICENTE LAURENCE 2 1941 8 1967-10-01 1989-01-01 16212 13032.80 0 M ANGL +9146 NICOLAS ROGER 1 1941 6 1964-07-01 1995-02-01 34173 25098.65 0 M SANS +2985 TESSEREAU MARIE HELENE 2 1941 9 1967-01-01 1990-01-01 19323 14933.78 0 V SANS +3368 MOGADOR ALAIN 1 1941 1 1961-09-01 1993-11-01 43303 31420.55 0 C SANS +7394 CHAUSSEE ERIC DENIS 1 1944 9 1965-11-01 1983-12-01 32002 23583.86 0 M ANGL +4655 MAILLOT GEORGES 1 1945 5 1970-09-01 1986-12-01 24700 18541.64 0 C ANGL +2825 CAMILLE NADINE 2 1956 9 1994-01-01 1993-01-01 19494 15050.45 0 M SANS +1460 BRUYERES JEAN MARC 1 1958 8 1984-08-01 1988-05-01 20902 15980.07 0 M SANS +4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS +# Without MRR, the rows are retrieved sorted by name +SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); +matricule nom prenom sitmat net +5324 CERF CLAUDE M 9503.34 +7703 CERF NICOLE M 12025.61 +3110 CERF VALERIE M 10472.37 +4454 ETANG BEATRICE M 11017.61 +1022 ETANG GERARD L 8729.58 +8222 ETANG LIONEL M 13497.90 +2492 ETANG PASCAL VINCENT M 11986.62 +1977 FOCH BERNADETTE . 8145.03 +5707 FOCH DENIS C 7679.36 +2552 FOCH FRANCK M 10745.81 +2634 FOCH JOCELYNE M 10473.09 +5765 FOCH ROBERT M 12916.32 +4080 FOCH SERGE M 9658.24 +5898 ITALIE DENIS M 9502.41 +7606 ITALIE JACQUES C 7679.45 +1067 ITALIE SVETLANA M 11713.61 +5853 ROI CHANTAL . 8147.06 +2995 ROI JEAN M 11715.50 +2531 ROI MICHEL L 10240.44 +5846 ROI PATRICIA M 15669.57 +# +# Testing indexing with MRR ON +# +SET @@LOCAL.OPTIMIZER_SWITCH='mrr=on'; +# Refresh the t2 table to reflect the change +UPDATE t2, information_schema.session_variables SET value = variable_value WHERE variable_name = 'OPTIMIZER_SWITCH'; +# Check that MRR is ON for the session +SELECT value FROM t3 WHERE value LIKE 'mrr%'; +value +mrr=on +mrr_cost_based=off +mrr_sort_keys=off +# With MRR, the rows are retrieved sorted by their position in the table +SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); +matricule nom prenom sitmat net +1977 FOCH BERNADETTE . 8145.03 +2995 ROI JEAN M 11715.50 +3110 CERF VALERIE M 10472.37 +5324 CERF CLAUDE M 9503.34 +4080 FOCH SERGE M 9658.24 +4454 ETANG BEATRICE M 11017.61 +5898 ITALIE DENIS M 9502.41 +2552 FOCH FRANCK M 10745.81 +2531 ROI MICHEL L 10240.44 +5853 ROI CHANTAL . 8147.06 +8222 ETANG LIONEL M 13497.90 +5707 FOCH DENIS C 7679.36 +1067 ITALIE SVETLANA M 11713.61 +7606 ITALIE JACQUES C 7679.45 +7703 CERF NICOLE M 12025.61 +2634 FOCH JOCELYNE M 10473.09 +1022 ETANG GERARD L 8729.58 +5846 ROI PATRICIA M 15669.57 +2492 ETANG PASCAL VINCENT M 11986.62 +5765 FOCH ROBERT M 12916.32 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +SET @@LOCAL.OPTIMIZER_SWITCH='mrr=off'; diff --git a/storage/connect/mysql-test/connect/r/updelx2.result b/storage/connect/mysql-test/connect/r/updelx2.result new file mode 100644 index 00000000000..1ed3709f0ba --- /dev/null +++ b/storage/connect/mysql-test/connect/r/updelx2.result @@ -0,0 +1,133 @@ +# +# Testing multiple indexed UPDATE and DELETE +# +CREATE TABLE t1 ( +id INT(4) NOT NULL, +msg VARCHAR(16) NOT NULL, +INDEX IDM(id,msg)) +ENGINE=CONNECT TABLE_TYPE=DOS; +Warnings: +Warning 1105 No file name. Table will use t1.dos +INSERT INTO t1 VALUES(1,'one'),(4, 'four'),(7,'seven'),(8,'eight'),(10,'ten'),(11,'eleven'),(40,'forty'),(35,'thirty five'),(60,'sixty'),(72,'seventy two'),(81,'eighty one'); +INSERT INTO t1 VALUES(1,'un'),(4, 'quatre'),(7,'sept'),(8,'huit'),(10,'dix'),(11,'onze'),(40,'quarante'),(35,'trente cinq'),(60,'soixante'),(72,'soixante douze'),(81,'quatrevingt un'); +SELECT * FROM t1 IGNORE INDEX (IDM); +id msg +1 one +4 four +7 seven +8 eight +10 ten +11 eleven +40 forty +35 thirty five +60 sixty +72 seventy two +81 eighty one +1 un +4 quatre +7 sept +8 huit +10 dix +11 onze +40 quarante +35 trente cinq +60 soixante +72 soixante douze +81 quatrevingt un +UPDATE t1 SET msg = 'dieci' WHERE id = 10; +SELECT * FROM t1 IGNORE INDEX (IDM); +id msg +1 one +4 four +7 seven +8 eight +10 dieci +11 eleven +40 forty +35 thirty five +60 sixty +72 seventy two +81 eighty one +1 un +4 quatre +7 sept +8 huit +10 dieci +11 onze +40 quarante +35 trente cinq +60 soixante +72 soixante douze +81 quatrevingt un +UPDATE t1 SET msg = 'septante deux' WHERE id = 72; +SELECT * FROM t1 IGNORE INDEX (IDM); +id msg +1 one +4 four +7 seven +8 eight +10 dieci +11 eleven +40 forty +35 thirty five +60 sixty +72 septante deux +81 eighty one +1 un +4 quatre +7 sept +8 huit +10 dieci +11 onze +40 quarante +35 trente cinq +60 soixante +72 septante deux +81 quatrevingt un +UPDATE t1 SET id=2, msg='deux' WHERE id=4 AND msg='quatre'; +SELECT * FROM t1 IGNORE INDEX (IDM); +id msg +1 one +4 four +7 seven +8 eight +10 dieci +11 eleven +40 forty +35 thirty five +60 sixty +72 septante deux +81 eighty one +1 un +2 deux +7 sept +8 huit +10 dieci +11 onze +40 quarante +35 trente cinq +60 soixante +72 septante deux +81 quatrevingt un +DELETE FROM t1 WHERE id IN (8,40); +SELECT * FROM t1 IGNORE INDEX (IDM); +id msg +1 one +4 four +7 seven +10 dieci +11 eleven +35 thirty five +60 sixty +72 septante deux +81 eighty one +1 un +2 deux +7 sept +10 dieci +11 onze +35 trente cinq +60 soixante +72 septante deux +81 quatrevingt un +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/xcol.result b/storage/connect/mysql-test/connect/r/xcol.result index f6899b47504..94d1e0619cb 100644 --- a/storage/connect/mysql-test/connect/r/xcol.result +++ b/storage/connect/mysql-test/connect/r/xcol.result @@ -1,5 +1,5 @@ # -# Checking XCOL tables +# Make the children list table # CREATE TABLE chlist ( mother char(12) NOT NULL COMMENT 'The mother of the listed children', @@ -20,7 +20,10 @@ Lisbeth Lucy,Charles,Diana Corinne NULL Claude Marc Janet Arthur,Sandra,Peter,John -CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=PORT'; +# +# Checking XCOL tables +# +CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children'; SELECT * FROM child; mother children Sophia Vivian @@ -81,5 +84,34 @@ Corinne 0 Janet 4 Lisbeth 3 Sophia 2 +# +# Test using special columns +# +CREATE TABLE `child2` ( +`row` int NOT NULL SPECIAL=ROWID, +`num` int NOT NULL SPECIAL=ROWNUM, +`mother` varchar(12) NOT NULL COMMENT 'The mother of the children', +`child` varchar(12) NOT NULL COMMENT 'The child name' FLAG=2 +) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist `OPTION_LIST`='colname=child'; +SELECT * FROM child2; +row num mother child +1 1 Sophia Vivian +2 2 Sophia Antony +3 1 Lisbeth Lucy +4 2 Lisbeth Charles +5 3 Lisbeth Diana +7 1 Claude Marc +8 1 Janet Arthur +9 2 Janet Sandra +10 3 Janet Peter +11 4 Janet John +# List only first child +SELECT mother, child FROM child2 where num = 1; +mother child +Sophia Vivian +Lisbeth Lucy +Claude Marc +Janet Arthur DROP TABLE child; DROP TABLE chlist; +DROP TABLE child2; diff --git a/storage/connect/mysql-test/connect/t/datest.test b/storage/connect/mysql-test/connect/t/datest.test new file mode 100644 index 00000000000..a986ce15a80 --- /dev/null +++ b/storage/connect/mysql-test/connect/t/datest.test @@ -0,0 +1,16 @@ +--echo # +--echo # Testing out of range dates as (var)char +--echo # +CREATE TABLE t1 ( +id INT NOT NULL, +dat CHAR(10) NOT NULL, +tim CHAR(8) DEFAULT '09:35:08', +datim CHAR(19) DEFAULT '1789-08-10 14:20:30') +ENGINE=CONNECT TABLE_TYPE=FIX; +INSERT INTO t1(id,dat) VALUES(1,'1515-04-01'),(2,'2014-07-26'),(3,'2118-11-02'); +SELECT * FROM t1; +SELECT id, DATE(datim) FROM t1 LIMIT 1; +SELECT id, DAYNAME(dat) FROM t1; +SELECT id, DAYNAME(datim) FROM t1 LIMIT 1; +SELECT id, TIME(tim) FROM t1 LIMIT 1; +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/mrr.test b/storage/connect/mysql-test/connect/t/mrr.test new file mode 100644 index 00000000000..37289ad427f --- /dev/null +++ b/storage/connect/mysql-test/connect/t/mrr.test @@ -0,0 +1,66 @@ +let $MYSQLD_DATADIR= `select @@datadir`; +--copy_file $MTR_SUITE_DIR/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt + +--echo # +--echo # Show MRR setting. The way it is done is because the t3 table cannot be directly based on +--echo # the information_schema.session_variables table. Not being a CONNECT table, it would be +--echo # read using an intermediate MYSQL table using the MySQL API and could not reflect the +--echo # current session variable change (the call would create another session) This would be +--echo # correct only for querying GLOBAL variables but is not what we want to do here. +--echo # +CREATE TABLE t2 ( +name VARCHAR(64) NOT NULL, +value VARCHAR(1024) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=DOS; +INSERT INTO t2 SELECT * FROM information_schema.session_variables WHERE variable_name = 'OPTIMIZER_SWITCH'; +# Check that MRR is OFF by default +create table t3 ( +name CHAR(32) NOT NULL, +value CHAR(64) NOT NULL +) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=t2 OPTION_LIST='Colname=value'; +SELECT value FROM t3 WHERE value LIKE 'mrr%'; + +--echo # +--echo # Testing indexing with MRR OFF +--echo # +CREATE TABLE t1 +( + matricule INT(4) KEY NOT NULL field_format='Z', + nom VARCHAR(16) NOT NULL, + prenom VARCHAR(20) NOT NULL, + sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F', + aanais INT(4) NOT NULL, + mmnais INT(2) NOT NULL, + ddentree DATE NOT NULL date_format='YYYYMM', + ddnom DATE NOT NULL date_format='YYYYMM', + brut INT(5) NOT NULL, + net DOUBLE(8,2) NOT NULL, + service INT(2) NOT NULL, + sitmat CHAR(1) NOT NULL, + formation CHAR(5) NOT NULL, + INDEX NP(nom,prenom) +) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2; +SELECT * FROM t1 LIMIT 10; +--echo # Without MRR, the rows are retrieved sorted by name +SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); + +--echo # +--echo # Testing indexing with MRR ON +--echo # +SET @@LOCAL.OPTIMIZER_SWITCH='mrr=on'; +--echo # Refresh the t2 table to reflect the change +UPDATE t2, information_schema.session_variables SET value = variable_value WHERE variable_name = 'OPTIMIZER_SWITCH'; +--echo # Check that MRR is ON for the session +SELECT value FROM t3 WHERE value LIKE 'mrr%'; +--echo # With MRR, the rows are retrieved sorted by their position in the table +SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +# +# Clean up +# +SET @@LOCAL.OPTIMIZER_SWITCH='mrr=off'; +--remove_file $MYSQLD_DATADIR/test/emp.txt diff --git a/storage/connect/mysql-test/connect/t/updelx2.test b/storage/connect/mysql-test/connect/t/updelx2.test new file mode 100644 index 00000000000..bf5434636ee --- /dev/null +++ b/storage/connect/mysql-test/connect/t/updelx2.test @@ -0,0 +1,22 @@ +-- source include/not_embedded.inc + +--echo # +--echo # Testing multiple indexed UPDATE and DELETE +--echo # +CREATE TABLE t1 ( +id INT(4) NOT NULL, +msg VARCHAR(16) NOT NULL, +INDEX IDM(id,msg)) +ENGINE=CONNECT TABLE_TYPE=DOS; +INSERT INTO t1 VALUES(1,'one'),(4, 'four'),(7,'seven'),(8,'eight'),(10,'ten'),(11,'eleven'),(40,'forty'),(35,'thirty five'),(60,'sixty'),(72,'seventy two'),(81,'eighty one'); +INSERT INTO t1 VALUES(1,'un'),(4, 'quatre'),(7,'sept'),(8,'huit'),(10,'dix'),(11,'onze'),(40,'quarante'),(35,'trente cinq'),(60,'soixante'),(72,'soixante douze'),(81,'quatrevingt un'); +SELECT * FROM t1 IGNORE INDEX (IDM); +UPDATE t1 SET msg = 'dieci' WHERE id = 10; +SELECT * FROM t1 IGNORE INDEX (IDM); +UPDATE t1 SET msg = 'septante deux' WHERE id = 72; +SELECT * FROM t1 IGNORE INDEX (IDM); +UPDATE t1 SET id=2, msg='deux' WHERE id=4 AND msg='quatre'; +SELECT * FROM t1 IGNORE INDEX (IDM); +DELETE FROM t1 WHERE id IN (8,40); +SELECT * FROM t1 IGNORE INDEX (IDM); +DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/xcol.test b/storage/connect/mysql-test/connect/t/xcol.test index b6998ee77e0..8f0edc2b268 100644 --- a/storage/connect/mysql-test/connect/t/xcol.test +++ b/storage/connect/mysql-test/connect/t/xcol.test @@ -1,8 +1,5 @@ -let $MYSQLD_DATADIR= `select @@datadir`; -let $PORT= `select @@port`; - --echo # ---echo # Checking XCOL tables +--echo # Make the children list table --echo # CREATE TABLE chlist ( mother char(12) NOT NULL COMMENT 'The mother of the listed children', @@ -15,8 +12,10 @@ INSERT INTO chlist VALUES('Claude','Marc'); INSERT INTO chlist VALUES('Janet','Arthur,Sandra,Peter,John'); SELECT * FROM chlist; ---replace_result $PORT PORT ---eval CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children,port=$PORT' +--echo # +--echo # Checking XCOL tables +--echo # +CREATE TABLE child ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist OPTION_LIST='colname=children'; SELECT * FROM child; SELECT * FROM child ORDER BY mother; SELECT * FROM child ORDER BY children; @@ -24,5 +23,19 @@ SELECT mother FROM child; SELECT mother, COUNT(*) FROM child GROUP BY mother; SELECT mother, COUNT(children) FROM child GROUP BY mother; +--echo # +--echo # Test using special columns +--echo # +CREATE TABLE `child2` ( + `row` int NOT NULL SPECIAL=ROWID, + `num` int NOT NULL SPECIAL=ROWNUM, + `mother` varchar(12) NOT NULL COMMENT 'The mother of the children', + `child` varchar(12) NOT NULL COMMENT 'The child name' FLAG=2 +) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=chlist `OPTION_LIST`='colname=child'; +SELECT * FROM child2; +--echo # List only first child +SELECT mother, child FROM child2 where num = 1; + DROP TABLE child; DROP TABLE chlist; +DROP TABLE child2; diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 679e8dc703c..bef735b4a6d 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -1,7 +1,7 @@ /************ Odbconn C++ Functions Source Code File (.CPP) ************/ -/* Name: ODBCONN.CPP Version 1.9 */ +/* Name: ODBCONN.CPP Version 2.0 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2013 */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */ /* */ /* This file contains the ODBC connection classes functions. */ /***********************************************************************/ @@ -64,8 +64,6 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #define DEBUG_ONLY(f) ((void)0) #endif // !_DEBUG -extern "C" int trace; - /***********************************************************************/ /* GetSQLType: returns the SQL_TYPE corresponding to a PLG type. */ /***********************************************************************/ @@ -832,7 +830,7 @@ DBX::DBX(RETCODE rc, PSZ msg) /***********************************************************************/ /* This function is called by ThrowDBX. */ /***********************************************************************/ -void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) +bool DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) { if (pdb) { SWORD len; @@ -845,7 +843,9 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) rc = SQLError(pdb->m_henv, pdb->m_hdbc, hstmt, state, &native, msg, SQL_MAX_MESSAGE_LENGTH - 1, &len); - if (rc != SQL_INVALID_HANDLE) { + if (rc == SQL_NO_DATA_FOUND) + return false; + else if (rc != SQL_INVALID_HANDLE) { // Skip non-errors for (int i = 0; i < MAX_NUM_OF_MSG && (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) @@ -861,7 +861,7 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) } // endfor i - return; + return true; } else { snprintf((char*)msg, SQL_MAX_MESSAGE_LENGTH + 1, "%s: %s", m_Msg, MSG(BAD_HANDLE_VAL)); @@ -871,7 +871,7 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) if (trace) htrc("%s: rc=%hd\n", SVP(m_ErrMsg[0]), m_RC); - return; + return true; } // endif rc } else @@ -880,6 +880,7 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt) if (trace) htrc("%s: rc=%hd (%s)\n", SVP(m_Msg), m_RC, SVP(m_ErrMsg[0])); + return true; } // end of BuildErrorMessage const char *DBX::GetErrorMessage(int i) @@ -912,6 +913,7 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp) m_Connect = NULL; m_Updatable = true; m_Transact = false; + m_Scrollable = (tdbp) ? tdbp->Scrollable : false; m_IDQuoteChar[0] = '"'; m_IDQuoteChar[1] = 0; //*m_ErrMsg = '\0'; @@ -934,9 +936,10 @@ bool ODBConn::Check(RETCODE rc) if (trace) { DBX x(rc); - x.BuildErrorMessage(this, m_hstmt); - htrc("ODBC Success With Info, hstmt=%p %s\n", - m_hstmt, x.GetErrorMessage(0)); + if (x.BuildErrorMessage(this, m_hstmt)) + htrc("ODBC Success With Info, hstmt=%p %s\n", + m_hstmt, x.GetErrorMessage(0)); + } // endif trace // Fall through @@ -955,8 +958,10 @@ void ODBConn::ThrowDBX(RETCODE rc, PSZ msg, HSTMT hstmt) { DBX* xp = new(m_G) DBX(rc, msg); - xp->BuildErrorMessage(this, hstmt); - throw xp; + // Don't throw if no error + if (xp->BuildErrorMessage(this, hstmt)) + throw xp; + } // end of ThrowDBX void ODBConn::ThrowDBX(PSZ msg) @@ -1300,25 +1305,28 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) b = false; if (m_hstmt) { -// All this did not seems to make sense and was been commented out -// if (IsOpen()) -// Close(SQL_CLOSE); - + // This is a Requery rc = SQLFreeStmt(m_hstmt, SQL_CLOSE); - if (trace && !Check(rc)) - htrc("Error: SQLFreeStmt rc=%d\n", rc); + if (!Check(rc)) + ThrowDBX(rc, "SQLFreeStmt"); - hstmt = m_hstmt; m_hstmt = NULL; - ThrowDBX(MSG(SEQUENCE_ERROR)); - } else { - rc = SQLAllocStmt(m_hdbc, &hstmt); + } // endif m_hstmt + + rc = SQLAllocStmt(m_hdbc, &hstmt); + + if (!Check(rc)) + ThrowDBX(rc, "SQLAllocStmt"); + + if (m_Scrollable) { + rc = SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_SCROLLABLE, + (void*)SQL_SCROLLABLE, 0); if (!Check(rc)) - ThrowDBX(SQL_INVALID_HANDLE, "SQLAllocStmt"); + ThrowDBX(rc, "SQLSetStmtAttr"); - } // endif hstmt + } // endif m_Scrollable OnSetOptions(hstmt); b = true; @@ -2334,6 +2342,34 @@ int ODBConn::GetCatInfo(CATPARM *cap) return irc; } // end of GetCatInfo +/***********************************************************************/ +/* Restart from beginning of result set */ +/***********************************************************************/ +bool ODBConn::Rewind(char *sql, ODBCCOL *tocols) + { + RETCODE rc; + + if (!m_hstmt) + return false; + + if (m_Scrollable) { + try { + rc = SQLFetchScroll(m_hstmt, SQL_FETCH_ABSOLUTE, 0); + + if (rc != SQL_NO_DATA_FOUND) + ThrowDBX(rc, "SQLFetchScroll", m_hstmt); + + } catch(DBX *x) { + strcpy(m_G->Message, x->GetErrorMessage(0)); + return true; + } // end try/catch + + } else if (ExecDirectSQL(sql, tocols) < 0) + return true; + + return false; + } // end of Rewind + /***********************************************************************/ /* Disconnect connection */ /***********************************************************************/ diff --git a/storage/connect/odbconn.h b/storage/connect/odbconn.h index 90d116cb1ad..1dd2aa2c16e 100644 --- a/storage/connect/odbconn.h +++ b/storage/connect/odbconn.h @@ -95,7 +95,7 @@ class DBX : public BLOCK { const char *GetErrorMessage(int i); protected: - void BuildErrorMessage(ODBConn* pdb, HSTMT hstmt = SQL_NULL_HSTMT); + bool BuildErrorMessage(ODBConn* pdb, HSTMT hstmt = SQL_NULL_HSTMT); // Attributes RETCODE m_RC; @@ -124,6 +124,7 @@ class ODBConn : public BLOCK { forceOdbcDialog = 0x0010}; // Always display ODBC connect dialog int Open(PSZ ConnectString, DWORD Options = 0); + bool Rewind(char *sql, ODBCCOL *tocols); void Close(void); // Attributes @@ -190,4 +191,5 @@ class ODBConn : public BLOCK { PSZ m_Connect; bool m_Updatable; bool m_Transact; + bool m_Scrollable; }; // end of ODBConn class definition diff --git a/storage/connect/os.h b/storage/connect/os.h index 8e94f4241bb..8f77a0ad39f 100644 --- a/storage/connect/os.h +++ b/storage/connect/os.h @@ -53,12 +53,12 @@ typedef int HANDLE; #ifdef PATH_MAX #define _MAX_PATH PATH_MAX #else -#define _MAX_PATH 260 +#define _MAX_PATH FN_REFLEN #endif #define _MAX_DRIVE 3 -#define _MAX_DIR 256 -#define _MAX_FNAME 256 -#define _MAX_EXT 256 +#define _MAX_DIR FN_REFLEN +#define _MAX_FNAME FN_HEADLEN +#define _MAX_EXT FN_EXTLEN #define INVALID_HANDLE_VALUE (-1) #define __stdcall #endif /* !WIN32 */ diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index 7d5931285ce..bbbbc1486b6 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -72,10 +72,11 @@ enum TABTYPE {TAB_UNDEF = 0, /* Table of undefined type */ TAB_OCCUR = 18, /* OCCUR table */ TAB_PRX = 19, /* Proxy (catalog) table */ TAB_PLG = 20, /* PLG NIY */ - TAB_PIVOT = 21, /* PIVOT NIY */ - TAB_JCT = 22, /* Junction tables NIY */ - TAB_DMY = 23, /* DMY Dummy tables NIY */ - TAB_NIY = 24}; /* Table not implemented yet */ + TAB_PIVOT = 21, /* PIVOT table */ + TAB_VIR = 22, /* Virtual tables */ + TAB_JCT = 23, /* Junction tables NIY */ + TAB_DMY = 24, /* DMY Dummy tables NIY */ + TAB_NIY = 25}; /* Table not implemented yet */ enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */ TYPE_AM_ROWID = 1, /* ROWID type (special column) */ @@ -127,6 +128,7 @@ enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */ TYPE_AM_TFC = 155, /* TFC (Circa) (Fuzzy compare) */ TYPE_AM_DBF = 160, /* DBF Dbase files am type no */ TYPE_AM_JCT = 170, /* Junction tables am type no */ + TYPE_AM_VIR = 171, /* Virtual tables am type no */ TYPE_AM_DMY = 172, /* DMY Dummy tables am type no */ TYPE_AM_SET = 180, /* SET Set tables am type no */ TYPE_AM_MYSQL = 192, /* MYSQL access method type no */ @@ -582,7 +584,7 @@ DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size); DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&); DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t); DllExport void NewPointer(PTABS, void *, void *); -DllExport char *GetIni(int n= 0); +//lExport char *GetIni(int n= 0); // Not used anymore DllExport void SetTrc(void); DllExport char *GetListOption(PGLOBAL, const char *, const char *, const char *def=NULL); diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index c5b66e8f5e6..d8009bcc71f 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -87,10 +87,6 @@ bool Initdone = false; bool plugin = false; // True when called by the XDB plugin handler extern "C" { -#if defined(XMSG) - char msglang[16] = "ENGLISH"; // Default language -#endif -extern int trace; extern char version[]; } // extern "C" @@ -117,11 +113,17 @@ void CloseXMLFile(PGLOBAL, PFBLOCK, bool); /***********************************************************************/ /* Routines for file IO with error reporting to g->Message */ +/* Note: errno and strerror must be called before the message file */ +/* is read in the case of XMSG compile. */ /***********************************************************************/ -static void -global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode) +static void global_open_error_msg(GLOBAL *g, int msgid, const char *path, + const char *mode) { - int len; + int len, rno= (int)errno; + char errmsg[256]= ""; + + strncat(errmsg, strerror(errno), 255); + switch (msgid) { case MSGID_CANNOT_OPEN: @@ -133,19 +135,21 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode) case MSGID_OPEN_MODE_ERROR: len= snprintf(g->Message, sizeof(g->Message) - 1, MSG(OPEN_MODE_ERROR), // "Open(%s) error %d on %s" - mode, (int) errno, path); + mode, rno, path); break; case MSGID_OPEN_MODE_STRERROR: + {char fmt[256]; + strcat(strcpy(fmt, MSG(OPEN_MODE_ERROR)), ": %s"); len= snprintf(g->Message, sizeof(g->Message) - 1, - MSG(OPEN_MODE_ERROR) ": %s", // Open(%s) error %d on %s: %s - mode, (int) errno, path, strerror(errno)); - break; + fmt, // Open(%s) error %d on %s: %s + mode, rno, path, errmsg); + }break; case MSGID_OPEN_STRERROR: len= snprintf(g->Message, sizeof(g->Message) - 1, MSG(OPEN_STRERROR), // "open error: %s" - strerror(errno)); + errmsg); break; case MSGID_OPEN_ERROR_AND_STRERROR: @@ -153,13 +157,13 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode) //OPEN_ERROR does not work, as it wants mode %d (not %s) //MSG(OPEN_ERROR) "%s",// "Open error %d in mode %d on %s: %s" "Open error %d in mode %s on %s: %s", - errno, mode, path, strerror(errno)); + rno, mode, path, errmsg); break; case MSGID_OPEN_EMPTY_FILE: len= snprintf(g->Message, sizeof(g->Message) - 1, MSG(OPEN_EMPTY_FILE), // "Opening empty file %s: %s" - path, strerror(errno)); + path, errmsg); break; default: @@ -287,12 +291,9 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids, // Get header from message file strncpy(cname, PlugReadMessage(g, ids + crp->Ncol, NULL), NAM_LEN); cname[NAM_LEN] = 0; // for truncated long names -//#elif defined(WIN32) - // Get header from ressource file -// LoadString(s_hModule, ids + crp->Ncol, cname, sizeof(cname)); -#else // !WIN32 +#else // !XMSG GetRcString(ids + crp->Ncol, cname, sizeof(cname)); -#endif // !WIN32 +#endif // !XMSG crp->Name = (PSZ)PlugSubAlloc(g, NULL, strlen(cname) + 1); strcpy(crp->Name, cname); } else @@ -730,6 +731,7 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6]) char *fmt, c, d, e, W[8][12]; int i, k, m, numval; int n, y = 30; + bool b = true; // true for null dates if (pdp) fmt = pdp->InFmt; @@ -763,7 +765,8 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6]) m = pdp->Num; for (i = 0; i < m; i++) { - n = *(int*)W[i]; + if ((n = *(int*)W[i])) + b = false; switch (k = pdp->Index[i]) { case 0: @@ -822,7 +825,7 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6]) htrc("numval=%d val=(%d,%d,%d,%d,%d,%d)\n", numval, val[0], val[1], val[2], val[3], val[4], val[5]); - return numval; + return (b) ? 0 : numval; } // end of ExtractDate /***********************************************************************/ @@ -982,7 +985,7 @@ void PlugCleanup(PGLOBAL g, bool dofree) /* This is the place to reset the pointer on domains. */ /*******************************************************************/ dbuserp->Subcor = false; - dbuserp->Step = STEP(PARSING_QUERY); + dbuserp->Step = "New query"; // was STEP(PARSING_QUERY); dbuserp->ProgMax = dbuserp->ProgCur = dbuserp->ProgSav = 0; } // endif dofree diff --git a/storage/connect/plugutil.c b/storage/connect/plugutil.c index c3b77544983..c77975e5e30 100644 --- a/storage/connect/plugutil.c +++ b/storage/connect/plugutil.c @@ -2,7 +2,7 @@ /* */ /* PROGRAM NAME: PLUGUTIL */ /* ------------- */ -/* Version 2.8 */ +/* Version 2.9 */ /* */ /* COPYRIGHT: */ /* ---------- */ @@ -76,15 +76,17 @@ #include "osutil.h" #include "global.h" +#if defined(NEWMSG) +#include "rcmsg.h" +#endif // NEWMSG #if defined(WIN32) extern HINSTANCE s_hModule; /* Saved module handle */ #endif // WIN32 -extern int trace; - #if defined(XMSG) -extern char msglang[]; +extern char *msg_path; +char *msglang(void); #endif // XMSG /***********************************************************************/ @@ -157,7 +159,9 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) char errmsg[256]; sprintf(errmsg, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); - } /* endif Sarea */ + g->Sarea_Size = 0; + } else + g->Sarea_Size = worksize; } /* endif g */ @@ -232,7 +236,7 @@ BOOL PlugIsAbsolutePath(LPCSTR path) LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) { char newname[_MAX_PATH]; - char direc[_MAX_DIR], defdir[_MAX_DIR]; + char direc[_MAX_DIR], defdir[_MAX_DIR], tmpdir[_MAX_DIR]; char fname[_MAX_FNAME]; char ftype[_MAX_EXT]; #if !defined(UNIX) && !defined(UNIV_LINUX) @@ -265,7 +269,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) } // endif FileName #endif // !WIN32 - if (strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath)) + if (prefix && strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath)) { char tmp[_MAX_PATH]; int len= snprintf(tmp, sizeof(tmp) - 1, "%s%s%s", @@ -276,7 +280,19 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) } _splitpath(FileName, drive, direc, fname, ftype); - _splitpath(defpath, defdrv, defdir, NULL, NULL); + + if (defpath) { + char c = defpath[strlen(defpath) - 1]; + + strcpy(tmpdir, defpath); + + if (c != '/' && c != '\\') + strcat(tmpdir, "/"); + + } else + strcpy(tmpdir, "./"); + + _splitpath(tmpdir, defdrv, defdir, NULL, NULL); if (trace > 1) { htrc("after _splitpath: FileName=%s\n", FileName); @@ -328,11 +344,14 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) char *msg; FILE *mfile = NULL; - GetPrivateProfileString("Message", msglang, "Message\\english.msg", - msgfile, _MAX_PATH, plgini); +//GetPrivateProfileString("Message", msglang, "Message\\english.msg", +// msgfile, _MAX_PATH, plgini); +//strcat(strcat(strcpy(msgfile, msg_path), msglang()), ".msg"); + strcat(strcpy(buff, msglang()), ".msg"); + PlugSetPath(msgfile, NULL, buff, msg_path); if (!(mfile = fopen(msgfile, "rt"))) { - sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang); + sprintf(stmsg, "Fail to open message file %s", msgfile); goto err; } // endif mfile @@ -382,7 +401,7 @@ char *PlugGetMessage(PGLOBAL g, int mid) { char *msg; -#if !defined(UNIX) && !defined(UNIV_LINUX) +#if 0 // was !defined(UNIX) && !defined(UNIV_LINUX) int n = LoadString(s_hModule, (uint)mid, (LPTSTR)stmsg, 200); if (n == 0) { @@ -395,10 +414,10 @@ char *PlugGetMessage(PGLOBAL g, int mid) return msg; } // endif n -#else // UNIX +#else // ALL if (!GetRcString(mid, stmsg, 200)) sprintf(stmsg, "Message %d not found", mid); -#endif // UNIX +#endif // ALL if (g) { // Called by STEP diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c index bac420e696f..abd74d169cc 100644 --- a/storage/connect/rcmsg.c +++ b/storage/connect/rcmsg.c @@ -1,225 +1,65 @@ -/**************** RCMsg C Program Source Code File (.C) ****************/ -/* PROGRAM NAME: RCMSG */ -/* ------------- */ -/* Version 1.1 */ -/* */ -/* COPYRIGHT */ -/* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND: 2005 - 2013 */ -/* */ -/* WHAT THIS PROGRAM DOES */ -/* ----------------------- */ -/* This program simulates LoadString for Unix and Linux. */ -/* */ -/***********************************************************************/ -#include -#include "resource.h" -#include "rcmsg.h" - -char *GetMsgid(int id) - { - char *p = NULL; - - switch (id) { - case IDS_00: p = "%s"; break; -#if defined(FRENCH) - case IDS_01: p = "%s: erreur d'allocation du buffer de communication de %d octets"; break; - case IDS_02: p = "%s: erreur d'allocation mémoire tampon pour %d colonnes"; break; - case IDS_03: p = "%s: Commande spéciale invalide"; break; - case IDS_04: p = "%s: Wrong number of arguments %d"; break; - case IDS_05: p = "%s"; break; - case IDS_06: p = "%s: Commande dépassant la taille du buffer interne (%d octets)"; break; - case IDS_07: p = "%s: Données (%d octets) tronquées à la taille du buffer"; break; - case IDS_08: p = "%s: Résultat dépassant la taille du buffer interne (%d octets)"; break; - case IDS_09: p = "Erreur dans %s: %s"; break; - case IDS_10: p = "%s: erreur d'allocating mémoire de %d octets"; break; - case IDS_11: p = "%s: mauvaise clé de connexion %d"; break; - case IDS_12: p = "%s: Pas plus de %d connexions autorisées pour un programme"; break; - case IDS_13: p = "%s: clé de connexion invalide %d"; break; - case IDS_14: p = "SafeDB: %s rc=%d"; break; - case IDS_15: p = "Mauvaise Dll de communication appelée par le moteur %s"; break; - case IDS_TAB_01: p = "Catalogue"; break; - case IDS_TAB_02: p = "Schéma"; break; - case IDS_TAB_03: p = "Nom"; break; - case IDS_TAB_04: p = "Type"; break; - case IDS_TAB_05: p = "Remarque"; break; - case IDS_COL_01: p = "Cat_Table"; break; - case IDS_COL_02: p = "Schem_Table"; break; - case IDS_COL_03: p = "Nom_Table"; break; - case IDS_COL_04: p = "Nom_Colonne"; break; - case IDS_COL_05: p = "Type_Données"; break; - case IDS_COL_06: p = "Nom_Type"; break; - case IDS_COL_07: p = "Précision"; break; - case IDS_COL_08: p = "Longueur"; break; - case IDS_COL_09: p = "Echelle"; break; - case IDS_COL_10: p = "Base"; break; - case IDS_COL_11: p = "Nullifiable"; break; - case IDS_COL_12: p = "Remarques"; break; - case IDS_INF_01: p = "Nom_Type"; break; - case IDS_INF_02: p = "Type_Données"; break; - case IDS_INF_03: p = "Précision"; break; - case IDS_INF_04: p = "Préfixe_Litéral"; break; - case IDS_INF_05: p = "Suffixe_Litéral"; break; - case IDS_INF_06: p = "Création_Params"; break; - case IDS_INF_07: p = "Nullifiable"; break; - case IDS_INF_08: p = "Maj_Minuscule"; break; - case IDS_INF_09: p = "Localisable"; break; - case IDS_INF_10: p = "Valeur_Absolue"; break; - case IDS_INF_11: p = "Monnaie"; break; - case IDS_INF_12: p = "Auto_Incrément"; break; - case IDS_INF_13: p = "Nom_Type_Local"; break; - case IDS_INF_14: p = "Echelle_Minimum"; break; - case IDS_INF_15: p = "Echelle_Maximum"; break; - case IDS_PKY_01: p = "Cat_Table"; break; - case IDS_PKY_02: p = "Schem_Table"; break; - case IDS_PKY_03: p = "Nom_Table"; break; - case IDS_PKY_04: p = "Nom_Colonne"; break; - case IDS_PKY_05: p = "Numéro_Clé"; break; - case IDS_PKY_06: p = "Nom_Clé"; break; - case IDS_FKY_01: p = "PKTable_Catalog"; break; - case IDS_FKY_02: p = "PKTable_Schema"; break; - case IDS_FKY_03: p = "PKTable_Name"; break; - case IDS_FKY_04: p = "PKColumn_Name"; break; - case IDS_FKY_05: p = "FKTable_Catalog"; break; - case IDS_FKY_06: p = "FKTable_Schema"; break; - case IDS_FKY_07: p = "FKTable_Name"; break; - case IDS_FKY_08: p = "FKColumn_Name"; break; - case IDS_FKY_09: p = "Key_Seq"; break; - case IDS_FKY_10: p = "Update_Rule"; break; - case IDS_FKY_11: p = "Delete_Rule"; break; - case IDS_FKY_12: p = "FK_Name"; break; - case IDS_FKY_13: p = "PK_Name"; break; - case IDS_STA_01: p = "Table_Catalog"; break; - case IDS_STA_02: p = "Table_Schema"; break; - case IDS_STA_03: p = "Table_Name"; break; - case IDS_STA_04: p = "Non_Unique"; break; - case IDS_STA_05: p = "Index_Qualifier"; break; - case IDS_STA_06: p = "Index_Name"; break; - case IDS_STA_07: p = "Type"; break; - case IDS_STA_08: p = "Seq_in_Index"; break; - case IDS_STA_09: p = "Column_Name"; break; - case IDS_STA_10: p = "Collation"; break; - case IDS_STA_11: p = "Cardinality"; break; - case IDS_STA_12: p = "Pages"; break; - case IDS_STA_13: p = "Filter_Condition"; break; - case IDS_SPC_01: p = "Champ"; break; - case IDS_SPC_02: p = "Nom_Colonne"; break; - case IDS_SPC_03: p = "Type_Données"; break; - case IDS_SPC_04: p = "Nom_Type"; break; - case IDS_SPC_05: p = "Précision"; break; - case IDS_SPC_06: p = "Longueur"; break; - case IDS_SPC_07: p = "Echelle"; break; - case IDS_SPC_08: p = "Pseudo_Colonne"; break; - case IDS_DRV_01: p = "Description"; break; - case IDS_DRV_02: p = "Attributs"; break; - case IDS_DSC_01: p = "Nom"; break; - case IDS_DSC_02: p = "Description"; break; -#else // English - case IDS_01: p = "%s: error allocating communication buffer of %d bytes"; break; - case IDS_02: p = "%s: error allocating parser memory for %d columns"; break; - case IDS_03: p = "%s: Invalid special command"; break; - case IDS_04: p = "%s: Wrong number of arguments %d"; break; - case IDS_05: p = "%s"; break; - case IDS_06: p = "%s: Command bigger than internal buffer of size = %d"; break; - case IDS_07: p = "%s: Data truncated to buffer size, actual length is %d bytes"; break; - case IDS_08: p = "%s: Result bigger than internal buffer of size = %d"; break; - case IDS_09: p = "Error in %s: %s"; break; - case IDS_10: p = "%s: error allocating instance memory of %d bytes"; break; - case IDS_11: p = "%s: wrong connection key value %d"; break; - case IDS_12: p = "%s: No more than %d connections allowed from one process"; break; - case IDS_13: p = "%s: invalid connection key value %d"; break; - case IDS_14: p = "SafeDB: %s rc=%d"; break; - case IDS_15: p = "Wrong communication Dll called for engine %s"; break; - case IDS_TAB_01: p = "Table_Cat"; break; - case IDS_TAB_02: p = "Table_Schema"; break; - case IDS_TAB_03: p = "Table_Name"; break; - case IDS_TAB_04: p = "Table_Type"; break; - case IDS_TAB_05: p = "Remark"; break; - case IDS_COL_01: p = "Table_Cat"; break; - case IDS_COL_02: p = "Table_Schema"; break; - case IDS_COL_03: p = "Table_Name"; break; - case IDS_COL_04: p = "Column_Name"; break; - case IDS_COL_05: p = "Data_Type"; break; - case IDS_COL_06: p = "Type_Name"; break; - case IDS_COL_07: p = "Column_Size"; break; - case IDS_COL_08: p = "Buffer_Length"; break; - case IDS_COL_09: p = "Decimal_Digits"; break; - case IDS_COL_10: p = "Radix"; break; - case IDS_COL_11: p = "Nullable"; break; - case IDS_COL_12: p = "Remarks"; break; - case IDS_INF_01: p = "Type_Name"; break; - case IDS_INF_02: p = "Data_Type"; break; - case IDS_INF_03: p = "Precision"; break; - case IDS_INF_04: p = "Literal_Prefix"; break; - case IDS_INF_05: p = "Literal_Suffix"; break; - case IDS_INF_06: p = "Create_Params"; break; - case IDS_INF_07: p = "Nullable"; break; - case IDS_INF_08: p = "Case_Sensitive"; break; - case IDS_INF_09: p = "Searchable"; break; - case IDS_INF_10: p = "Unsigned_Attribute"; break; - case IDS_INF_11: p = "Money"; break; - case IDS_INF_12: p = "Auto_Increment"; break; - case IDS_INF_13: p = "Local_Type_Name"; break; - case IDS_INF_14: p = "Minimum_Scale"; break; - case IDS_INF_15: p = "Maximum_Scale"; break; - case IDS_PKY_01: p = "Table_Catalog"; break; - case IDS_PKY_02: p = "Table_Schema"; break; - case IDS_PKY_03: p = "Table_Name"; break; - case IDS_PKY_04: p = "Column_Name"; break; - case IDS_PKY_05: p = "Key_Seq"; break; - case IDS_PKY_06: p = "Pk_Name"; break; - case IDS_FKY_01: p = "PKTable_Catalog"; break; - case IDS_FKY_02: p = "PKTable_Schema"; break; - case IDS_FKY_03: p = "PKTable_Name"; break; - case IDS_FKY_04: p = "PKColumn_Name"; break; - case IDS_FKY_05: p = "FKTable_Catalog"; break; - case IDS_FKY_06: p = "FKTable_Schema"; break; - case IDS_FKY_07: p = "FKTable_Name"; break; - case IDS_FKY_08: p = "FKColumn_Name"; break; - case IDS_FKY_09: p = "Key_Seq"; break; - case IDS_FKY_10: p = "Update_Rule"; break; - case IDS_FKY_11: p = "Delete_Rule"; break; - case IDS_FKY_12: p = "FK_Name"; break; - case IDS_FKY_13: p = "PK_Name"; break; - case IDS_STA_01: p = "Table_Catalog"; break; - case IDS_STA_02: p = "Table_Schema"; break; - case IDS_STA_03: p = "Table_Name"; break; - case IDS_STA_04: p = "Non_Unique"; break; - case IDS_STA_05: p = "Index_Qualifier"; break; - case IDS_STA_06: p = "Index_Name"; break; - case IDS_STA_07: p = "Type"; break; - case IDS_STA_08: p = "Seq_in_Index"; break; - case IDS_STA_09: p = "Column_Name"; break; - case IDS_STA_10: p = "Collation"; break; - case IDS_STA_11: p = "Cardinality"; break; - case IDS_STA_12: p = "Pages"; break; - case IDS_STA_13: p = "Filter_Condition"; break; - case IDS_SPC_01: p = "Scope"; break; - case IDS_SPC_02: p = "Column_Name"; break; - case IDS_SPC_03: p = "Data_Type"; break; - case IDS_SPC_04: p = "Type_Name"; break; - case IDS_SPC_05: p = "Precision"; break; - case IDS_SPC_06: p = "Length"; break; - case IDS_SPC_07: p = "Scale"; break; - case IDS_SPC_08: p = "Pseudo_Column"; break; - case IDS_DRV_01: p = "Description"; break; - case IDS_DRV_02: p = "Attributes"; break; - case IDS_DSC_01: p = "Name"; break; - case IDS_DSC_02: p = "Description"; break; -#endif // English - } // endswitch(id) - - return p; - } // end of GetMsgid - -int GetRcString(int id, char *buf, int bufsize) - { - char *p = NULL, msg[32]; - - if (!(p = GetMsgid(id))) { - sprintf(msg, "ID=%d unknown", id); - p = msg; - } // endif p - - return sprintf(buf, "%.*s", bufsize-1, p); - } // end of GetRcString +/**************** RCMsg C Program Source Code File (.C) ****************/ +/* PROGRAM NAME: RCMSG */ +/* ------------- */ +/* Version 1.3 */ +/* */ +/* COPYRIGHT */ +/* ---------- */ +/* (C) Copyright to the author Olivier BERTRAND: 2005 - 2014 */ +/* */ +/* WHAT THIS PROGRAM DOES */ +/* ----------------------- */ +/* This program simulates LoadString. */ +/* */ +/***********************************************************************/ +#if !defined(XMSG) +#include +#include +#include "resource.h" +#include "rcmsg.h" +#if defined(NEWMSG) +#include "msgid.h" +#endif // NEWMSG + +#if !defined(WIN32) +#define stricmp strcasecmp +#endif // !WIN32 + +char *msglang(void); + +char *GetMsgid(int id) + { + char *p = NULL; + + if (!stricmp(msglang(), "french")) + switch (id) { +#include "frids.h" +#if defined(NEWMSG) +#include "frcas.h" +#endif // NEWMSG + } // endswitch(id) + + else // English + switch (id) { +#include "enids.h" +#if defined(NEWMSG) +#include "encas.h" +#endif // NEWMSG + } // endswitch(id) + + return p; + } // end of GetMsgid + +int GetRcString(int id, char *buf, int bufsize) + { + char *p = NULL, msg[32]; + + if (!(p = GetMsgid(id))) { + sprintf(msg, "ID=%d unknown", id); + p = msg; + } // endif p + + return sprintf(buf, "%.*s", bufsize-1, p); + } // end of GetRcString + +#endif // !XMSG diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 22076b78086..e469ae40f1f 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -49,8 +49,14 @@ #include "tabmul.h" #include "ha_connect.h" -extern "C" int trace; -extern "C" USETEMP Use_Temp; +#if !defined(WIN32) +extern handlerton *connect_hton; +#endif // !WIN32 + +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +USETEMP UseTemp(void); /* --------------------------- Class RELDEF -------------------------- */ @@ -455,6 +461,22 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) } // endif getdef #else // !WIN32 const char *error = NULL; + Dl_info dl_info; + + // The OEM lib must retrieve exported CONNECT variables + if (dladdr(&connect_hton, &dl_info)) { + if (dlopen(dl_info.dli_fname, RTLD_NOLOAD | RTLD_NOW | RTLD_GLOBAL) == 0) { + error = dlerror(); + sprintf(g->Message, "dlopen failed: %s, OEM not supported", SVP(error)); + return NULL; + } // endif dlopen + + } else { + error = dlerror(); + sprintf(g->Message, "dladdr failed: %s, OEM not supported", SVP(error)); + return NULL; + } // endif dladdr + // Is the library already loaded? // if (!Hdll && !(Hdll = ???)) // Load the desired shared library @@ -571,7 +593,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) PTXF txfp = NULL; PDOSDEF defp = (PDOSDEF)Pxdef; bool map = defp->Mapped && mode != MODE_INSERT && - !(Use_Temp == TMP_FORCE && + !(UseTemp() == TMP_FORCE && (mode == MODE_UPDATE || mode == MODE_DELETE)); int cmpr = defp->Compressed; diff --git a/storage/connect/resource.h b/storage/connect/resource.h index 773942cf280..1c3e1ee3727 100644 --- a/storage/connect/resource.h +++ b/storage/connect/resource.h @@ -1,139 +1,46 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by PlgSock.rc -// -#define IDS_00 115 -#define IDS_01 116 -#define IDS_02 117 -#define IDS_03 118 -#define IDS_04 119 -#define IDS_05 120 -#define IDS_06 121 -#define IDS_07 122 -#define IDS_08 123 -#define IDS_09 124 -#define IDS_10 125 -#define IDS_11 126 -#define IDS_12 127 -#define IDS_13 128 -#define IDS_14 129 -#define IDS_15 130 -#define IDS_16 131 -#define IDS_17 132 -#define IDS_18 133 -#define IDS_19 134 -#define IDS_20 135 -#define IDS_21 136 -#define IDS_TABLES 143 -#define IDS_TAB_01 144 -#define IDS_TAB_02 145 -#define IDS_TAB_03 146 -#define IDS_TAB_04 147 -#define IDS_TAB_05 148 -#define IDS_COLUMNS 159 -#define IDS_COL_01 160 -#define IDS_COL_02 161 -#define IDS_COL_03 162 -#define IDS_COL_04 163 -#define IDS_COL_05 164 -#define IDS_COL_06 165 -#define IDS_COL_07 166 -#define IDS_COL_08 167 -#define IDS_COL_09 168 -#define IDS_COL_10 169 -#define IDS_COL_11 170 -#define IDS_COL_12 171 -#define IDS_INFO 175 -#define IDS_INF_01 176 -#define IDS_INF_02 177 -#define IDS_INF_03 178 -#define IDS_INF_04 179 -#define IDS_INF_05 180 -#define IDS_INF_06 181 -#define IDS_INF_07 182 -#define IDS_INF_08 183 -#define IDS_INF_09 184 -#define IDS_INF_10 185 -#define IDS_INF_11 186 -#define IDS_INF_12 187 -#define IDS_INF_13 188 -#define IDS_INF_14 189 -#define IDS_INF_15 190 -#define IDS_PKEY 191 -#define IDS_PKY_01 192 -#define IDS_PKY_02 193 -#define IDS_PKY_03 194 -#define IDS_PKY_04 195 -#define IDS_PKY_05 196 -#define IDS_PKY_06 197 -#define IDS_FKEY 207 -#define IDS_FKY_01 208 -#define IDS_FKY_02 209 -#define IDS_FKY_03 210 -#define IDS_FKY_04 211 -#define IDS_FKY_05 212 -#define IDS_FKY_06 213 -#define IDS_FKY_07 214 -#define IDS_FKY_08 215 -#define IDS_FKY_09 216 -#define IDS_FKY_10 217 -#define IDS_FKY_11 218 -#define IDS_FKY_12 219 -#define IDS_FKY_13 220 -#define IDS_STAT 223 -#define IDS_STA_01 224 -#define IDS_STA_02 225 -#define IDS_STA_03 226 -#define IDS_STA_04 227 -#define IDS_STA_05 228 -#define IDS_STA_06 229 -#define IDS_STA_07 230 -#define IDS_STA_08 231 -#define IDS_STA_09 232 -#define IDS_STA_10 233 -#define IDS_STA_11 234 -#define IDS_STA_12 235 -#define IDS_STA_13 236 -#define IDS_SPCOLS 1247 -#define IDS_SPC_01 1248 -#define IDS_SPC_02 1249 -#define IDS_SPC_03 1250 -#define IDS_SPC_04 1251 -#define IDS_SPC_05 1252 -#define IDS_SPC_06 1253 -#define IDS_SPC_07 1254 -#define IDS_SPC_08 1255 -#define IDS_CNX 1263 -#define IDS_CNX_01 1264 -#define IDS_CNX_02 1265 -#define IDS_CNX_03 1266 -#define IDS_CNX_04 1267 -#define IDS_PLGCOL 1279 -#define IDS_PLG_01 1280 -#define IDS_PLG_02 1281 -#define IDS_PLG_03 1282 -#define IDS_PLG_04 1283 -#define IDS_PLG_05 1284 -#define IDS_PLG_06 1285 -#define IDS_PLG_07 1286 -#define IDS_PLG_08 1287 -#define IDS_PLG_09 1288 -#define IDS_DRIVER 1290 -#define IDS_DRV_01 1291 -#define IDS_DRV_02 1292 -#define IDS_DSRC 1295 -#define IDS_DSC_01 1296 -#define IDS_DSC_02 1297 -//#define IDS_DSC_03 1298 -//#define IDS_DSC_04 1299 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 1300 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1440 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +#define IDS_TABLES 100 +#define IDS_TAB_01 101 +#define IDS_TAB_02 102 +#define IDS_TAB_03 103 +#define IDS_TAB_04 104 +#define IDS_TAB_05 105 +#define IDS_COLUMNS 106 +#define IDS_COL_01 107 +#define IDS_COL_02 108 +#define IDS_COL_03 109 +#define IDS_COL_04 110 +#define IDS_COL_05 111 +#define IDS_COL_06 112 +#define IDS_COL_07 113 +#define IDS_COL_08 114 +#define IDS_COL_09 115 +#define IDS_COL_10 116 +#define IDS_COL_11 117 +#define IDS_COL_12 118 +#define IDS_PKEY 119 +#define IDS_PKY_01 120 +#define IDS_PKY_02 121 +#define IDS_PKY_03 122 +#define IDS_PKY_04 123 +#define IDS_PKY_05 124 +#define IDS_PKY_06 125 +#define IDS_STAT 126 +#define IDS_STA_01 127 +#define IDS_STA_02 128 +#define IDS_STA_03 129 +#define IDS_STA_04 130 +#define IDS_STA_05 131 +#define IDS_STA_06 132 +#define IDS_STA_07 133 +#define IDS_STA_08 134 +#define IDS_STA_09 135 +#define IDS_STA_10 136 +#define IDS_STA_11 137 +#define IDS_STA_12 138 +#define IDS_STA_13 139 +#define IDS_DRIVER 140 +#define IDS_DRV_01 141 +#define IDS_DRV_02 142 +#define IDS_DSRC 143 +#define IDS_DSC_01 144 +#define IDS_DSC_02 145 diff --git a/storage/connect/tabcol.cpp b/storage/connect/tabcol.cpp index 96ec4f45861..8f350c6f074 100644 --- a/storage/connect/tabcol.cpp +++ b/storage/connect/tabcol.cpp @@ -22,8 +22,6 @@ #include "xtable.h" #include "tabcol.h" -extern "C" int trace; - /***********************************************************************/ /* XTAB public constructor. */ /***********************************************************************/ diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index c60c9b034f9..0ef9625ac9b 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -65,15 +65,17 @@ /***********************************************************************/ int num_read, num_there, num_eq[2]; // Statistics -extern "C" int trace; -extern "C" USETEMP Use_Temp; -extern bool xinfo; - /***********************************************************************/ /* Size of optimize file header. */ /***********************************************************************/ #define NZ 4 +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +bool ExactInfo(void); +USETEMP UseTemp(void); + /***********************************************************************/ /* Min and Max blocks contains zero ended fields (blank = false). */ /* No conversion of block values (check = true). */ @@ -146,7 +148,7 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Eof = (GetIntCatInfo("EOF", 0) != 0); } else if (Recfm == RECFM_DBF) { Maxerr = GetIntCatInfo("Maxerr", 0); - Accept = (GetIntCatInfo("Accept", 0) != 0); + Accept = GetBoolCatInfo("Accept", false); ReadMode = GetIntCatInfo("Readmode", 0); } else // (Recfm == RECFM_VAR) AvgLen = GetIntCatInfo("Avglen", 0); @@ -316,13 +318,13 @@ bool DOSDEF::InvalidateIndex(PGLOBAL g) PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) { // Mapping not used for insert - USETEMP tmp = Use_Temp; + USETEMP tmp = UseTemp(); bool map = Mapped && mode != MODE_INSERT && !(tmp != TMP_NO && Recfm == RECFM_VAR && mode == MODE_UPDATE) && !(tmp == TMP_FORCE && (mode == MODE_UPDATE || mode == MODE_DELETE)); - PTXF txfp; + PTXF txfp = NULL; PTDBASE tdbp; /*********************************************************************/ @@ -575,7 +577,6 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) { int i, lg, nrec, rc, n = 0; int curnum, curblk, block, savndv, savnbm; - int last __attribute__((unused)); void *savmin, *savmax; bool blocked, xdb2 = false; //POOLHEADER save; @@ -612,7 +613,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) // to Rows+1 by unblocked variable length table access methods. curblk = -1; curnum = nrec - 1; - last = 0; +//last = 0; Txfp->Block = block; // This is useful mainly for Txfp->CurBlk = curblk; // blocked tables (ZLBFAM), for Txfp->CurNum = curnum; // others it is just to be clean. @@ -743,7 +744,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) Txfp->BlkPos[curblk] = Txfp->GetPos(); } // endif CurNum - last = curnum + 1; // curnum is zero based +// last = curnum + 1; // curnum is zero based Txfp->CurBlk = curblk; // Used in COLDOS::SetMinMax Txfp->CurNum = curnum; // Used in COLDOS::SetMinMax } // endif blocked @@ -1353,7 +1354,6 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) //bool conv = false, xdb2 = false, ok = false, b[2]; //PXOB *xarg1, *xarg2 = NULL, xp[2]; int i, n = 0, type[2] = {0,0}; - int ctype __attribute__((unused)); bool conv = false, xdb2 = false, ok = false; PXOB *xarg2 = NULL, xp[2]; PCOL colp; @@ -1361,12 +1361,11 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) //SFROW *sfr[2]; PBF *fp = NULL, bfp = NULL; - ctype= TYPE_ERROR; for (i = 0; i < 2; i++) { switch (arg[i]->GetType()) { case TYPE_CONST: type[i] = 1; - ctype = arg[i]->GetResultType(); + // ctype = arg[i]->GetResultType(); break; case TYPE_COLBLK: conv = cnv[i]; @@ -1391,7 +1390,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) // correlated subquery, it has a constant value during // each execution of the subquery. type[i] = 1; - ctype = arg[i]->GetResultType(); +// ctype = arg[i]->GetResultType(); } // endif this break; @@ -1779,8 +1778,13 @@ bool TDBDOS::InitialyzeIndex(PGLOBAL g, PIXDEF xdp, bool sorted) To_Link = (PXOB*)PlugSubAlloc(g, NULL, Knum * sizeof(PXOB)); for (k = 0, kdp = xdp->GetToKeyParts(); kdp; k++, kdp = kdp->GetNext()) { - cdp = Key(k)->GetCdp(); - valp = AllocateValue(g, cdp->GetType(), cdp->GetLength()); + if ((cdp = Key(k)->GetCdp())) + valp = AllocateValue(g, cdp->GetType(), cdp->GetLength()); + else { // Special column ? + colp = Key(k); + valp = AllocateValue(g, colp->GetResultType(), colp->GetLength()); + } // endif cdp + To_Link[k]= new(g) CONSTANT(valp); } // endfor k @@ -1908,7 +1912,7 @@ int TDBDOS::Cardinality(PGLOBAL g) } // endif Mode - if (Mode == MODE_ANY && xinfo) { + if (Mode == MODE_ANY && ExactInfo()) { // Using index impossible or failed, do it the hard way Mode = MODE_READ; To_Line = (char*)PlugSubAlloc(g, NULL, Lrecl + 1); @@ -2021,8 +2025,10 @@ int TDBDOS::EstimatedLength(PGLOBAL g) /***********************************************************************/ bool TDBDOS::IsUsingTemp(PGLOBAL g) { - return (Use_Temp == TMP_YES || Use_Temp == TMP_FORCE || - (Use_Temp == TMP_AUTO && Mode == MODE_UPDATE)); + USETEMP utp = UseTemp(); + + return (utp == TMP_YES || utp == TMP_FORCE || + (utp == TMP_AUTO && Mode == MODE_UPDATE)); } // end of IsUsingTemp /***********************************************************************/ @@ -2062,7 +2068,7 @@ bool TDBDOS::OpenDB(PGLOBAL g) Txfp = new(g) DOSFAM((PDOSDEF)To_Def); Txfp->SetTdbp(this); } else if (Txfp->Blocked && (Mode == MODE_DELETE || - (Mode == MODE_UPDATE && Use_Temp != TMP_NO))) { + (Mode == MODE_UPDATE && UseTemp() != TMP_NO))) { /*******************************************************************/ /* Delete is not currently handled in block mode neither Update */ /* when using a temporary file. */ diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 1c772e8bf23..156d46b9791 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -77,7 +77,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ bool Mapped; /* 0: disk file, 1: memory mapped file */ bool Padded; /* true for padded table file */ bool Huge; /* true for files larger than 2GB */ - bool Accept; /* true if wrong lines are accepted (DBF)*/ + bool Accept; /* true if wrong lines are accepted */ bool Eof; /* true if an EOF (0xA) character exists */ int *To_Pos; /* To array of block starting positions */ int Optimized; /* 0: No, 1:Yes, 2:Redo optimization */ diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp index 91f06536272..77e47e6f8dd 100644 --- a/storage/connect/tabfix.cpp +++ b/storage/connect/tabfix.cpp @@ -51,13 +51,15 @@ /***********************************************************************/ /* DB static variables. */ /***********************************************************************/ -extern "C" int trace; -extern "C" USETEMP Use_Temp; - extern int num_read, num_there, num_eq[2]; // Statistics static const longlong M2G = 0x80000000; static const longlong M4G = (longlong)2 * M2G; +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +USETEMP UseTemp(void); + /* ------------------------------------------------------------------- */ /***********************************************************************/ @@ -273,9 +275,9 @@ bool TDBFIX::IsUsingTemp(PGLOBAL g) { // Not ready yet to handle using a temporary file with mapping // or while deleting from DBF files. - return ((Use_Temp == TMP_YES && Txfp->GetAmType() != TYPE_AM_MAP && + return ((UseTemp() == TMP_YES && Txfp->GetAmType() != TYPE_AM_MAP && !(Mode == MODE_DELETE && Txfp->GetAmType() == TYPE_AM_DBF)) || - Use_Temp == TMP_FORCE || Use_Temp == TMP_TEST); + UseTemp() == TMP_FORCE || UseTemp() == TMP_TEST); } // end of IsUsingTemp /***********************************************************************/ @@ -307,7 +309,7 @@ bool TDBFIX::OpenDB(PGLOBAL g) } // endif use if (Mode == MODE_DELETE && Txfp->GetAmType() == TYPE_AM_MAP && - (!Next || Use_Temp == TMP_FORCE)) { + (!Next || UseTemp() == TMP_FORCE)) { // Delete all lines or using temp. Not handled in MAP mode Txfp = new(g) FIXFAM((PDOSDEF)To_Def); Txfp->SetTdbp(this); diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index c1119c57065..d5f8dc50a89 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -66,8 +66,10 @@ #define MAXCOL 200 /* Default max column nb in result */ #define TYPE_UNKNOWN 10 /* Must be greater than other types */ -extern "C" int trace; -extern "C" USETEMP Use_Temp; +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +USETEMP UseTemp(void); /***********************************************************************/ /* CSVColumns: constructs the result blocks containing the description */ @@ -390,8 +392,8 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, /***********************************************************************/ CSVDEF::CSVDEF(void) { - Fmtd = Accept = Header = false; - Maxerr = 0; + Fmtd = Header = false; +//Maxerr = 0; Quoted = -1; Sep = ','; Qot = '\0'; @@ -428,9 +430,13 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Qot = '"'; Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f'))); - Header = (GetIntCatInfo("Header", 0) != 0); + Header = GetBoolCatInfo("Header", false); Maxerr = GetIntCatInfo("Maxerr", 0); - Accept = (GetIntCatInfo("Accept", 0) != 0); + Accept = GetBoolCatInfo("Accept", false); + + if (Accept && Maxerr == 0) + Maxerr = INT_MAX32; // Accept all bad lines + return false; } // end of DefineAM @@ -442,7 +448,7 @@ PTDB CSVDEF::GetTable(PGLOBAL g, MODE mode) PTDBASE tdbp; if (Catfunc != FNC_COL) { - USETEMP tmp = Use_Temp; + USETEMP tmp = UseTemp(); bool map = Mapped && mode != MODE_INSERT && !(tmp != TMP_NO && mode == MODE_UPDATE) && !(tmp == TMP_FORCE && diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index 1b39a47e7d9..8a1e1f17561 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -161,7 +161,7 @@ class TDBFMT : public TDBCSV { protected: virtual bool PrepareWriting(PGLOBAL g) - {strcpy(g->Message, "FMT is read only"); return true;} + {sprintf(g->Message, MSG(TABLE_READ_ONLY), "FMT"); return true;} // Members PSZ *FldFormat; // Field read format diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp index 5db50d44787..b093e2102c2 100644 --- a/storage/connect/table.cpp +++ b/storage/connect/table.cpp @@ -28,8 +28,6 @@ int TDB::Tnum = 0; -extern "C" int trace; // The general trace value - /***********************************************************************/ /* Utility routines. */ /***********************************************************************/ @@ -192,6 +190,18 @@ PSZ TDBASE::GetPath(void) return To_Def->GetPath(); } // end of GetPath +/***********************************************************************/ +/* Return true if name is a special column of this table. */ +/***********************************************************************/ +bool TDBASE::IsSpecial(PSZ name) + { + for (PCOLDEF cdp = To_Def->GetCols(); cdp; cdp = cdp->GetNext()) + if (!stricmp(cdp->GetName(), name) && (cdp->Flags & U_SPECIAL)) + return true; // Special column to ignore while inserting + + return false; // Not found or not special or not inserting + } // end of IsSpecial + /***********************************************************************/ /* Initialize TDBASE based column description block construction. */ /* name is used to call columns by name. */ diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp old mode 100755 new mode 100644 index 4b40e6c5509..415a1523d30 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -68,8 +68,6 @@ #include "tabdos.h" // TDBDOS and DOSCOL class dcls #include "tabmul.h" // TDBMUL and MULCOL classes dcls -extern "C" int trace; - /* ------------------------- Class TDBMUL ---------------------------- */ /***********************************************************************/ @@ -199,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) #else // !WIN32 struct stat fileinfo; - char fn[PATH_MAX], direc[PATH_MAX], pattern[256], ftype[8]; + char fn[FN_REFLEN], direc[FN_REFLEN], pattern[FN_HEADLEN], ftype[FN_EXTLEN]; DIR *dir; struct dirent *entry; diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 6acdcbb3a8e..3ec9a1feaee 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -67,13 +67,15 @@ void PrintResult(PGLOBAL, PSEM, PQRYRES); #endif // _CONSOLE -extern "C" int trace; -extern bool xinfo; - // Used to check whether a MYSQL table is created on itself bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, const char *db, char *tab, const char *src, int port); +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +bool ExactInfo(void); + /* -------------- Implementation of the MYSQLDEF class --------------- */ /***********************************************************************/ @@ -430,7 +432,6 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp) Bind = NULL; Query = NULL; - Qbuf = NULL; Fetched = false; m_Rc = RC_FX; AftRows = 0; @@ -454,7 +455,6 @@ TDBMYSQL::TDBMYSQL(PGLOBAL g, PTDBMY tdbp) : TDBASE(tdbp) Delayed = tdbp->Delayed; Bind = NULL; Query = tdbp->Query; - Qbuf = NULL; Fetched = tdbp->Fetched; m_Rc = tdbp->m_Rc; AftRows = tdbp->AftRows; @@ -495,9 +495,10 @@ PCOL TDBMYSQL::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) /***********************************************************************/ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx) { - char *tk = "`"; +//char *tk = "`"; + char tk = '`'; int len = 0, rank = 0; - bool b = false; + bool b = false, oom = false; PCOL colp; //PDBUSER dup = PlgGetUser(g); @@ -505,27 +506,24 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx) return false; // already done if (Srcdef) { - Query = Srcdef; + Query = new(g)STRING(g, 0, Srcdef); return false; } // endif Srcdef - //Find the address of the suballocated query - Query = (char*)PlugSubAlloc(g, NULL, 0); - strcpy(Query, "SELECT "); + // Allocate the string used to contain Query + Query = new(g) STRING(g, 1023, "SELECT "); if (Columns) { for (colp = Columns; colp; colp = colp->GetNext()) if (!colp->IsSpecial()) { -// if (colp->IsSpecial()) { -// strcpy(g->Message, MSG(NO_SPEC_COL)); -// return true; -// } else { if (b) - strcat(Query, ", "); + oom |= Query->Append(", "); else b = true; - strcat(strcat(strcat(Query, tk), colp->GetName()), tk); + oom |= Query->Append(tk); + oom |= Query->Append(colp->GetName()); + oom |= Query->Append(tk); ((PMYCOL)colp)->Rank = rank++; } // endif colp @@ -534,27 +532,38 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx) // Query count(*) from... for which we will count the rows from // Query '*' from... // (the use of a char constant minimize the result storage) - strcat(Query, (Isview) ? "*" : "'*'"); + if (Isview) + oom |= Query->Append('*'); + else + oom |= Query->Append("'*'"); + } // endif ncol - strcat(strcat(strcat(strcat(Query, " FROM "), tk), Tabname), tk); - len = strlen(Query); + oom |= Query->Append(" FROM "); + oom |= Query->Append(tk); + oom |= Query->Append(Tabname); + oom |= Query->Append(tk); + len = Query->GetLength(); if (To_CondFil) { if (!mx) { - strcat(strcat(Query, " WHERE "), To_CondFil->Body); - len = strlen(Query) + 1; + oom |= Query->Append(" WHERE "); + oom |= Query->Append(To_CondFil->Body); + len = Query->GetLength() + 1; } else len += (strlen(To_CondFil->Body) + 256); } else len += (mx ? 256 : 1); - if (trace) - htrc("Query=%s\n", Query); + if (oom || Query->Resize(len)) { + strcpy(g->Message, "MakeSelect: Out of memory"); + return true; + } // endif oom + + if (trace) + htrc("Query=%s\n", Query->GetStr()); - // Now we know how much to suballocate - PlugSubAlloc(g, NULL, len); return false; } // end of MakeSelect @@ -563,81 +572,82 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx) /***********************************************************************/ bool TDBMYSQL::MakeInsert(PGLOBAL g) { - char *colist, *valist = NULL; char *tk = "`"; - int len = 0, qlen = 0; - bool b = false; + uint len = 0; + bool b = false, oom; PCOL colp; if (Query) return false; // already done - for (colp = Columns; colp; colp = colp->GetNext()) - if (!colp->IsSpecial()) { -// if (colp->IsSpecial()) { -// strcpy(g->Message, MSG(NO_SPEC_COL)); -// return true; -// } else { - len += (strlen(colp->GetName()) + 4); - ((PMYCOL)colp)->Rank = Nparm++; - } // endif colp - - colist = (char*)PlugSubAlloc(g, NULL, len); - *colist = '\0'; - if (Prep) { -#if defined(MYSQL_PREPARED_STATEMENTS) - valist = (char*)PlugSubAlloc(g, NULL, 2 * Nparm); - *valist = '\0'; -#else // !MYSQL_PREPARED_STATEMENTS +#if !defined(MYSQL_PREPARED_STATEMENTS) strcpy(g->Message, "Prepared statements not used (not supported)"); PushWarning(g, this); Prep = false; #endif // !MYSQL_PREPARED_STATEMENTS } // endif Prep - for (colp = Columns; colp; colp = colp->GetNext()) { - if (b) { - strcat(colist, ", "); - if (Prep) strcat(valist, ","); - } else - b = true; + for (colp = Columns; colp; colp = colp->GetNext()) + if (colp->IsSpecial()) { + strcpy(g->Message, MSG(NO_SPEC_COL)); + return true; + } else { + len += (strlen(colp->GetName()) + 4); - strcat(strcat(strcat(colist, tk), colp->GetName()), tk); + // Parameter marker + if (!Prep) { + if (colp->GetResultType() == TYPE_DATE) + len += 20; + else + len += colp->GetLength(); + + } else + len += 2; - // Parameter marker - if (!Prep) { - if (colp->GetResultType() == TYPE_DATE) - qlen += 20; - else - qlen += colp->GetLength(); - - } else // Prep - strcat(valist, "?"); - - } // endfor colp + ((PMYCOL)colp)->Rank = Nparm++; + } // endif colp // Below 40 is enough to contain the fixed part of the query - len = (strlen(Tabname) + strlen(colist) - + ((Prep) ? strlen(valist) : 0) + 40); - Query = (char*)PlugSubAlloc(g, NULL, len); + len += (strlen(Tabname) + 40); + Query = new(g) STRING(g, len); if (Delayed) - strcpy(Query, "INSERT DELAYED INTO "); + oom = Query->Set("INSERT DELAYED INTO "); else - strcpy(Query, "INSERT INTO "); + oom = Query->Set("INSERT INTO "); - strcat(strcat(strcat(Query, tk), Tabname), tk); - strcat(strcat(strcat(Query, " ("), colist), ") VALUES ("); + oom |= Query->Append(tk); + oom |= Query->Append(Tabname); + oom |= Query->Append("` ("); - if (Prep) - strcat(strcat(Query, valist), ")"); - else { - qlen += (strlen(Query) + Nparm); - Qbuf = (char *)PlugSubAlloc(g, NULL, qlen); - } // endelse Prep + for (colp = Columns; colp; colp = colp->GetNext()) { + if (b) + oom |= Query->Append(", "); + else + b = true; + + oom |= Query->Append(tk); + oom |= Query->Append(colp->GetName()); + oom |= Query->Append(tk); + } // endfor colp - return false; + oom |= Query->Append(") VALUES ("); + +#if defined(MYSQL_PREPARED_STATEMENTS) + if (Prep) { + for (int i = 0; i < Nparm; i++) + oom |= Query->Append("?,"); + + Query->RepLast(')'); + Query->Trim(); + } // endif Prep +#endif // MYSQL_PREPARED_STATEMENTS + + if (oom) + strcpy(g->Message, "MakeInsert: Out of memory"); + + return oom; } // end of MakeInsert /***********************************************************************/ @@ -646,7 +656,7 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g) /***********************************************************************/ int TDBMYSQL::MakeCommand(PGLOBAL g) { - Query = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64); + Query = new(g) STRING(g, strlen(Qrystr) + 64); if (Quoted > 0 || stricmp(Name, Tabname)) { char *p, *qrystr, name[68]; @@ -665,16 +675,23 @@ int TDBMYSQL::MakeCommand(PGLOBAL g) strlwr(strcpy(name, Name)); // Not a keyword if ((p = strstr(qrystr, name))) { - memcpy(Query, Qrystr, p - qrystr); - Query[p - qrystr] = 0; + bool oom = Query->Set(Qrystr, p - qrystr); - if (qtd && *(p-1) == ' ') - strcat(strcat(strcat(Query, "`"), Tabname), "`"); - else - strcat(Query, Tabname); + if (qtd && *(p-1) == ' ') { + oom |= Query->Append('`'); + oom |= Query->Append(Tabname); + oom |= Query->Append('`'); + } else + oom |= Query->Append(Tabname); + + oom |= Query->Append(Qrystr + (p - qrystr) + strlen(name)); + + if (oom) { + strcpy(g->Message, "MakeCommand: Out of memory"); + return RC_FX; + } else + strlwr(strcpy(qrystr, Query->GetStr())); - strcat(Query, Qrystr + (p - qrystr) + strlen(name)); - strlwr(strcpy(qrystr, Query)); } else { sprintf(g->Message, "Cannot use this %s command", (Mode == MODE_UPDATE) ? "UPDATE" : "DELETE"); @@ -682,7 +699,7 @@ int TDBMYSQL::MakeCommand(PGLOBAL g) } // endif p } else - strcpy(Query, Qrystr); + (void)Query->Set(Qrystr); return RC_OK; } // end of MakeCommand @@ -755,7 +772,7 @@ int TDBMYSQL::Cardinality(PGLOBAL g) if (!g) return (Mode == MODE_ANY && !Srcdef) ? 1 : 0; - if (Cardinal < 0 && Mode == MODE_ANY && !Srcdef && xinfo) { + if (Cardinal < 0 && Mode == MODE_ANY && !Srcdef && ExactInfo()) { // Info command, we must return the exact table row number char query[96]; MYSQLC myc; @@ -802,7 +819,7 @@ int TDBMYSQL::GetMaxSize(PGLOBAL g) /***********************************************************************/ int TDBMYSQL::RowNumber(PGLOBAL g, bool b) { - return N; + return N + 1; } // end of RowNumber /***********************************************************************/ @@ -842,6 +859,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) /* Table already open, just replace it at its beginning. */ /*******************************************************************/ Myc.Rewind(); + N = -1; return false; } // endif use @@ -871,7 +889,8 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) /*********************************************************************/ if (Mode == MODE_READ || Mode == MODE_READX) { MakeSelect(g, Mode == MODE_READX); - m_Rc = (Mode == MODE_READ) ? Myc.ExecSQL(g, Query) : RC_OK; + m_Rc = (Mode == MODE_READ) + ? Myc.ExecSQL(g, Query->GetStr()) : RC_OK; #if 0 if (!Myc.m_Res || !Myc.m_Fields) { @@ -888,12 +907,14 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } else if (Mode == MODE_INSERT) { if (Srcdef) { strcpy(g->Message, "No insert into anonym views"); + Myc.Close(); return true; } // endif Srcdef if (!MakeInsert(g)) { #if defined(MYSQL_PREPARED_STATEMENTS) - int n = (Prep) ? Myc.PrepareSQL(g, Query) : Nparm; + int n = (Prep) + ? Myc.PrepareSQL(g, Query->GetCharValue()) : Nparm; if (Nparm != n) { if (n >= 0) // Other errors return negative values @@ -906,12 +927,12 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } // endif MakeInsert if (m_Rc != RC_FX) { - int rc __attribute__((unused)); char cmd[64]; int w; sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", Tabname); - rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines + + m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines } // endif m_Rc } else @@ -1006,7 +1027,7 @@ int TDBMYSQL::SendCommand(PGLOBAL g) { int w; - if (Myc.ExecSQLcmd(g, Query, &w) == RC_NF) { + if (Myc.ExecSQLcmd(g, Query->GetStr(), &w) == RC_NF) { AftRows = Myc.m_Afrw; sprintf(g->Message, "%s: %d affected rows", Tabname, AftRows); PushWarning(g, this, 0); // 0 means a Note @@ -1036,28 +1057,45 @@ int TDBMYSQL::SendCommand(PGLOBAL g) /***********************************************************************/ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len) { - int oldlen = strlen(Query); + bool oom; + int oldlen = Query->GetLength(); if (!key || op == OP_NEXT || Mode == MODE_UPDATE || Mode == MODE_DELETE) return false; else if (op == OP_FIRST) { - if (To_CondFil) - strcat(strcat(Query, " WHERE "), To_CondFil->Body); + if (To_CondFil) { + oom = Query->Append(" WHERE "); + + if ((oom |= Query->Append(To_CondFil->Body))) { + strcpy(g->Message, "Readkey: Out of memory"); + return true; + } // endif oom + + } // endif To_Condfil } else { if (Myc.m_Res) Myc.FreeResult(); - To_Def->GetHandler()->MakeKeyWhere(g, Query, op, "`", key, len); + To_Def->GetHandler()->MakeKeyWhere(g, Query->GetStr(), + op, "`", key, len); - if (To_CondFil) - strcat(strcat(strcat(Query, " AND ("), To_CondFil->Body), ")"); + if (To_CondFil) { + oom = Query->Append(" AND ("); + oom |= Query->Append(To_CondFil->Body); + + if ((oom |= Query->Append(')'))) { + strcpy(g->Message, "Readkey: Out of memory"); + return true; + } // endif oom + + } // endif To_Condfil } // endif's op - m_Rc = Myc.ExecSQL(g, Query); - Query[oldlen] = 0; + m_Rc = Myc.ExecSQL(g, Query->GetStr()); + Query->Truncate(oldlen); return (m_Rc == RC_FX) ? true : false; } // end of ReadKey @@ -1101,31 +1139,38 @@ int TDBMYSQL::WriteDB(PGLOBAL g) // Statement was not prepared, we must construct and execute // an insert query for each line to insert int rc; + uint len = Query->GetLength(); char buf[64]; - - strcpy(Qbuf, Query); + bool b, oom = false; // Make the Insert command value list for (PCOL colp = Columns; colp; colp = colp->GetNext()) { if (!colp->GetValue()->IsNull()) { - if (colp->GetResultType() == TYPE_STRING || - colp->GetResultType() == TYPE_DATE) - strcat(Qbuf, "'"); - - strcat(Qbuf, colp->GetValue()->GetCharString(buf)); - - if (colp->GetResultType() == TYPE_STRING || - colp->GetResultType() == TYPE_DATE) - strcat(Qbuf, "'"); - + if ((b = colp->GetResultType() == TYPE_STRING || + colp->GetResultType() == TYPE_DATE)) + oom |= Query->Append('\''); + + oom |= Query->Append(colp->GetValue()->GetCharString(buf)); + + if (b) + oom |= Query->Append('\''); + } else - strcat(Qbuf, "NULL"); - - strcat(Qbuf, (colp->GetNext()) ? "," : ")"); + oom |= Query->Append("NULL"); + + oom |= Query->Append(','); } // endfor colp - Myc.m_Rows = -1; // To execute the query - rc = Myc.ExecSQL(g, Qbuf); + if (unlikely(oom)) { + strcpy(g->Message, "WriteDB: Out of memory"); + rc = RC_FX; + } else { + Query->RepLast(')'); + Myc.m_Rows = -1; // To execute the query + rc = Myc.ExecSQL(g, Query->GetStr()); + Query->Truncate(len); // Restore query + } // endif oom + return (rc == RC_NF) ? RC_OK : rc; // RC_NF is Ok } // end of WriteDB @@ -1530,7 +1575,7 @@ bool TDBMYEXC::OpenDB(PGLOBAL g) if (!(Cmdlist = MakeCMD(g))) { Myc.Close(); return true; - } // endif Query + } // endif Cmdlist return false; } // end of OpenDB @@ -1558,9 +1603,12 @@ int TDBMYEXC::ReadDB(PGLOBAL g) int rc; do { - Query = Cmdlist->Cmd; + if (Query) + Query->Set(Cmdlist->Cmd); + else + Query = new(g) STRING(g, 0, Cmdlist->Cmd); - switch (rc = Myc.ExecSQLcmd(g, Query, &Warnings)) { + switch (rc = Myc.ExecSQLcmd(g, Query->GetStr(), &Warnings)) { case RC_NF: AftRows = Myc.m_Afrw; strcpy(g->Message, "Affected rows"); @@ -1649,11 +1697,11 @@ void MYXCOL::ReadColumn(PGLOBAL g) } else switch (Flag) { - case 0: Value->SetValue_psz(tdbp->Query); break; - case 1: Value->SetValue(tdbp->AftRows); break; - case 2: Value->SetValue_psz(g->Message); break; - case 3: Value->SetValue(tdbp->Warnings); break; - default: Value->SetValue_psz("Invalid Flag"); break; + case 0: Value->SetValue_psz(tdbp->Query->GetStr()); break; + case 1: Value->SetValue(tdbp->AftRows); break; + case 2: Value->SetValue_psz(g->Message); break; + case 3: Value->SetValue(tdbp->Warnings); break; + default: Value->SetValue_psz("Invalid Flag"); break; } // endswitch Flag } // end of ReadColumn diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index 68cf453a9e6..99930d43a57 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -119,6 +119,7 @@ class TDBMYSQL : public TDBASE { // Members MYSQLC Myc; // MySQL connection class MYSQL_BIND *Bind; // To the MySQL bind structure array + PSTRG Query; // Constructed SQL query char *Host; // Host machine to use char *User; // User logon info char *Pwd; // Password logon info @@ -126,8 +127,6 @@ class TDBMYSQL : public TDBASE { char *Tabname; // External table name char *Srcdef; // The source table SQL definition char *Server; // The server ID - char *Query; // Points to SQL query - char *Qbuf; // Used for not prepared insert char *Qrystr; // The original query bool Fetched; // True when fetch was done bool Isview; // True if this table is a MySQL view diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp index 917685faae3..86f0bd20d47 100644 --- a/storage/connect/taboccur.cpp +++ b/storage/connect/taboccur.cpp @@ -51,8 +51,6 @@ #include "ha_connect.h" #include "mycat.h" -extern "C" int trace; - /***********************************************************************/ /* Prepare and count columns in the column list. */ /***********************************************************************/ diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 023d7efa708..bbc17129aaf 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -75,15 +75,17 @@ #include "sql_string.h" -extern "C" int trace; -extern bool xinfo; - /***********************************************************************/ /* DB static variables. */ /***********************************************************************/ // int num_read, num_there, num_eq[2], num_nf; // Statistics extern int num_read, num_there, num_eq[2]; // Statistics +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +bool ExactInfo(void); + /* -------------------------- Class ODBCDEF -------------------------- */ /***********************************************************************/ @@ -93,7 +95,7 @@ ODBCDEF::ODBCDEF(void) { Connect= Tabname= Tabschema= Tabcat= Srcdef= Qchar= Qrystr= Sep= NULL; Catver = Options = Quoted = Maxerr = Maxres = 0; - Xsrc = false; + Scrollable = Xsrc = false; } // end of ODBCDEF constructor /***********************************************************************/ @@ -127,6 +129,11 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Maxres = GetIntCatInfo("Maxres", 0); Quoted = GetIntCatInfo("Quoted", 0); Options = ODBConn::noOdbcDialog; +//Options = ODBConn::noOdbcDialog | ODBConn::useCursorLib; + + if ((Scrollable = GetBoolCatInfo("Scrollable", false))) + Elemt = 0; // Not compatible with extended fetch + Pseudo = 2; // FILID is Ok but not ROWID return false; } // end of DefineAM @@ -191,6 +198,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp) Quoted = MY_MAX(0, tdp->GetQuoted()); Rows = tdp->GetElemt(); Catver = tdp->Catver; + Scrollable = tdp->Scrollable; } else { Connect = NULL; TableName = NULL; @@ -203,6 +211,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp) Quoted = 0; Rows = 0; Catver = 0; + Scrollable = false; } // endif tdp Quote = NULL; @@ -229,6 +238,7 @@ TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBASE(tdbp) Catalog = tdbp->Catalog; Srcdef = tdbp->Srcdef; Qrystr = tdbp->Qrystr; + Scrollable = tdbp->Scrollable; Quote = tdbp->Quote; Query = tdbp->Query; Count = tdbp->Count; @@ -672,7 +682,7 @@ int TDBODBC::Cardinality(PGLOBAL g) if (!g) return (Mode == MODE_ANY && !Srcdef) ? 1 : 0; - if (Cardinal < 0 && Mode == MODE_ANY && !Srcdef && xinfo) { + if (Cardinal < 0 && Mode == MODE_ANY && !Srcdef && ExactInfo()) { // Info command, we must return the exact table row number char qry[96], tbn[64]; ODBConn *ocp = new(g) ODBConn(g, this); @@ -755,6 +765,12 @@ bool TDBODBC::OpenDB(PGLOBAL g) // To_Kindex->Reset(); // rewind(Stream); >>>>>>> Something to be done with Cursor <<<<<<< + if (Ocp->Rewind(Query, (PODBCCOL)Columns)) { + Ocp->Close(); + return true; + } // endif Rewind + + Fpos = 0; return false; } // endif use @@ -1075,8 +1091,9 @@ void ODBCCOL::ReadColumn(PGLOBAL g) } // endif Bufp if (Buf_Type == TYPE_DATE) { - struct tm dbtime = {0,0,0,0,0,0,0,0,0}; + struct tm dbtime; + memset(&dbtime, 0, sizeof(tm)); dbtime.tm_sec = (int)Sqlbuf->second; dbtime.tm_min = (int)Sqlbuf->minute; dbtime.tm_hour = (int)Sqlbuf->hour; diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h index 360f52c9d21..f042b0c73ca 100644 --- a/storage/connect/tabodbc.h +++ b/storage/connect/tabodbc.h @@ -59,6 +59,7 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */ int Quoted; /* Identifier quoting level */ int Maxerr; /* Maxerr for an Exec table */ int Maxres; /* Maxres for a catalog table */ + bool Scrollable; /* Use scrollable cursor */ bool Xsrc; /* Execution type */ }; // end of ODBCDEF @@ -142,6 +143,7 @@ class TDBODBC : public TDBASE { int Rbuf; // Number of lines read in buffer int BufSize; // Size of connect string buffer int Nparm; // The number of statement parameters + bool Scrollable; // Use scrollable cursor }; // end of class TDBODBC /***********************************************************************/ diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp index 7e54b62caaa..94e9d7187f0 100644 --- a/storage/connect/tabpivot.cpp +++ b/storage/connect/tabpivot.cpp @@ -51,8 +51,6 @@ #include "ha_connect.h" #include "mycat.h" // For GetHandler -extern "C" int trace; - /***********************************************************************/ /* Make the Pivot table column list. */ /***********************************************************************/ diff --git a/storage/connect/tabsys.cpp b/storage/connect/tabsys.cpp index ae92c0771b6..3ed182c5e33 100644 --- a/storage/connect/tabsys.cpp +++ b/storage/connect/tabsys.cpp @@ -53,8 +53,6 @@ GetPrivateProfileString(NULL,NULL,"",S,L,I) #endif // !WIN32 -extern "C" int trace; - /* -------------- Implementation of the INI classes ------------------ */ /***********************************************************************/ diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp index f5a516ad1d0..22ec3849b6f 100644 --- a/storage/connect/tabtbl.cpp +++ b/storage/connect/tabtbl.cpp @@ -86,8 +86,6 @@ #define SYSEXIT void * #endif // !WIN32 -extern "C" int trace; - /* ---------------------------- Class TBLDEF ---------------------------- */ /**************************************************************************/ diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index f4a8f2ee470..d469594916f 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -54,7 +54,6 @@ #include "tabutil.h" #include "ha_connect.h" -extern "C" int trace; extern "C" int zconv; /************************************************************************/ diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index 11f18be074a..606e532d526 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -114,7 +114,7 @@ class DllExport PRXCOL : public COLBLK { {return false;} virtual void ReadColumn(PGLOBAL g); virtual void WriteColumn(PGLOBAL g); - bool Init(PGLOBAL g, PTDBASE tp = NULL); + virtual bool Init(PGLOBAL g, PTDBASE tp = NULL); protected: // Default constructor not to be used diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp index 6d7059e2306..3ed40540395 100644 --- a/storage/connect/tabvct.cpp +++ b/storage/connect/tabvct.cpp @@ -76,8 +76,10 @@ char *strerror(int num); #endif // UNIX -extern "C" int trace; -extern "C" USETEMP Use_Temp; +/***********************************************************************/ +/* External function. */ +/***********************************************************************/ +USETEMP UseTemp(void); /***********************************************************************/ /* Char VCT column blocks are right filled with blanks (blank = true) */ @@ -209,7 +211,7 @@ PTDB VCTDEF::GetTable(PGLOBAL g, MODE mode) // Mapping not used for insert (except for true VEC not split tables) // or when UseTemp is forced bool map = Mapped && (Estimate || mode != MODE_INSERT) && - !(Use_Temp == TMP_FORCE && + !(UseTemp() == TMP_FORCE && (mode == MODE_UPDATE || mode == MODE_DELETE)); PTXF txfp; PTDB tdbp; @@ -291,7 +293,7 @@ PCOL TDBVCT::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) bool TDBVCT::IsUsingTemp(PGLOBAL g) { // For developpers - return (Use_Temp == TMP_TEST); + return (UseTemp() == TMP_TEST); } // end of IsUsingTemp /***********************************************************************/ diff --git a/storage/connect/tabvir.cpp b/storage/connect/tabvir.cpp new file mode 100644 index 00000000000..b4c76f5ad56 --- /dev/null +++ b/storage/connect/tabvir.cpp @@ -0,0 +1,305 @@ +/************* tdbvir C++ Program Source Code File (.CPP) **************/ +/* PROGRAM NAME: tdbvir.cpp Version 1.1 */ +/* (C) Copyright to the author Olivier BERTRAND 2014 */ +/* This program are the VIR classes DB execution routines. */ +/***********************************************************************/ + +/***********************************************************************/ +/* Include relevant sections of the MariaDB header file. */ +/***********************************************************************/ +#include + +/***********************************************************************/ +/* Include application header files: */ +/* global.h is header containing all global declarations. */ +/* plgdbsem.h is header containing the DB application declarations. */ +/* xtable.h is header containing the TDBASE declarations. */ +/* tdbvir.h is header containing the VIR classes declarations. */ +/***********************************************************************/ +#include "global.h" +#include "plgdbsem.h" +#include "filter.h" +#include "xtable.h" +#include "reldef.h" +#include "colblk.h" +#include "mycat.h" // for FNC_COL +#include "tabvir.h" +#include "resource.h" // for IDS_COLUMNS + +/***********************************************************************/ +/* Return the unique column definition to MariaDB. */ +/***********************************************************************/ +PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info) + { + int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, + TYPE_INT, TYPE_STRING, TYPE_STRING}; + XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, + FLD_PREC, FLD_KEY, FLD_EXTRA}; + unsigned int length[] = {8, 4, 16, 4, 16, 16}; + int i, n, ncol = sizeof(buftyp) / sizeof(int); + PQRYRES qrp; + PCOLRES crp; + + n = (info) ? 0 : 1; + + /**********************************************************************/ + /* Allocate the structures used to refer to the result set. */ + /**********************************************************************/ + if (!(qrp = PlgAllocResult(g, ncol, n, IDS_COLUMNS + 3, + buftyp, fldtyp, length, false, true))) + return NULL; + + // Some columns must be renamed before info + for (i = 0, crp = qrp->Colresp; crp; crp = crp->Next) + switch (++i) { + case 5: crp->Name = "Key"; break; + case 6: crp->Name = "Extra"; break; + } // endswitch i + + if (info) + return qrp; + + /**********************************************************************/ + /* Now get the results into blocks. */ + /**********************************************************************/ + // Set column name + crp = qrp->Colresp; // Column_Name + crp->Kdata->SetValue("n", 0); + + // Set type, type name, precision + crp = crp->Next; // Data_Type + crp->Kdata->SetValue(TYPE_INT, 0); + + crp = crp->Next; // Type_Name + crp->Kdata->SetValue(GetTypeName(TYPE_INT), 0); + + crp = crp->Next; // Precision + crp->Kdata->SetValue(11, 0); + + crp = crp->Next; // Key + crp->Kdata->SetValue("KEY", 0); + + crp = crp->Next; // Extra + crp->Kdata->SetValue("SPECIAL=ROWID", 0); + + qrp->Nblin = 1; + + /**********************************************************************/ + /* Return the result pointer for use by discovery routines. */ + /**********************************************************************/ + return qrp; + } // end of VirColumns + +/* --------------------------- Class VIRDEF --------------------------- */ + +/***********************************************************************/ +/* GetTable: makes a new Table Description Block. */ +/***********************************************************************/ +PTDB VIRDEF::GetTable(PGLOBAL g, MODE m) + { + // Column blocks will be allocated only when needed. + if (Catfunc == FNC_COL) + return new(g) TDBVICL(this); + else + return new(g) TDBVIR(this); + + } // end of GetTable + +/* ------------------------ TDBVIR functions ------------------------- */ + +/***********************************************************************/ +/* Implementation of the TDBVIR class. */ +/***********************************************************************/ +TDBVIR::TDBVIR(PVIRDEF tdp) : TDBASE(tdp) + { + Size = (tdp->GetElemt()) ? tdp->GetElemt() : 1; + N = -1; + } // end of TDBVIR constructor + +/***********************************************************************/ +/* Analyze the filter and reset the size limit accordingly. */ +/* This is possible when a filter contains predicates implying the */ +/* special column ROWID. Here we just test for when no more good */ +/* records can be met in the remaining of the table. */ +/***********************************************************************/ +int TDBVIR::TestFilter(PFIL filp, bool nop) + { + int i, op = filp->GetOpc(), n = 0, type[2] = {0,0}; + int l1 = 0, l2, limit = Size; + PXOB arg[2] = {NULL,NULL}; + + if (op == OP_GT || op == OP_GE || op == OP_LT || op == OP_LE) { + for (i = 0; i < 2; i++) { + arg[i] = filp->Arg(i); + + switch (filp->GetArgType(i)) { + case TYPE_CONST: + if ((l1 = arg[i]->GetIntValue()) >= 0) + type[i] = 1; + + break; + case TYPE_COLBLK: + if (((PCOL)arg[i])->GetTo_Tdb() == this && + ((PCOL)arg[i])->GetAmType() == TYPE_AM_ROWID) + type[i] = 2; + + break; + default: + break; + } // endswitch ArgType + + if (!type[i]) + break; + + n += type[i]; + } // endfor i + + if (n == 3) { + // If true it will be ok to delete the filter + BOOL ok = (filp == To_Filter); + + if (type[0] == 1) + // Make it always a Column-op-Value + switch (op) { + case OP_GT: op = OP_LT; break; + case OP_GE: op = OP_LE; break; + case OP_LT: op = OP_GT; break; + case OP_LE: op = OP_GE; break; + } // endswitch op + + if (!nop) switch (op) { + case OP_LT: l1--; + case OP_LE: limit = l1; break; + default: ok = false; + } // endswitch op + + else switch (op) { + case OP_GE: l1--; + case OP_GT: limit = l1; break; + default: ok = false; + } // endswitch op + + limit = MY_MIN(MY_MAX(0, limit), Size); + + // Just one where clause such as Rowid < limit; + if (ok) + To_Filter = NULL; + + } else + limit = Size; + + } else if ((op == OP_AND && !nop) || (op == OP_OR && nop)) { + l1 = TestFilter((PFIL)filp->Arg(0), nop); + l2 = TestFilter((PFIL)filp->Arg(1), nop); + limit = MY_MIN(l1, l2); + } else if (op == OP_NOT) + limit = TestFilter((PFIL)filp->Arg(0), !nop); + + return limit; + } // end of TestFilter + +/***********************************************************************/ +/* Allocate source column description block. */ +/***********************************************************************/ +PCOL TDBVIR::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) + { + PCOL colp = NULL; + + if (cdp->IsVirtual()) { + colp = new(g) VIRCOL(cdp, this, cprec, n); + } else strcpy(g->Message, + "Virtual tables accept only special or virtual columns"); + + return colp; + } // end of MakeCol + +/***********************************************************************/ +/* VIR Access Method opening routine. */ +/***********************************************************************/ +bool TDBVIR::OpenDB(PGLOBAL g) + { + if (Use == USE_OPEN) { + // Table already open + N = -1; + return false; + } // endif use + + if (Mode != MODE_READ) { + strcpy(g->Message, "Virtual tables are read only"); + return true; + } // endif Mode + + /*********************************************************************/ + /* Analyze the filter and refine Size accordingly. */ + /*********************************************************************/ + if (To_Filter) + Size = TestFilter(To_Filter, false); + + return false; + } // end of OpenDB + +/***********************************************************************/ +/* Data Base read routine for the VIR access method. */ +/***********************************************************************/ +int TDBVIR::ReadDB(PGLOBAL g) + { + return (++N >= Size) ? RC_EF : RC_OK; + } // end of ReadDB + +/***********************************************************************/ +/* WriteDB: Data Base write routine for the VIR access methods. */ +/***********************************************************************/ +int TDBVIR::WriteDB(PGLOBAL g) + { + sprintf(g->Message, MSG(VIR_READ_ONLY), To_Def->GetType()); + return RC_FX; + } // end of WriteDB + +/***********************************************************************/ +/* Data Base delete line routine for the VIR access methods. */ +/***********************************************************************/ +int TDBVIR::DeleteDB(PGLOBAL g, int irc) + { + sprintf(g->Message, MSG(VIR_NO_DELETE), To_Def->GetType()); + return RC_FX; + } // end of DeleteDB + +/* ---------------------------- VIRCOL ------------------------------- */ + +/***********************************************************************/ +/* VIRCOL public constructor. */ +/***********************************************************************/ +VIRCOL::VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am) + : COLBLK(cdp, tdbp, i) + { + if (cprec) { + Next = cprec->GetNext(); + cprec->SetNext(this); + } else { + Next = tdbp->GetColumns(); + tdbp->SetColumns(this); + } // endif cprec + + } // end of VIRCOL constructor + +/***********************************************************************/ +/* ReadColumn: */ +/***********************************************************************/ +void VIRCOL::ReadColumn(PGLOBAL g) + { + // This should never be called + sprintf(g->Message, "ReadColumn: Column %s is not virtual", Name); + longjmp(g->jumper[g->jump_level], TYPE_COLBLK); + } // end of ReadColumn + +/* ---------------------------TDBVICL class -------------------------- */ + +/***********************************************************************/ +/* GetResult: Get the list the VIRTUAL table columns. */ +/***********************************************************************/ +PQRYRES TDBVICL::GetResult(PGLOBAL g) + { + return VirColumns(g, NULL, NULL, false); + } // end of GetResult + +/* ------------------------- End of Virtual -------------------------- */ diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h new file mode 100644 index 00000000000..8d0caa257e7 --- /dev/null +++ b/storage/connect/tabvir.h @@ -0,0 +1,110 @@ +/**************** tdbvir H Declares Source Code File (.H) **************/ +/* Name: TDBVIR.H Version 1.1 */ +/* */ +/* (C) Copyright to the author Olivier BERTRAND 2006-2014 */ +/* */ +/* This file contains the VIR classes declare code. */ +/***********************************************************************/ +typedef class VIRDEF *PVIRDEF; +typedef class TDBVIR *PTDBVIR; + +/***********************************************************************/ +/* Return the unique column definition to MariaDB. */ +/***********************************************************************/ +PQRYRES VirColumns(PGLOBAL g, char *tab, char *db, bool info); + +/* --------------------------- VIR classes --------------------------- */ + +/***********************************************************************/ +/* VIR: Virtual table used to select constant values. */ +/***********************************************************************/ +class DllExport VIRDEF : public TABDEF { /* Logical table description */ + public: + // Constructor + VIRDEF(void) {} + + // Implementation + virtual const char *GetType(void) {return "VIRTUAL";} + + // Methods + virtual bool DefineAM(PGLOBAL, LPCSTR, int) {Pseudo = 3; return false;} + virtual int Indexable(void) {return 3;} + virtual PTDB GetTable(PGLOBAL g, MODE m); + + protected: + // Members + }; // end of VIRDEF + +/***********************************************************************/ +/* This is the class declaration for the Virtual table. */ +/***********************************************************************/ +class DllExport TDBVIR : public TDBASE { + public: + // Constructors + TDBVIR(PVIRDEF tdp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_VIR;} + + // Methods + virtual int GetRecpos(void) {return N;} + virtual bool SetRecpos(PGLOBAL g, int recpos) + {N = recpos - 2; return false;} + virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;} + int TestFilter(PFIL filp, bool nop); + + // Database routines + virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); + virtual int Cardinality(PGLOBAL g) {return (g) ? Size : 1;} + virtual int GetMaxSize(PGLOBAL g) {return Size;} + virtual bool OpenDB(PGLOBAL g); + virtual int ReadDB(PGLOBAL g); + virtual int WriteDB(PGLOBAL g); + virtual int DeleteDB(PGLOBAL g, int irc); + virtual void CloseDB(PGLOBAL g) {} + + protected: + // Members + int Size; // Table size + int N; // The VIR table current position + }; // end of class TDBVIR + +/***********************************************************************/ +/* Class VIRCOL: VIRTUAL access method column descriptor. */ +/***********************************************************************/ +class VIRCOL : public COLBLK { + friend class TDBVIR; + public: + // Constructors + VIRCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "VIRTUAL"); + + // Implementation + virtual int GetAmType(void) {return TYPE_AM_VIR;} + + // Methods + virtual void ReadColumn(PGLOBAL g); + + protected: + // Default constructor not to be used + VIRCOL(void) {} + + // No additional members + }; // end of class VIRCOL + +/***********************************************************************/ +/* This is the class declaration for the VIR column catalog table. */ +/***********************************************************************/ +class TDBVICL : public TDBCAT { + public: + // Constructor + TDBVICL(PVIRDEF tdp) : TDBCAT(tdp) {} + + // Methods + virtual int Cardinality(PGLOBAL g) {return 2;} // Avoid DBUG_ASSERT + + protected: + // Specific routines + virtual PQRYRES GetResult(PGLOBAL g); + + // Members + }; // end of class TDBVICL diff --git a/storage/connect/tabwmi.cpp b/storage/connect/tabwmi.cpp index e47df028dc2..7c69426a066 100644 --- a/storage/connect/tabwmi.cpp +++ b/storage/connect/tabwmi.cpp @@ -21,8 +21,6 @@ #include "plgcnx.h" // For DB types #include "resource.h" -extern "C" int trace; - /* ------------------- Functions WMI Column info --------------------- */ /***********************************************************************/ @@ -200,7 +198,7 @@ PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info) } // endif res len = (unsigned)SysStringLen(propname); - length[0] = max(length[0], len); + length[0] = MY_MAX(length[0], len); } // enfor i res = SafeArrayDestroy(prnlist); diff --git a/storage/connect/tabwmi.h b/storage/connect/tabwmi.h index 6f25c0de258..6abb85453a1 100644 --- a/storage/connect/tabwmi.h +++ b/storage/connect/tabwmi.h @@ -1,151 +1,151 @@ -// TABWMI.H Olivier Bertrand 2012 -// WMI: Virtual table to Get WMI information -#define _WIN32_DCOM -#include -# pragma comment(lib, "wbemuuid.lib") -#include -using namespace std; -#include - -/***********************************************************************/ -/* Definitions. */ -/***********************************************************************/ -typedef class WMIDEF *PWMIDEF; -typedef class TDBWMI *PTDBWMI; -typedef class WMICOL *PWMICOL; -typedef class TDBWCL *PTDBWCL; -typedef class WCLCOL *PWCLCOL; - -/***********************************************************************/ -/* Structure used by WMI column info functions. */ -/***********************************************************************/ -typedef struct _WMIutil { - IWbemServices *Svc; - IWbemClassObject *Cobj; -} WMIUTIL, *PWMIUT; - -/***********************************************************************/ -/* Functions used externally. */ -/***********************************************************************/ -PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info); - -/* -------------------------- WMI classes ---------------------------- */ - -/***********************************************************************/ -/* WMI: Virtual table to get the WMI information. */ -/***********************************************************************/ -class WMIDEF : public TABDEF { /* Logical table description */ - friend class TDBWMI; - friend class TDBWCL; - friend class TDBWCX; - public: - // Constructor - WMIDEF(void) {Pseudo = 3; Nspace = NULL; Wclass = NULL; Ems = 0;} - - // Implementation - virtual const char *GetType(void) {return "WMI";} - - // Methods - virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); - virtual PTDB GetTable(PGLOBAL g, MODE m); - - protected: - // Members - char *Nspace; - char *Wclass; - int Ems; - }; // end of WMIDEF - -/***********************************************************************/ -/* This is the class declaration for the WMI table. */ -/***********************************************************************/ -class TDBWMI : public TDBASE { - friend class WMICOL; - public: - // Constructor - TDBWMI(PWMIDEF tdp); - - // Implementation - virtual AMT GetAmType(void) {return TYPE_AM_WMI;} - - // Methods - virtual int GetRecpos(void); - virtual int GetProgCur(void) {return N;} - virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;} - - // Database routines - virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); +// TABWMI.H Olivier Bertrand 2012 +// WMI: Virtual table to Get WMI information +#define _WIN32_DCOM +#include +# pragma comment(lib, "wbemuuid.lib") +#include +using namespace std; +#include + +/***********************************************************************/ +/* Definitions. */ +/***********************************************************************/ +typedef class WMIDEF *PWMIDEF; +typedef class TDBWMI *PTDBWMI; +typedef class WMICOL *PWMICOL; +typedef class TDBWCL *PTDBWCL; +typedef class WCLCOL *PWCLCOL; + +/***********************************************************************/ +/* Structure used by WMI column info functions. */ +/***********************************************************************/ +typedef struct _WMIutil { + IWbemServices *Svc; + IWbemClassObject *Cobj; +} WMIUTIL, *PWMIUT; + +/***********************************************************************/ +/* Functions used externally. */ +/***********************************************************************/ +PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *cls, bool info); + +/* -------------------------- WMI classes ---------------------------- */ + +/***********************************************************************/ +/* WMI: Virtual table to get the WMI information. */ +/***********************************************************************/ +class WMIDEF : public TABDEF { /* Logical table description */ + friend class TDBWMI; + friend class TDBWCL; + friend class TDBWCX; + public: + // Constructor + WMIDEF(void) {Pseudo = 3; Nspace = NULL; Wclass = NULL; Ems = 0;} + + // Implementation + virtual const char *GetType(void) {return "WMI";} + + // Methods + virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); + virtual PTDB GetTable(PGLOBAL g, MODE m); + + protected: + // Members + char *Nspace; + char *Wclass; + int Ems; + }; // end of WMIDEF + +/***********************************************************************/ +/* This is the class declaration for the WMI table. */ +/***********************************************************************/ +class TDBWMI : public TDBASE { + friend class WMICOL; + public: + // Constructor + TDBWMI(PWMIDEF tdp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_WMI;} + + // Methods + virtual int GetRecpos(void); + virtual int GetProgCur(void) {return N;} + virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;} + + // Database routines + virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); virtual int Cardinality(PGLOBAL g) {return GetMaxSize(g);} - virtual int GetMaxSize(PGLOBAL g); - virtual bool OpenDB(PGLOBAL g); - virtual int ReadDB(PGLOBAL g); - virtual int WriteDB(PGLOBAL g); - virtual int DeleteDB(PGLOBAL g, int irc); - virtual void CloseDB(PGLOBAL g); - - protected: - // Specific routines - bool Initialize(PGLOBAL g); - char *MakeWQL(PGLOBAL g); - void DoubleSlash(PGLOBAL g); - bool GetWMIInfo(PGLOBAL g); - - // Members - IWbemServices *Svc; // IWbemServices pointer - IEnumWbemClassObject *Enumerator; - IWbemClassObject *ClsObj; - char *Nspace; // Namespace - char *Wclass; // Class name - char *ObjPath; // Used for direct access - char *Kvp; // Itou - int Ems; // Estimated max size - PCOL Kcol; // Key column - HRESULT Res; - PVBLK Vbp; - bool Init; - bool Done; - ULONG Rc; - int N; // Row number - }; // end of class TDBWMI - -/***********************************************************************/ -/* Class WMICOL: WMI Address column. */ -/***********************************************************************/ -class WMICOL : public COLBLK { - friend class TDBWMI; - public: - // Constructors - WMICOL(PCOLDEF cdp, PTDB tdbp, int n); - - // Implementation - virtual int GetAmType(void) {return TYPE_AM_WMI;} - - // Methods - virtual void ReadColumn(PGLOBAL g); - - protected: - WMICOL(void) {} // Default constructor not to be used - - // Members - PTDBWMI Tdbp; // Points to WMI table block - VARIANT Prop; // Property value - CIMTYPE Ctype; // CIM Type - HRESULT Res; - }; // end of class WMICOL - -/***********************************************************************/ -/* This is the class declaration for the WMI catalog table. */ -/***********************************************************************/ -class TDBWCL : public TDBCAT { - public: - // Constructor - TDBWCL(PWMIDEF tdp); - - protected: - // Specific routines - virtual PQRYRES GetResult(PGLOBAL g); - - // Members - char *Nsp; // Name space - char *Cls; // Class - }; // end of class TDBWCL + virtual int GetMaxSize(PGLOBAL g); + virtual bool OpenDB(PGLOBAL g); + virtual int ReadDB(PGLOBAL g); + virtual int WriteDB(PGLOBAL g); + virtual int DeleteDB(PGLOBAL g, int irc); + virtual void CloseDB(PGLOBAL g); + + protected: + // Specific routines + bool Initialize(PGLOBAL g); + char *MakeWQL(PGLOBAL g); + void DoubleSlash(PGLOBAL g); + bool GetWMIInfo(PGLOBAL g); + + // Members + IWbemServices *Svc; // IWbemServices pointer + IEnumWbemClassObject *Enumerator; + IWbemClassObject *ClsObj; + char *Nspace; // Namespace + char *Wclass; // Class name + char *ObjPath; // Used for direct access + char *Kvp; // Itou + int Ems; // Estimated max size + PCOL Kcol; // Key column + HRESULT Res; + PVBLK Vbp; + bool Init; + bool Done; + ULONG Rc; + int N; // Row number + }; // end of class TDBWMI + +/***********************************************************************/ +/* Class WMICOL: WMI Address column. */ +/***********************************************************************/ +class WMICOL : public COLBLK { + friend class TDBWMI; + public: + // Constructors + WMICOL(PCOLDEF cdp, PTDB tdbp, int n); + + // Implementation + virtual int GetAmType(void) {return TYPE_AM_WMI;} + + // Methods + virtual void ReadColumn(PGLOBAL g); + + protected: + WMICOL(void) {} // Default constructor not to be used + + // Members + PTDBWMI Tdbp; // Points to WMI table block + VARIANT Prop; // Property value + CIMTYPE Ctype; // CIM Type + HRESULT Res; + }; // end of class WMICOL + +/***********************************************************************/ +/* This is the class declaration for the WMI catalog table. */ +/***********************************************************************/ +class TDBWCL : public TDBCAT { + public: + // Constructor + TDBWCL(PWMIDEF tdp); + + protected: + // Specific routines + virtual PQRYRES GetResult(PGLOBAL g); + + // Members + char *Nsp; // Name space + char *Cls; // Class + }; // end of class TDBWCL diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp index bd3d57257ff..57f0e1e03b9 100644 --- a/storage/connect/tabxcl.cpp +++ b/storage/connect/tabxcl.cpp @@ -57,8 +57,6 @@ #include "ha_connect.h" #include "mycat.h" -extern "C" int trace; - /* -------------- Implementation of the XCOL classes ---------------- */ /***********************************************************************/ @@ -184,8 +182,9 @@ bool TDBXCL::OpenDB(PGLOBAL g) /* Check and initialize the subtable columns. */ /*********************************************************************/ for (PCOL cp = Columns; cp; cp = cp->GetNext()) - if (((PXCLCOL)cp)->Init(g)) - return TRUE; + if (!cp->IsSpecial()) + if (((PPRXCOL)cp)->Init(g)) + return TRUE; /*********************************************************************/ /* Physically open the object table. */ @@ -240,12 +239,25 @@ XCLCOL::XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i) : PRXCOL(cdp, tdbp, cprec, i, "XCL") { // Set additional XXL access method information for column. - Cbuf = (char*)PlugSubAlloc(g, NULL, Long + 1); + Cbuf = NULL; // Will be allocated later Cp = NULL; // Pointer to current position in Cbuf Sep = ((PTDBXCL)tdbp)->Sep; AddStatus(BUF_READ); // Only evaluated from TDBXCL::ReadDB } // end of XCLCOL constructor +/***********************************************************************/ +/* XCLCOL initialization routine. */ +/* Allocate Cbuf that will contain the Colp value. */ +/***********************************************************************/ +bool XCLCOL::Init(PGLOBAL g, PTDBASE tp) + { + if (PRXCOL::Init(g, tp)) + return true; + + Cbuf = (char*)PlugSubAlloc(g, NULL, Colp->GetLength() + 1); + return false; + } // end of Init + /***********************************************************************/ /* What this routine does is to get the comma-separated string */ /* from the source table column, extract the single values and */ @@ -254,8 +266,10 @@ XCLCOL::XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i) void XCLCOL::ReadColumn(PGLOBAL g) { if (((PTDBXCL)To_Tdb)->New) { + Colp->Reset(); // Moved here in case of failed filtering Colp->Eval(g); - strcpy(Cbuf, To_Val->GetCharValue()); + strncpy(Cbuf, To_Val->GetCharValue(), Colp->GetLength()); + Cbuf[Colp->GetLength()] = 0; Cp = Cbuf; } // endif New diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 24122573100..7e11600c090 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -88,8 +88,9 @@ class XCLCOL : public PRXCOL { XCLCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); // Methods - virtual void Reset(void) {Colp->Reset();} // Evaluated only by TDBXCL + virtual void Reset(void) {} // Evaluated only by TDBXCL virtual void ReadColumn(PGLOBAL g); + virtual bool Init(PGLOBAL g, PTDBASE tp = NULL); protected: // Default constructor not to be used diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index 88c029aefd2..8c73907c7ee 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -11,6 +11,7 @@ /***********************************************************************/ /* Include required compiler header files. */ /***********************************************************************/ +#include "my_global.h" #include #include #include @@ -28,7 +29,6 @@ #include "osutil.h" #define _O_RDONLY O_RDONLY #endif // !WIN32 -#include "my_global.h" #define INCLUDE_TDBXML #define NODE_TYPE_LIST @@ -49,10 +49,7 @@ #include "tabxml.h" #include "tabmul.h" -extern "C" { -extern char version[]; -extern int trace; -} // "C" +extern "C" char version[]; #if defined(WIN32) && defined(DOMDOC_SUPPORT) #define XMLSUP "MS-DOM" diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index b5f835c9cc9..4affe447b00 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -47,14 +47,17 @@ #include "user_connect.h" #include "mycat.h" -extern "C" int trace; -extern uint worksize; - /****************************************************************************/ /* Initialize the user_connect static member. */ /****************************************************************************/ PCONNECT user_connect::to_users= NULL; +/****************************************************************************/ +/* Get the work_size SESSION variable value . */ +/****************************************************************************/ +uint GetWorkSize(void); +void SetWorkSize(uint); + /* -------------------------- class user_connect -------------------------- */ /****************************************************************************/ @@ -91,6 +94,7 @@ user_connect::~user_connect() bool user_connect::user_init() { // Initialize Plug-like environment + uint worksize= GetWorkSize(); PACTIVITY ap= NULL; PDBUSER dup= NULL; @@ -143,6 +147,8 @@ void user_connect::SetHandler(ha_connect *hc) bool user_connect::CheckCleanup(void) { if (thdp->query_id > last_query_id) { + uint worksize= GetWorkSize(); + PlugCleanup(g, true); if (g->Sarea_Size != worksize) { @@ -152,7 +158,7 @@ bool user_connect::CheckCleanup(void) // Check whether the work area size was changed if (!(g->Sarea = PlugAllocMem(g, worksize))) { g->Sarea = PlugAllocMem(g, g->Sarea_Size); - worksize = g->Sarea_Size; // Was too big + SetWorkSize(g->Sarea_Size); // Was too big } else g->Sarea_Size = worksize; // Ok diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index 3827deec43d..df7011583cd 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -43,7 +43,6 @@ #define CheckBlanks assert(!Blanks); #define CheckParms(V, N) ChkIndx(N); ChkTyp(V); -extern "C" int trace; extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */ /***********************************************************************/ diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 4c1c36369ef..81d00862703 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -48,7 +48,6 @@ #include "global.h" #include "plgdbsem.h" #include "preparse.h" // For DATPAR -//#include "value.h" #include "valblk.h" #define NO_FUNC // Already defined in ODBConn #include "plgcnx.h" // For DB types @@ -68,12 +67,6 @@ #define FOURYEARS 126230400 // Four years in seconds (1 leap) -/***********************************************************************/ -/* Static variables. */ -/***********************************************************************/ - -extern "C" int trace; - /***********************************************************************/ /* Initialize the DTVAL static member. */ /***********************************************************************/ @@ -91,32 +84,6 @@ PSZ strlwr(PSZ s); } #endif // !WIN32 -/***********************************************************************/ -/* Returns the bitmap representing the conditions that must not be */ -/* met when returning from TestValue for a given operator. */ -/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */ -/***********************************************************************/ -BYTE OpBmp(PGLOBAL g, OPVAL opc) - { - BYTE bt; - - switch (opc) { - case OP_IN: - case OP_EQ: bt = 0x06; break; - case OP_NE: bt = 0x01; break; - case OP_GT: bt = 0x03; break; - case OP_GE: bt = 0x02; break; - case OP_LT: bt = 0x05; break; - case OP_LE: bt = 0x04; break; - case OP_EXIST: bt = 0x00; break; - default: - sprintf(g->Message, MSG(BAD_FILTER_OP), opc); - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); - } // endswitch opc - - return bt; - } // end of OpBmp - /***********************************************************************/ /* Get a long long number from its character representation. */ /* IN p: Pointer to the numeric string */ @@ -1045,8 +1012,11 @@ TYPVAL::TYPVAL(PGLOBAL g, PSZ s, int n, int c) if (!s) { if (g) { - Strp = (char *)PlugSubAlloc(g, NULL, Len + 1); - Strp[Len] = '\0'; + if ((Strp = (char *)PlgDBSubAlloc(g, NULL, Len + 1))) + Strp[Len] = '\0'; + else + Len = 0; + } else assert(false); @@ -2454,9 +2424,11 @@ bool DTVAL::SetValue_char(char *p, int n) if (trace > 1) htrc(" setting date: '%s' -> %d\n", Sdate, Tval); - Null = false; - } else + Null = (Nullable && ndv == 0); + } else { rc = TYPVAL::SetValue_char(p, n); + Null = (Nullable && Tval == 0); + } // endif Pdtp return rc; } // end of SetValue @@ -2479,9 +2451,11 @@ void DTVAL::SetValue_psz(PSZ p) if (trace > 1) htrc(" setting date: '%s' -> %d\n", Sdate, Tval); - Null = false; - } else + Null = (Nullable && ndv == 0); + } else { TYPVAL::SetValue_psz(p); + Null = (Nullable && Tval == 0); + } // endif Pdtp } // end of SetValue @@ -2522,7 +2496,7 @@ char *DTVAL::GetCharString(char *p) } else sprintf(p, "%d", Tval); - Null = false; +//Null = false; ?????????????? return p; } // end of GetCharString @@ -2533,24 +2507,29 @@ char *DTVAL::ShowValue(char *buf, int len) { if (Pdtp) { char *p; - size_t m, n = 0; - struct tm tm, *ptm = GetGmTime(&tm); - if (Len < len) { - p = buf; - m = len; - } else { - p = Sdate; - m = Len + 1; - } // endif Len + if (!Null) { + size_t m, n = 0; + struct tm tm, *ptm = GetGmTime(&tm); + + if (Len < len) { + p = buf; + m = len; + } else { + p = Sdate; + m = Len + 1; + } // endif Len + + if (ptm) + n = strftime(p, m, Pdtp->OutFmt, ptm); + + if (!n) { + *p = '\0'; + strncat(p, "Error", m); + } // endif n - if (ptm) - n = strftime(p, m, Pdtp->OutFmt, ptm); - - if (!n) { - *p = '\0'; - strncat(p, "Error", m); - } // endif n + } else + p = ""; // DEFAULT VALUE ??? return p; } else diff --git a/storage/connect/value.h b/storage/connect/value.h index 151ddacf509..3ce7027aeeb 100644 --- a/storage/connect/value.h +++ b/storage/connect/value.h @@ -256,6 +256,7 @@ class DllExport TYPVAL: public VALUE { virtual bool FormatValue(PVAL vp, char *fmt); virtual bool SetConstFormat(PGLOBAL, FORMAT&); + protected: // Members PSZ Strp; bool Ci; // true if case insensitive @@ -283,6 +284,7 @@ class DllExport DECVAL: public TYPVAL { virtual bool IsEqual(PVAL vp, bool chktype); virtual int CompareValue(PVAL vp); + protected: // Members }; // end of class DECVAL @@ -337,6 +339,7 @@ class DllExport BINVAL: public VALUE { virtual bool FormatValue(PVAL vp, char *fmt); virtual bool SetConstFormat(PGLOBAL, FORMAT&); + protected: // Members void *Binp; char *Chrp; @@ -357,6 +360,7 @@ class DllExport DTVAL : public TYPVAL { DTVAL(PGLOBAL g, double f); // Implementation + virtual bool IsZero(void) {return Null;} virtual bool SetValue_pval(PVAL valp, bool chktype); virtual bool SetValue_char(char *p, int n); virtual void SetValue_psz(PSZ s); diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 7cc52580760..024a9c081cd 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -58,12 +58,11 @@ #endif /***********************************************************************/ -/* DB static external variables. */ +/* DB external variables. */ /***********************************************************************/ extern MBLOCK Nmblk; /* Used to initialize MBLOCK's */ -extern "C" int trace; #if defined(XMAP) -extern bool xmap; +extern my_bool xmap; #endif // XMAP /***********************************************************************/ diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp index cdc2ef9bf62..4ddd4f5b30f 100644 --- a/storage/connect/xobject.cpp +++ b/storage/connect/xobject.cpp @@ -1,186 +1,371 @@ -/************ Xobject C++ Functions Source Code File (.CPP) ************/ -/* Name: XOBJECT.CPP Version 2.3 */ -/* */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */ -/* */ -/* This file contains base XOBJECT class functions. */ -/* Also here is the implementation of the CONSTANT class. */ -/***********************************************************************/ - -/***********************************************************************/ -/* Include mariaDB header file. */ -/***********************************************************************/ -#include "my_global.h" - -/***********************************************************************/ -/* Include required application header files */ -/* global.h is header containing all global Plug declarations. */ -/* plgdbsem.h is header containing the DB applic. declarations. */ -/***********************************************************************/ -#include "global.h" -#include "plgdbsem.h" -#include "xobject.h" - -/***********************************************************************/ -/* Macro definitions. */ -/***********************************************************************/ -#if defined(_DEBUG) || defined(DEBTRACE) -#define ASSERT(B) assert(B); -#else -#define ASSERT(B) -#endif - -/***********************************************************************/ -/* The one and only needed void object. */ -/***********************************************************************/ -XVOID Xvoid; -PXOB const pXVOID = &Xvoid; // Pointer used by other classes - -/* ------------------------- Class XOBJECT --------------------------- */ - -/***********************************************************************/ -/* GetCharValue: returns the Result value as a char string. */ -/* Using GetCharValue provides no conversion from numeric types. */ -/***********************************************************************/ -PSZ XOBJECT::GetCharValue(void) - { - ASSERT(Value) - return Value->GetCharValue(); - } // end of GetCharValue() - -/***********************************************************************/ -/* GetShortValue: returns the Result value as a short integer. */ -/***********************************************************************/ -short XOBJECT::GetShortValue(void) - { - ASSERT(Value) - return Value->GetShortValue(); - } // end of GetShortValue - -/***********************************************************************/ -/* GetIntValue: returns the Result value as a int integer. */ -/***********************************************************************/ -int XOBJECT::GetIntValue(void) - { - ASSERT(Value) - return Value->GetIntValue(); - } // end of GetIntValue - -/***********************************************************************/ -/* GetFloatValue: returns the Result value as a double float. */ -/***********************************************************************/ -double XOBJECT::GetFloatValue(void) - { - ASSERT(Value) - return Value->GetFloatValue(); - } // end of GetFloatValue - -/* ------------------------- Class CONSTANT -------------------------- */ - -/***********************************************************************/ -/* CONSTANT public constructor. */ -/***********************************************************************/ -CONSTANT::CONSTANT(PGLOBAL g, void *value, short type) - { - if (!(Value = AllocateValue(g, value, (int)type))) - longjmp(g->jumper[g->jump_level], TYPE_CONST); - - Constant = true; - } // end of CONSTANT constructor - -/***********************************************************************/ -/* CONSTANT public constructor. */ -/***********************************************************************/ -CONSTANT::CONSTANT(PGLOBAL g, int n) - { - if (!(Value = AllocateValue(g, &n, TYPE_INT))) - longjmp(g->jumper[g->jump_level], TYPE_CONST); - - Constant = true; - } // end of CONSTANT constructor - -/***********************************************************************/ -/* GetLengthEx: returns an evaluation of the constant string length. */ -/* Note: When converting from token to string, length has to be */ -/* specified but we need the domain length, not the value length. */ -/***********************************************************************/ -int CONSTANT::GetLengthEx(void) - { - return Value->GetValLen(); - } // end of GetLengthEx - -/***********************************************************************/ -/* Convert a constant to the given type. */ -/***********************************************************************/ -void CONSTANT::Convert(PGLOBAL g, int newtype) - { - if (Value->GetType() != newtype) - if (!(Value = AllocateValue(g, Value, newtype))) - longjmp(g->jumper[g->jump_level], TYPE_CONST); - - } // end of Convert - -/***********************************************************************/ -/* Compare: returns true if this object is equivalent to xp. */ -/***********************************************************************/ -bool CONSTANT::Compare(PXOB xp) - { - if (this == xp) - return true; - else if (xp->GetType() != TYPE_CONST) - return false; - else - return Value->IsEqual(xp->GetValue(), true); - - } // end of Compare - -#if 0 -/***********************************************************************/ -/* Rephrase: temporary implementation used by PlugRephraseSQL. */ -/***********************************************************************/ -bool CONSTANT::Rephrase(PGLOBAL g, PSZ work) - { - switch (Value->GetType()) { - case TYPE_STRING: - sprintf(work + strlen(work), "'%s'", Value->GetCharValue()); - break; - case TYPE_SHORT: - sprintf(work + strlen(work), "%hd", Value->GetShortValue()); - break; - case TYPE_INT: - case TYPE_DATE: - sprintf(work + strlen(work), "%d", Value->GetIntValue()); - break; - case TYPE_DOUBLE: - sprintf(work + strlen(work), "%lf", Value->GetFloatValue()); - break; - case TYPE_BIGINT: - sprintf(work + strlen(work), "%lld", Value->GetBigintValue()); - break; - case TYPE_TINY: - sprintf(work + strlen(work), "%d", Value->GetTinyValue()); - break; - default: - sprintf(g->Message, MSG(BAD_CONST_TYPE), Value->GetType()); - return false; - } // endswitch - - return false; - } // end of Rephrase -#endif // 0 - -/***********************************************************************/ -/* Make file output of a constant object. */ -/***********************************************************************/ -void CONSTANT::Print(PGLOBAL g, FILE *f, uint n) - { - Value->Print(g, f, n); - } /* end of Print */ - -/***********************************************************************/ -/* Make string output of a constant object. */ -/***********************************************************************/ -void CONSTANT::Print(PGLOBAL g, char *ps, uint z) - { - Value->Print(g, ps, z); - } /* end of Print */ +/************ Xobject C++ Functions Source Code File (.CPP) ************/ +/* Name: XOBJECT.CPP Version 2.4 */ +/* */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */ +/* */ +/* This file contains base XOBJECT class functions. */ +/* Also here is the implementation of the CONSTANT class. */ +/***********************************************************************/ + +/***********************************************************************/ +/* Include mariaDB header file. */ +/***********************************************************************/ +#include "my_global.h" + +/***********************************************************************/ +/* Include required application header files */ +/* global.h is header containing all global Plug declarations. */ +/* plgdbsem.h is header containing the DB applic. declarations. */ +/***********************************************************************/ +#include "global.h" +#include "plgdbsem.h" +#include "xobject.h" + +/***********************************************************************/ +/* Macro definitions. */ +/***********************************************************************/ +#if defined(_DEBUG) || defined(DEBTRACE) +#define ASSERT(B) assert(B); +#else +#define ASSERT(B) +#endif + +/***********************************************************************/ +/* The one and only needed void object. */ +/***********************************************************************/ +XVOID Xvoid; +PXOB const pXVOID = &Xvoid; // Pointer used by other classes + +/* ------------------------- Class XOBJECT --------------------------- */ + +/***********************************************************************/ +/* GetCharValue: returns the Result value as a char string. */ +/* Using GetCharValue provides no conversion from numeric types. */ +/***********************************************************************/ +PSZ XOBJECT::GetCharValue(void) + { + ASSERT(Value) + return Value->GetCharValue(); + } // end of GetCharValue() + +/***********************************************************************/ +/* GetShortValue: returns the Result value as a short integer. */ +/***********************************************************************/ +short XOBJECT::GetShortValue(void) + { + ASSERT(Value) + return Value->GetShortValue(); + } // end of GetShortValue + +/***********************************************************************/ +/* GetIntValue: returns the Result value as a int integer. */ +/***********************************************************************/ +int XOBJECT::GetIntValue(void) + { + ASSERT(Value) + return Value->GetIntValue(); + } // end of GetIntValue + +/***********************************************************************/ +/* GetFloatValue: returns the Result value as a double float. */ +/***********************************************************************/ +double XOBJECT::GetFloatValue(void) + { + ASSERT(Value) + return Value->GetFloatValue(); + } // end of GetFloatValue + +/* ------------------------- Class CONSTANT -------------------------- */ + +/***********************************************************************/ +/* CONSTANT public constructor. */ +/***********************************************************************/ +CONSTANT::CONSTANT(PGLOBAL g, void *value, short type) + { + if (!(Value = AllocateValue(g, value, (int)type))) + longjmp(g->jumper[g->jump_level], TYPE_CONST); + + Constant = true; + } // end of CONSTANT constructor + +/***********************************************************************/ +/* CONSTANT public constructor. */ +/***********************************************************************/ +CONSTANT::CONSTANT(PGLOBAL g, int n) + { + if (!(Value = AllocateValue(g, &n, TYPE_INT))) + longjmp(g->jumper[g->jump_level], TYPE_CONST); + + Constant = true; + } // end of CONSTANT constructor + +/***********************************************************************/ +/* GetLengthEx: returns an evaluation of the constant string length. */ +/* Note: When converting from token to string, length has to be */ +/* specified but we need the domain length, not the value length. */ +/***********************************************************************/ +int CONSTANT::GetLengthEx(void) + { + return Value->GetValLen(); + } // end of GetLengthEx + +/***********************************************************************/ +/* Convert a constant to the given type. */ +/***********************************************************************/ +void CONSTANT::Convert(PGLOBAL g, int newtype) + { + if (Value->GetType() != newtype) + if (!(Value = AllocateValue(g, Value, newtype))) + longjmp(g->jumper[g->jump_level], TYPE_CONST); + + } // end of Convert + +/***********************************************************************/ +/* Compare: returns true if this object is equivalent to xp. */ +/***********************************************************************/ +bool CONSTANT::Compare(PXOB xp) + { + if (this == xp) + return true; + else if (xp->GetType() != TYPE_CONST) + return false; + else + return Value->IsEqual(xp->GetValue(), true); + + } // end of Compare + +#if 0 +/***********************************************************************/ +/* Rephrase: temporary implementation used by PlugRephraseSQL. */ +/***********************************************************************/ +bool CONSTANT::Rephrase(PGLOBAL g, PSZ work) + { + switch (Value->GetType()) { + case TYPE_STRING: + sprintf(work + strlen(work), "'%s'", Value->GetCharValue()); + break; + case TYPE_SHORT: + sprintf(work + strlen(work), "%hd", Value->GetShortValue()); + break; + case TYPE_INT: + case TYPE_DATE: + sprintf(work + strlen(work), "%d", Value->GetIntValue()); + break; + case TYPE_DOUBLE: + sprintf(work + strlen(work), "%lf", Value->GetFloatValue()); + break; + case TYPE_BIGINT: + sprintf(work + strlen(work), "%lld", Value->GetBigintValue()); + break; + case TYPE_TINY: + sprintf(work + strlen(work), "%d", Value->GetTinyValue()); + break; + default: + sprintf(g->Message, MSG(BAD_CONST_TYPE), Value->GetType()); + return false; + } // endswitch + + return false; + } // end of Rephrase +#endif // 0 + +/***********************************************************************/ +/* Make file output of a constant object. */ +/***********************************************************************/ +void CONSTANT::Print(PGLOBAL g, FILE *f, uint n) + { + Value->Print(g, f, n); + } /* end of Print */ + +/***********************************************************************/ +/* Make string output of a constant object. */ +/***********************************************************************/ +void CONSTANT::Print(PGLOBAL g, char *ps, uint z) + { + Value->Print(g, ps, z); + } /* end of Print */ + +/* -------------------------- Class STRING --------------------------- */ + +/***********************************************************************/ +/* STRING public constructor for new char values. Alloc Size must be */ +/* calculated because PlugSubAlloc rounds up size to multiple of 8. */ +/***********************************************************************/ +STRING::STRING(PGLOBAL g, uint n, char *str) +{ + G = g; + Length = (str) ? strlen(str) : 0; + + if ((Strp = (PSZ)PlgDBSubAlloc(g, NULL, MY_MAX(n, Length) + 1))) { + if (str) + strcpy(Strp, str); + else + *Strp = 0; + + Next = GetNext(); + Size = Next - Strp; + } else { + // This should normally never happen + Next = NULL; + Size = 0; + } // endif Strp + +} // end of STRING constructor + +/***********************************************************************/ +/* Reallocate the string memory and return the (new) position. */ +/* If Next is equal to GetNext() this means that no new suballocation */ +/* has been done. Then we can just increase the size of the current */ +/* allocation and the Strp will remain pointing to the same memory. */ +/***********************************************************************/ +char *STRING::Realloc(uint len) +{ + char *p; + bool b = (Next == GetNext()); + + p = (char*)PlgDBSubAlloc(G, NULL, b ? len - Size : len); + + if (!p) { + // No more room in Sarea; this is very unlikely + strcpy(G->Message, "No more room in work area"); + return NULL; + } // endif p + + if (b) + p = Strp; + + Next = GetNext(); + Size = Next - p; + return p; +} // end of Realloc + +/***********************************************************************/ +/* Set a STRING new PSZ value. */ +/***********************************************************************/ +bool STRING::Set(PSZ s) +{ + if (!s) + return false; + + uint len = strlen(s) + 1; + + if (len > Size) { + char *p = Realloc(len); + + if (!p) + return true; + else + Strp = p; + + } // endif n + + strcpy(Strp, s); + Length = len - 1; + return false; +} // end of Set + +/***********************************************************************/ +/* Set a STRING new PSZ value. */ +/***********************************************************************/ +bool STRING::Set(char *s, uint n) +{ + if (!s) + return false; + + uint len = strnlen(s, n) + 1; + + if (len > Size) { + char *p = Realloc(len); + + if (!p) + return true; + else + Strp = p; + + } // endif n + + strncpy(Strp, s, n); + Length = len - 1; + return false; +} // end of Set + +/***********************************************************************/ +/* Append a PSZ to a STRING. */ +/***********************************************************************/ +bool STRING::Append(PSZ s) +{ + if (!s) + return false; + + uint len = Length + strlen(s) + 1; + + if (len > Size) { + char *p = Realloc(len); + + if (!p) + return true; + else if (p != Strp) { + strcpy(p, Strp); + Strp = p; + } // endif p + + } // endif n + + strcpy(Strp + Length, s); + Length = len - 1; + return false; +} // end of Append + +/***********************************************************************/ +/* Append a STRING to a STRING. */ +/***********************************************************************/ +bool STRING::Append(STRING &str) +{ + return Append(str.GetStr()); +} // end of Append + +/***********************************************************************/ +/* Append a char to a STRING. */ +/***********************************************************************/ +bool STRING::Append(char c) +{ + if (Length + 2 > Size) { + char *p = Realloc(Length + 2); + + if (!p) + return true; + else if (p != Strp) { + strcpy(p, Strp); + Strp = p; + } // endif p + + } // endif n + + Strp[Length++] = c; + Strp[Length] = 0; + return false; +} // end of Append + +/***********************************************************************/ +/* Resize to given length but only when last suballocated. */ +/* New size should be greater than string length. */ +/***********************************************************************/ +bool STRING::Resize(uint newsize) +{ + if (Next == GetNext() && newsize > Length) { + uint nsz = (((signed)newsize + 7) / 8) * 8; + int diff = (signed)Size - (signed)nsz; + PPOOLHEADER pp = (PPOOLHEADER)G->Sarea; + + if ((signed)pp->FreeBlk + diff < 0) + return true; // Out of memory + + pp->To_Free -= diff; + pp->FreeBlk += diff; + Size = nsz; + return false; + } else + return newsize > Size; + +} // end of Resize + diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h index 1621b4e82ff..bb7b0150ed8 100644 --- a/storage/connect/xobject.h +++ b/storage/connect/xobject.h @@ -1,119 +1,159 @@ -/*************** Xobject H Declares Source Code File (.H) **************/ -/* Name: XOBJECT.H Version 2.4 */ -/* */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */ -/* */ -/* This file contains the XOBJECT and derived classes declares. */ -/***********************************************************************/ - -#ifndef __XOBJECT__H -#define __XOBJECT__H - -/***********************************************************************/ -/* Include required application header files */ -/* block.h is header containing Block global declarations. */ -/***********************************************************************/ -#include "block.h" -#include "valblk.h" // includes value.h - -/***********************************************************************/ -/* Types used in some class definitions. */ -/***********************************************************************/ -//typedef struct _tabdesc *PTABD; // For friend setting - -/***********************************************************************/ -/* The pointer to the one and only needed void object. */ -/***********************************************************************/ -extern PXOB const pXVOID; - -/***********************************************************************/ -/* Class XOBJECT is the base class for all classes that can be used */ -/* in evaluation operations: FILTER, EXPRESSION, SCALF, FNC, COLBLK, */ -/* SELECT, FILTER as well as all the constant object types. */ -/***********************************************************************/ -class DllExport XOBJECT : public BLOCK { - public: - XOBJECT(void) {Value = NULL; Constant = false;} - - // Implementation - PVAL GetValue(void) {return Value;} - bool IsConstant(void) {return Constant;} - virtual int GetType(void) {return TYPE_XOBJECT;} - virtual int GetResultType(void) {return TYPE_VOID;} - virtual int GetKey(void) {return 0;} -#if defined(_DEBUG) - virtual void SetKey(int k) {assert(false);} -#else // !_DEBUG - virtual void SetKey(int k) {} // Only defined for COLBLK -#endif // !_DEBUG - virtual int GetLength(void) = 0; - virtual int GetLengthEx(void) = 0; - virtual PSZ GetCharValue(void); - virtual short GetShortValue(void); - virtual int GetIntValue(void); - virtual double GetFloatValue(void); - virtual int GetScale(void) = 0; - - // Methods - virtual void Reset(void) {} - virtual bool Compare(PXOB) = 0; - virtual bool Init(PGLOBAL) {return false;} - virtual bool Eval(PGLOBAL) {return false;} - virtual bool SetFormat(PGLOBAL, FORMAT&) = 0; - - protected: - PVAL Value; // The current value of the object. - bool Constant; // true for an object having a constant value. - }; // end of class XOBJECT - -/***********************************************************************/ -/* Class XVOID: represent a void (null) object. */ -/* Used to represent a void parameter for count(*) or for a filter. */ -/***********************************************************************/ -class DllExport XVOID : public XOBJECT { - public: - XVOID(void) {Constant = true;} - - // Implementation - virtual int GetType(void) {return TYPE_VOID;} - virtual int GetLength(void) {return 0;} - virtual int GetLengthEx(void) {return 0;} - virtual PSZ GetCharValue(void) {return NULL;} - virtual int GetIntValue(void) {return 0;} - virtual double GetFloatValue(void) {return 0.0;} - virtual int GetScale() {return 0;} - - // Methods - virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;} - virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;} - }; // end of class XVOID - - -/***********************************************************************/ -/* Class CONSTANT: represents a constant XOBJECT of any value type. */ -/* Note that the CONSTANT class is a friend of the VALUE class; */ -/***********************************************************************/ -class DllExport CONSTANT : public XOBJECT { - public: - CONSTANT(PGLOBAL g, void *value, short type); - CONSTANT(PGLOBAL g, int n); - CONSTANT(PVAL valp) {Value = valp; Constant = true;} - - // Implementation - virtual int GetType(void) {return TYPE_CONST;} - virtual int GetResultType(void) {return Value->Type;} - virtual int GetLength(void) {return Value->GetValLen();} - virtual int GetScale() {return Value->GetValPrec();} - virtual int GetLengthEx(void); - - // Methods - virtual bool Compare(PXOB xp); - virtual bool SetFormat(PGLOBAL g, FORMAT& fmt) - {return Value->SetConstFormat(g, fmt);} - void Convert(PGLOBAL g, int newtype); - void SetValue(PVAL vp) {Value = vp;} - virtual void Print(PGLOBAL g, FILE *, uint); - virtual void Print(PGLOBAL g, char *, uint); - }; // end of class CONSTANT - -#endif +/*************** Xobject H Declares Source Code File (.H) **************/ +/* Name: XOBJECT.H Version 2.4 */ +/* */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */ +/* */ +/* This file contains the XOBJECT and derived classes declares. */ +/***********************************************************************/ + +#ifndef __XOBJECT__H +#define __XOBJECT__H + +/***********************************************************************/ +/* Include required application header files */ +/* block.h is header containing Block global declarations. */ +/***********************************************************************/ +#include "block.h" +#include "valblk.h" // includes value.h + +/***********************************************************************/ +/* Types used in some class definitions. */ +/***********************************************************************/ +typedef class STRING *PSTRG; + +/***********************************************************************/ +/* The pointer to the one and only needed void object. */ +/***********************************************************************/ +extern PXOB const pXVOID; + +/***********************************************************************/ +/* Class XOBJECT is the base class for all classes that can be used */ +/* in evaluation operations: FILTER, EXPRESSION, SCALF, FNC, COLBLK, */ +/* SELECT, FILTER as well as all the constant object types. */ +/***********************************************************************/ +class DllExport XOBJECT : public BLOCK { + public: + XOBJECT(void) {Value = NULL; Constant = false;} + + // Implementation + PVAL GetValue(void) {return Value;} + bool IsConstant(void) {return Constant;} + virtual int GetType(void) {return TYPE_XOBJECT;} + virtual int GetResultType(void) {return TYPE_VOID;} + virtual int GetKey(void) {return 0;} +#if defined(_DEBUG) + virtual void SetKey(int k) {assert(false);} +#else // !_DEBUG + virtual void SetKey(int k) {} // Only defined for COLBLK +#endif // !_DEBUG + virtual int GetLength(void) = 0; + virtual int GetLengthEx(void) = 0; + virtual PSZ GetCharValue(void); + virtual short GetShortValue(void); + virtual int GetIntValue(void); + virtual double GetFloatValue(void); + virtual int GetScale(void) = 0; + + // Methods + virtual void Reset(void) {} + virtual bool Compare(PXOB) = 0; + virtual bool Init(PGLOBAL) {return false;} + virtual bool Eval(PGLOBAL) {return false;} + virtual bool SetFormat(PGLOBAL, FORMAT&) = 0; + + protected: + PVAL Value; // The current value of the object. + bool Constant; // true for an object having a constant value. + }; // end of class XOBJECT + +/***********************************************************************/ +/* Class XVOID: represent a void (null) object. */ +/* Used to represent a void parameter for count(*) or for a filter. */ +/***********************************************************************/ +class DllExport XVOID : public XOBJECT { + public: + XVOID(void) {Constant = true;} + + // Implementation + virtual int GetType(void) {return TYPE_VOID;} + virtual int GetLength(void) {return 0;} + virtual int GetLengthEx(void) {return 0;} + virtual PSZ GetCharValue(void) {return NULL;} + virtual int GetIntValue(void) {return 0;} + virtual double GetFloatValue(void) {return 0.0;} + virtual int GetScale() {return 0;} + + // Methods + virtual bool Compare(PXOB xp) {return xp->GetType() == TYPE_VOID;} + virtual bool SetFormat(PGLOBAL, FORMAT&) {return true;} + }; // end of class XVOID + + +/***********************************************************************/ +/* Class CONSTANT: represents a constant XOBJECT of any value type. */ +/* Note that the CONSTANT class is a friend of the VALUE class; */ +/***********************************************************************/ +class DllExport CONSTANT : public XOBJECT { + public: + CONSTANT(PGLOBAL g, void *value, short type); + CONSTANT(PGLOBAL g, int n); + CONSTANT(PVAL valp) {Value = valp; Constant = true;} + + // Implementation + virtual int GetType(void) {return TYPE_CONST;} + virtual int GetResultType(void) {return Value->Type;} + virtual int GetLength(void) {return Value->GetValLen();} + virtual int GetScale() {return Value->GetValPrec();} + virtual int GetLengthEx(void); + + // Methods + virtual bool Compare(PXOB xp); + virtual bool SetFormat(PGLOBAL g, FORMAT& fmt) + {return Value->SetConstFormat(g, fmt);} + void Convert(PGLOBAL g, int newtype); + void SetValue(PVAL vp) {Value = vp;} + virtual void Print(PGLOBAL g, FILE *, uint); + virtual void Print(PGLOBAL g, char *, uint); + }; // end of class CONSTANT + +/***********************************************************************/ +/* Class STRING handles variable length char strings. */ +/* It is mainly used to avoid buffer overrun. */ +/***********************************************************************/ +class DllExport STRING : public BLOCK { + public: + // Constructor + STRING(PGLOBAL g, uint n, PSZ str = NULL); + + // Implementation + inline int GetLength(void) {return (int)Length;} + inline PSZ GetStr(void) {return Strp;} + inline uint32 GetSize(void) {return Size;} + + // Methods + inline void Reset(void) {*Strp = 0;} + bool Set(PSZ s); + bool Set(char *s, uint n); + bool Append(PSZ s); + bool Append(STRING &str); + bool Append(char c); + bool Resize(uint n); + inline void Trim(void) {(void)Resize(Length + 1);} + inline void Chop(void) {if (Length) Strp[--Length] = 0;} + inline void RepLast(char c) {if (Length) Strp[Length-1] = c;} + inline void Truncate(uint n) {if (n < Length) {Strp[n] = 0; Length = n;}} + + protected: + char *Realloc(uint len); + inline char *GetNext(void) + {return ((char*)G->Sarea)+((PPOOLHEADER)G->Sarea)->To_Free;} + + // Members + PGLOBAL G; // To avoid parameter + PSZ Strp; // The char string + uint Length; // String length + uint Size; // Allocated size + char *Next; // Next alloc position + }; // end of class STRING + +#endif diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index 628ab96135d..49fbbb0de26 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -83,6 +83,7 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block. // Methods virtual bool IsSame(PTDB tp) {return tp == this;} + virtual bool IsSpecial(PSZ name) = 0; virtual bool GetBlockValues(PGLOBAL g) {return false;} virtual int Cardinality(PGLOBAL g) {return 0;} virtual int GetMaxSize(PGLOBAL) = 0; @@ -158,6 +159,7 @@ class DllExport TDBASE : public TDB { // Methods virtual bool IsUsingTemp(PGLOBAL g) {return false;} virtual bool IsIndexed(void) {return false;} + virtual bool IsSpecial(PSZ name); virtual PCATLG GetCat(void); virtual PSZ GetPath(void); virtual void PrintAM(FILE *f, char *m); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 9db78065bb3..92ac20a8f82 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -41,10 +41,9 @@ TODO: -Brian */ -#include "my_global.h" +#include #include "sql_priv.h" #include "sql_class.h" // SSV -#include #include #include "ha_tina.h" #include "probes_mysql.h" diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc index a307f9885c0..1f1123aefc2 100644 --- a/storage/csv/transparent_file.cc +++ b/storage/csv/transparent_file.cc @@ -17,6 +17,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include "sql_priv.h" #include #include "transparent_file.h" diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index a671dfb1f89..3a5b269e79f 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -98,6 +98,7 @@ #pragma implementation // gcc: Class implementation #endif +#include #include #include "ha_example.h" #include "sql_class.h" diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 4608aedd129..6d3d665b9f1 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -372,6 +372,7 @@ #define MYSQL_SERVER 1 +#include #include "sql_priv.h" #include "sql_servers.h" // FOREIGN_SERVER, get_server_by_name #include "sql_class.h" // SSV diff --git a/storage/federatedx/federatedx_io.cc b/storage/federatedx/federatedx_io.cc index 34d3dde3ebb..1e0348e3bf8 100644 --- a/storage/federatedx/federatedx_io.cc +++ b/storage/federatedx/federatedx_io.cc @@ -28,8 +28,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*#define MYSQL_SERVER 1*/ +#include #include "sql_priv.h" -#include #include "ha_federatedx.h" diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc index 2933073a679..1ff6abc4c77 100644 --- a/storage/federatedx/federatedx_io_mysql.cc +++ b/storage/federatedx/federatedx_io_mysql.cc @@ -28,8 +28,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define MYSQL_SERVER 1 +#include #include "sql_priv.h" -#include #include "ha_federatedx.h" diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc index 4322422ef37..aa35d4bdecc 100644 --- a/storage/federatedx/federatedx_io_null.cc +++ b/storage/federatedx/federatedx_io_null.cc @@ -28,8 +28,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /*#define MYSQL_SERVER 1*/ +#include #include "sql_priv.h" -#include #include "ha_federatedx.h" diff --git a/storage/federatedx/federatedx_txn.cc b/storage/federatedx/federatedx_txn.cc index 5049b1ff79f..232ac335dfc 100644 --- a/storage/federatedx/federatedx_txn.cc +++ b/storage/federatedx/federatedx_txn.cc @@ -31,8 +31,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #define MYSQL_SERVER 1 +#include #include "sql_priv.h" -#include #include "ha_federatedx.h" diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 8d41ca2d1b3..70201167fde 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -312,6 +312,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #define MYSQL_SERVER 1 +#include #include #include "ha_federatedx.h" #include "sql_servers.h" diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 5631d60a10a..3ad5c6e9e0a 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -20,6 +20,7 @@ #endif #define MYSQL_SERVER 1 +#include #include "sql_priv.h" #include "sql_plugin.h" #include "ha_heap.h" diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index 993d3377b73..aba7e8383da 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -878,12 +878,17 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, /* Convert NULL from MySQL representation into HEAP's. */ if (!(*key++= (char) 1 - *old++)) { +#if 0 /* Skip length part of a variable length field. Length of key-part used with heap_rkey() always 2. See also hp_hashnr(). */ if (seg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART)) +#else + /* Add key pack length (2) to key for VARCHAR segments */ + if (seg->type == HA_KEYTYPE_VARTEXT1) +#endif old+= 2; continue; } diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc index a060cbc7270..3859fb84b81 100644 --- a/storage/innobase/api/api0api.cc +++ b/storage/innobase/api/api0api.cc @@ -205,9 +205,9 @@ struct ib_tuple_t { }; /** The following counter is used to convey information to InnoDB -about server activity: in selects it is not sensible to call -srv_active_wake_master_thread after each fetch or search, we only do -it every INNOBASE_WAKE_INTERVAL'th step. */ +about server activity: in case of normal DML ops it is not +sensible to call srv_active_wake_master_thread after each +operation, we only do it every INNOBASE_WAKE_INTERVAL'th step. */ #define INNOBASE_WAKE_INTERVAL 32 @@ -427,7 +427,7 @@ ib_read_tuple( data = btr_rec_copy_externally_stored_field( copy, offsets, zip_size, i, &len, - tuple->heap); + tuple->heap, NULL); ut_a(len != UNIV_SQL_NULL); } @@ -707,8 +707,6 @@ ib_trx_rollback( /* It should always succeed */ ut_a(err == DB_SUCCESS); - ib_wake_master_thread(); - return(err); } @@ -1531,7 +1529,11 @@ ib_execute_insert_query_graph( dict_table_n_rows_inc(table); - srv_stats.n_rows_inserted.inc(); + if (table->is_system_db) { + srv_stats.n_system_rows_inserted.inc(); + } else { + srv_stats.n_rows_inserted.inc(); + } } trx->op_info = ""; @@ -1654,7 +1656,7 @@ ib_cursor_insert_row( src_tuple->index->table, q_proc->grph.ins, node->ins); } - srv_active_wake_master_thread(); + ib_wake_master_thread(); return(err); } @@ -1885,9 +1887,17 @@ ib_execute_update_query_graph( dict_table_n_rows_dec(table); - srv_stats.n_rows_deleted.inc(); + if (table->is_system_db) { + srv_stats.n_system_rows_deleted.inc(); + } else { + srv_stats.n_rows_deleted.inc(); + } } else { - srv_stats.n_rows_updated.inc(); + if (table->is_system_db) { + srv_stats.n_system_rows_updated.inc(); + } else { + srv_stats.n_rows_updated.inc(); + } } } else if (err == DB_RECORD_NOT_FOUND) { @@ -1940,7 +1950,7 @@ ib_cursor_update_row( err = ib_execute_update_query_graph(cursor, pcur); } - srv_active_wake_master_thread(); + ib_wake_master_thread(); return(err); } @@ -2082,7 +2092,7 @@ ib_cursor_delete_row( err = DB_RECORD_NOT_FOUND; } - srv_active_wake_master_thread(); + ib_wake_master_thread(); return(err); } diff --git a/storage/innobase/api/api0misc.cc b/storage/innobase/api/api0misc.cc index b2370105938..a980d32c33f 100644 --- a/storage/innobase/api/api0misc.cc +++ b/storage/innobase/api/api0misc.cc @@ -24,6 +24,7 @@ InnoDB Native API 3/20/2011 Jimmy Yang extracted from Embedded InnoDB *******************************************************/ +#include #include #ifdef HAVE_UNISTD_H diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 0136c9c43a3..79b533481b7 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2802,6 +2802,134 @@ btr_page_tuple_smaller( return(cmp_dtuple_rec(tuple, first_rec, *offsets) < 0); } +/** Insert the tuple into the right sibling page, if the cursor is at the end +of a page. +@param[in] flags undo logging and locking flags +@param[in,out] cursor cursor at which to insert; when the function succeeds, + the cursor is positioned before the insert point. +@param[out] offsets offsets on inserted record +@param[in,out] heap memory heap for allocating offsets +@param[in] tuple tuple to insert +@param[in] n_ext number of externally stored columns +@param[in,out] mtr mini-transaction +@return inserted record (first record on the right sibling page); + the cursor will be positioned on the page infimum +@retval NULL if the operation was not performed */ +static +rec_t* +btr_insert_into_right_sibling( + ulint flags, + btr_cur_t* cursor, + ulint** offsets, + mem_heap_t* heap, + const dtuple_t* tuple, + ulint n_ext, + mtr_t* mtr) +{ + buf_block_t* block = btr_cur_get_block(cursor); + page_t* page = buf_block_get_frame(block); + ulint next_page_no = btr_page_get_next(page, mtr); + + ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(cursor->index), + MTR_MEMO_X_LOCK)); + ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); + ut_ad(heap); + + if (next_page_no == FIL_NULL || !page_rec_is_supremum( + page_rec_get_next(btr_cur_get_rec(cursor)))) { + + return(NULL); + } + + page_cur_t next_page_cursor; + buf_block_t* next_block; + page_t* next_page; + btr_cur_t next_father_cursor; + rec_t* rec = NULL; + ulint zip_size = buf_block_get_zip_size(block); + ulint max_size; + + next_block = btr_block_get( + buf_block_get_space(block), zip_size, + next_page_no, RW_X_LATCH, cursor->index, mtr); + next_page = buf_block_get_frame(next_block); + + bool is_leaf = page_is_leaf(next_page); + + btr_page_get_father( + cursor->index, next_block, mtr, &next_father_cursor); + + page_cur_search( + next_block, cursor->index, tuple, PAGE_CUR_LE, + &next_page_cursor); + + max_size = page_get_max_insert_size_after_reorganize(next_page, 1); + + /* Extends gap lock for the next page */ + lock_update_split_left(next_block, block); + + rec = page_cur_tuple_insert( + &next_page_cursor, tuple, cursor->index, offsets, &heap, + n_ext, mtr); + + if (rec == NULL) { + if (zip_size && is_leaf + && !dict_index_is_clust(cursor->index)) { + /* Reset the IBUF_BITMAP_FREE bits, because + page_cur_tuple_insert() will have attempted page + reorganize before failing. */ + ibuf_reset_free_bits(next_block); + } + return(NULL); + } + + ibool compressed; + dberr_t err; + ulint level = btr_page_get_level(next_page, mtr); + + /* adjust cursor position */ + *btr_cur_get_page_cur(cursor) = next_page_cursor; + + ut_ad(btr_cur_get_rec(cursor) == page_get_infimum_rec(next_page)); + ut_ad(page_rec_get_next(page_get_infimum_rec(next_page)) == rec); + + /* We have to change the parent node pointer */ + + compressed = btr_cur_pessimistic_delete( + &err, TRUE, &next_father_cursor, + BTR_CREATE_FLAG, RB_NONE, mtr); + + ut_a(err == DB_SUCCESS); + + if (!compressed) { + btr_cur_compress_if_useful(&next_father_cursor, FALSE, mtr); + } + + dtuple_t* node_ptr = dict_index_build_node_ptr( + cursor->index, rec, buf_block_get_page_no(next_block), + heap, level); + + btr_insert_on_non_leaf_level( + flags, cursor->index, level + 1, node_ptr, mtr); + + ut_ad(rec_offs_validate(rec, cursor->index, *offsets)); + + if (is_leaf && !dict_index_is_clust(cursor->index)) { + /* Update the free bits of the B-tree page in the + insert buffer bitmap. */ + + if (zip_size) { + ibuf_update_free_bits_zip(next_block, mtr); + } else { + ibuf_update_free_bits_if_full( + next_block, max_size, + rec_offs_size(*offsets) + PAGE_DIR_SLOT_SIZE); + } + } + + return(rec); +} + /*************************************************************//** Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is @@ -2872,6 +3000,14 @@ func_start: ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(!page_is_empty(page)); + /* try to insert to the next page if possible before split */ + rec = btr_insert_into_right_sibling( + flags, cursor, offsets, *heap, tuple, n_ext, mtr); + + if (rec != NULL) { + return(rec); + } + page_no = buf_block_get_page_no(block); /* 1. Decide the split record; split_rec == NULL means that the diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index bd3d688a0c2..195b37d6814 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1247,7 +1247,7 @@ btr_cur_optimistic_insert( rec_t* dummy; ibool leaf; ibool reorg; - ibool inherit; + ibool inherit = TRUE; ulint zip_size; ulint rec_size; dberr_t err; @@ -1525,7 +1525,7 @@ btr_cur_pessimistic_insert( ulint zip_size = dict_table_zip_size(index->table); big_rec_t* big_rec_vec = NULL; dberr_t err; - ibool dummy_inh; + ibool inherit = FALSE; ibool success; ulint n_reserved = 0; @@ -1547,7 +1547,7 @@ btr_cur_pessimistic_insert( /* Check locks and write to undo log, if specified */ err = btr_cur_ins_lock_and_undo(flags, cursor, entry, - thr, mtr, &dummy_inh); + thr, mtr, &inherit); if (err != DB_SUCCESS) { @@ -1607,10 +1607,31 @@ btr_cur_pessimistic_insert( ut_ad(page_rec_get_next(btr_cur_get_rec(cursor)) == *rec); + if (!(flags & BTR_NO_LOCKING_FLAG)) { + /* The cursor might be moved to the other page, + and the max trx id field should be updated after + the cursor was fixed. */ + if (!dict_index_is_clust(index)) { + page_update_max_trx_id( + btr_cur_get_block(cursor), + btr_cur_get_page_zip(cursor), + thr_get_trx(thr)->id, mtr); + } + if (!page_rec_is_infimum(btr_cur_get_rec(cursor)) + || btr_page_get_prev( + buf_block_get_frame( + btr_cur_get_block(cursor)), mtr) + == FIL_NULL) { + /* split and inserted need to call + lock_update_insert() always. */ + inherit = TRUE; + } + } + #ifdef BTR_CUR_ADAPT btr_search_update_hash_on_insert(cursor); #endif - if (!(flags & BTR_NO_LOCKING_FLAG)) { + if (inherit && !(flags & BTR_NO_LOCKING_FLAG)) { lock_update_insert(btr_cur_get_block(cursor), *rec); } @@ -3610,7 +3631,8 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */ ulint mode1, /*!< in: search mode for range start */ const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */ - ulint mode2) /*!< in: search mode for range end */ + ulint mode2, /*!< in: search mode for range end */ + trx_t* trx) /*!< in: trx */ { btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS]; btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS]; @@ -3628,7 +3650,7 @@ btr_estimate_n_rows_in_range( table_n_rows = dict_table_get_n_rows(index->table); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); cursor.path_arr = path1; @@ -3646,7 +3668,7 @@ btr_estimate_n_rows_in_range( mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); cursor.path_arr = path2; @@ -3869,16 +3891,29 @@ btr_estimate_number_of_different_key_vals( ut_error; } - /* It makes no sense to test more pages than are contained - in the index, thus we lower the number if it is too high */ - if (srv_stats_transient_sample_pages > index->stat_index_size) { + if (srv_stats_sample_traditional) { + /* It makes no sense to test more pages than are contained + in the index, thus we lower the number if it is too high */ + if (srv_stats_transient_sample_pages > index->stat_index_size) { + if (index->stat_index_size > 0) { + n_sample_pages = index->stat_index_size; + } else { + n_sample_pages = 1; + } + } else { + n_sample_pages = srv_stats_transient_sample_pages; + } + } else { + /* New logaritmic number of pages that are estimated. We + first pick minimun from srv_stats_transient_sample_pages and number of + pages on index. Then we pick maximum from previous number of + pages and log2(number of index pages) * srv_stats_transient_sample_pages. */ if (index->stat_index_size > 0) { - n_sample_pages = index->stat_index_size; + n_sample_pages = ut_max(ut_min(srv_stats_transient_sample_pages, index->stat_index_size), + log2(index->stat_index_size)*srv_stats_transient_sample_pages); } else { n_sample_pages = 1; } - } else { - n_sample_pages = srv_stats_transient_sample_pages; } /* We sample some pages in the index to get an estimate */ @@ -5228,7 +5263,8 @@ btr_copy_blob_prefix( ulint len, /*!< in: length of buf, in bytes */ ulint space_id,/*!< in: space id of the BLOB pages */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset) /*!< in: offset on the first BLOB page */ + ulint offset, /*!< in: offset on the first BLOB page */ + trx_t* trx) /*!< in: transaction handle */ { ulint copied_len = 0; @@ -5240,7 +5276,7 @@ btr_copy_blob_prefix( ulint part_len; ulint copy_len; - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr); buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); @@ -5443,7 +5479,8 @@ btr_copy_externally_stored_field_prefix_low( zero for uncompressed BLOBs */ ulint space_id,/*!< in: space id of the first BLOB page */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset) /*!< in: offset on the first BLOB page */ + ulint offset, /*!< in: offset on the first BLOB page */ + trx_t* trx) /*!< in: transaction handle */ { if (UNIV_UNLIKELY(len == 0)) { return(0); @@ -5454,7 +5491,7 @@ btr_copy_externally_stored_field_prefix_low( space_id, page_no, offset)); } else { return(btr_copy_blob_prefix(buf, len, space_id, - page_no, offset)); + page_no, offset, trx)); } } @@ -5475,7 +5512,8 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len)/*!< in: length of data, in bytes */ + ulint local_len,/*!< in: length of data, in bytes */ + trx_t* trx) /*!< in: transaction handle */ { ulint space_id; ulint page_no; @@ -5514,7 +5552,7 @@ btr_copy_externally_stored_field_prefix( len - local_len, zip_size, space_id, page_no, - offset)); + offset, trx)); } /*******************************************************************//** @@ -5533,7 +5571,8 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap) /*!< in: mem heap */ + mem_heap_t* heap, /*!< in: mem heap */ + trx_t* trx) /*!< in: transaction handle */ { ulint space_id; ulint page_no; @@ -5564,7 +5603,8 @@ btr_copy_externally_stored_field( extern_len, zip_size, space_id, - page_no, offset); + page_no, offset, + trx); return(buf); } @@ -5583,7 +5623,8 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap) /*!< in: mem heap */ + mem_heap_t* heap, /*!< in: mem heap */ + trx_t* trx) /*!< in: transaction handle */ { ulint local_len; const byte* data; @@ -5614,6 +5655,7 @@ btr_rec_copy_externally_stored_field( } return(btr_copy_externally_stored_field(len, data, - zip_size, local_len, heap)); + zip_size, local_len, heap, + trx)); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 82a2b6dbf6b..01d2e1bb8e2 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -486,7 +486,7 @@ btr_pcur_move_backward_from_page( mtr_commit(mtr); - mtr_start(mtr); + mtr_start_trx(mtr, mtr->trx); btr_pcur_restore_position(latch_mode2, cursor, mtr); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 6f00d2e43b5..9fceae0f880 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -4192,6 +4192,7 @@ corrupt: " because of" " a corrupt database page.\n", stderr); + ut_error; } } @@ -4937,22 +4938,22 @@ Returns the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool. @return modified page percentage ratio */ UNIV_INTERN -ulint +double buf_get_modified_ratio_pct(void) /*============================*/ { - ulint ratio; + double percentage = 0.0; ulint lru_len = 0; ulint free_len = 0; ulint flush_list_len = 0; buf_get_total_list_len(&lru_len, &free_len, &flush_list_len); - ratio = (100 * flush_list_len) / (1 + lru_len + free_len); + percentage = (100.0 * flush_list_len) / (1.0 + lru_len + free_len); /* 1 + is there to avoid division by zero */ - return(ratio); + return(percentage); } /*******************************************************************//** @@ -5165,6 +5166,8 @@ buf_print_io_instance( "Database pages %lu\n" "Old database pages %lu\n" "Modified db pages %lu\n" + "Percent of dirty pages(LRU & free pages): %.3f\n" + "Max dirty pages percent: %.3f\n" "Pending reads %lu\n" "Pending writes: LRU %lu, flush list %lu, single page %lu\n", pool_info->pool_size, @@ -5172,6 +5175,9 @@ buf_print_io_instance( pool_info->lru_len, pool_info->old_lru_len, pool_info->flush_list_len, + (((double) pool_info->flush_list_len) / + (pool_info->lru_len + pool_info->free_list_len + 1.0)) * 100.0, + srv_max_buf_pool_modified_pct, pool_info->n_pend_reads, pool_info->n_pending_flush_lru, pool_info->n_pending_flush_list, diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index fa2edb90b8e..6b219262207 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -75,6 +75,15 @@ in thrashing. */ /* @} */ +/** Handled page counters for a single flush */ +struct flush_counters_t { + ulint flushed; /*!< number of dirty pages flushed */ + ulint evicted; /*!< number of clean pages evicted, including + evicted uncompressed page images */ + ulint unzip_LRU_evicted;/*!< number of uncompressed page images + evicted */ +}; + /******************************************************************//** Increases flush_list size in bytes with zip_size for compressed page, UNIV_PAGE_SIZE for uncompressed page in inline function */ @@ -1434,12 +1443,14 @@ it is a best effort attempt and it is not guaranteed that after a call to this function there will be 'max' blocks in the free list. @return number of blocks for which the write request was queued. */ static -ulint +void buf_flush_LRU_list_batch( /*=====================*/ buf_pool_t* buf_pool, /*!< in: buffer pool instance */ - ulint max) /*!< in: desired number of + ulint max, /*!< in: desired number of blocks in the free_list */ + flush_counters_t* n) /*!< out: flushed/evicted page + counts */ { buf_page_t* bpage; ulint count = 0; @@ -1449,8 +1460,13 @@ buf_flush_LRU_list_batch( ut_ad(buf_pool_mutex_own(buf_pool)); + n->flushed = 0; + n->evicted = 0; + n->unzip_LRU_evicted = 0; + bpage = UT_LIST_GET_LAST(buf_pool->LRU); while (bpage != NULL && count < max + && (n->flushed + n->evicted) < max && free_len < srv_LRU_scan_depth && lru_len > BUF_LRU_MIN_LEN) { @@ -1478,6 +1494,7 @@ buf_flush_LRU_list_batch( if (buf_LRU_free_page(bpage, true)) { /* buf_pool->mutex was potentially released and reacquired. */ + n->evicted++; bpage = UT_LIST_GET_LAST(buf_pool->LRU); } else { bpage = UT_LIST_GET_PREV(LRU, bpage); @@ -1500,7 +1517,7 @@ buf_flush_LRU_list_batch( } if (!buf_flush_page_and_try_neighbors( - bpage, BUF_FLUSH_LRU, max, &count)) { + bpage, BUF_FLUSH_LRU, max, &n->flushed)) { bpage = prev_bpage; } else { @@ -1529,7 +1546,7 @@ buf_flush_LRU_list_batch( /* We keep track of all flushes happening as part of LRU flush. When estimating the desired rate at which flush_list should be flushed, we factor in this value. */ - buf_lru_flush_page_count += count; + buf_lru_flush_page_count += n->flushed; ut_ad(buf_pool_mutex_own(buf_pool)); @@ -1540,8 +1557,6 @@ buf_flush_LRU_list_batch( MONITOR_LRU_BATCH_SCANNED_PER_CALL, scanned); } - - return(count); } /*******************************************************************//** @@ -1551,24 +1566,28 @@ Whether LRU or unzip_LRU is used depends on the state of the system. or in case of unzip_LRU the number of blocks actually moved to the free list */ static -ulint +void buf_do_LRU_batch( /*=============*/ buf_pool_t* buf_pool, /*!< in: buffer pool instance */ - ulint max) /*!< in: desired number of + ulint max, /*!< in: desired number of blocks in the free_list */ + flush_counters_t* n) /*!< out: flushed/evicted page + counts */ { - ulint count = 0; if (buf_LRU_evict_from_unzip_LRU(buf_pool)) { - count += buf_free_from_unzip_LRU_list_batch(buf_pool, max); + n->unzip_LRU_evicted = buf_free_from_unzip_LRU_list_batch(buf_pool, max); + } else { + n->unzip_LRU_evicted = 0; } - if (max > count) { - count += buf_flush_LRU_list_batch(buf_pool, max - count); + if (max > n->unzip_LRU_evicted) { + buf_flush_LRU_list_batch(buf_pool, max - n->unzip_LRU_evicted, n); + } else { + n->evicted = 0; + n->flushed = 0; } - - return(count); } /*******************************************************************//** @@ -1667,7 +1686,7 @@ end up waiting for these latches! NOTE 2: in the case of a flush list flush, the calling thread is not allowed to own any latches on pages! @return number of blocks for which the write request was queued */ static -ulint +void buf_flush_batch( /*============*/ buf_pool_t* buf_pool, /*!< in: buffer pool instance */ @@ -1678,13 +1697,14 @@ buf_flush_batch( ulint min_n, /*!< in: wished minimum mumber of blocks flushed (it is not guaranteed that the actual number is that big, though) */ - lsn_t lsn_limit) /*!< in: in the case of BUF_FLUSH_LIST + lsn_t lsn_limit, /*!< in: in the case of BUF_FLUSH_LIST all blocks whose oldest_modification is smaller than this should be flushed (if their number does not exceed min_n), otherwise ignored */ + flush_counters_t* n) /*!< out: flushed/evicted page + counts */ { - ulint count = 0; ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST); #ifdef UNIV_SYNC_DEBUG @@ -1698,10 +1718,11 @@ buf_flush_batch( the flush functions. */ switch (flush_type) { case BUF_FLUSH_LRU: - count = buf_do_LRU_batch(buf_pool, min_n); + buf_do_LRU_batch(buf_pool, min_n, n); break; case BUF_FLUSH_LIST: - count = buf_do_flush_list_batch(buf_pool, min_n, lsn_limit); + n->flushed = buf_do_flush_list_batch(buf_pool, min_n, lsn_limit); + n->evicted = 0; break; default: ut_error; @@ -1710,15 +1731,13 @@ buf_flush_batch( buf_pool_mutex_exit(buf_pool); #ifdef UNIV_DEBUG - if (buf_debug_prints && count > 0) { + if (buf_debug_prints && n->flushed > 0) { fprintf(stderr, flush_type == BUF_FLUSH_LRU ? "Flushed %lu pages in LRU flush\n" : "Flushed %lu pages in flush list flush\n", - (ulong) count); + (ulong) n->flushed); } #endif /* UNIV_DEBUG */ - - return(count); } /******************************************************************//** @@ -1847,29 +1866,21 @@ buf_flush_LRU( ulint min_n, /*!< in: wished minimum mumber of blocks flushed (it is not guaranteed that the actual number is that big, though) */ - ulint* n_processed) /*!< out: the number of pages - which were processed is passed - back to caller. Ignored if NULL */ + flush_counters_t *n) /*!< out: flushed/evicted page + counts */ { - ulint page_count; - - if (n_processed) { - *n_processed = 0; - } - if (!buf_flush_start(buf_pool, BUF_FLUSH_LRU)) { + n->flushed = 0; + n->evicted = 0; + n->unzip_LRU_evicted = 0; return(false); } - page_count = buf_flush_batch(buf_pool, BUF_FLUSH_LRU, min_n, 0); + buf_flush_batch(buf_pool, BUF_FLUSH_LRU, min_n, 0, n); buf_flush_end(buf_pool, BUF_FLUSH_LRU); - buf_flush_common(BUF_FLUSH_LRU, page_count); - - if (n_processed) { - *n_processed = page_count; - } + buf_flush_common(BUF_FLUSH_LRU, n->flushed); return(true); } @@ -1917,7 +1928,7 @@ buf_flush_list( /* Flush to lsn_limit in all buffer pool instances */ for (i = 0; i < srv_buf_pool_instances; i++) { buf_pool_t* buf_pool; - ulint page_count = 0; + flush_counters_t n; buf_pool = buf_pool_from_array(i); @@ -1937,23 +1948,23 @@ buf_flush_list( continue; } - page_count = buf_flush_batch( - buf_pool, BUF_FLUSH_LIST, min_n, lsn_limit); + buf_flush_batch( + buf_pool, BUF_FLUSH_LIST, min_n, lsn_limit, &n); buf_flush_end(buf_pool, BUF_FLUSH_LIST); - buf_flush_common(BUF_FLUSH_LIST, page_count); + buf_flush_common(BUF_FLUSH_LIST, n.flushed); if (n_processed) { - *n_processed += page_count; + *n_processed += n.flushed; } - if (page_count) { + if (n.flushed) { MONITOR_INC_VALUE_CUMULATIVE( MONITOR_FLUSH_BATCH_TOTAL_PAGE, MONITOR_FLUSH_BATCH_COUNT, MONITOR_FLUSH_BATCH_PAGES, - page_count); + n.flushed); } } @@ -2091,7 +2102,7 @@ buf_flush_LRU_tail(void) j < scan_depth; j += PAGE_CLEANER_LRU_BATCH_CHUNK_SIZE) { - ulint n_flushed = 0; + flush_counters_t n; /* Currently page_cleaner is the only thread that can trigger an LRU flush. It is possible @@ -2099,7 +2110,7 @@ buf_flush_LRU_tail(void) still running, */ if (buf_flush_LRU(buf_pool, PAGE_CLEANER_LRU_BATCH_CHUNK_SIZE, - &n_flushed)) { + &n)) { /* Allowed only one batch per buffer pool instance. */ @@ -2107,8 +2118,8 @@ buf_flush_LRU_tail(void) buf_pool, BUF_FLUSH_LRU); } - if (n_flushed) { - total_flushed += n_flushed; + if (n.flushed) { + total_flushed += n.flushed; } else { /* Nothing to flush */ break; @@ -2277,7 +2288,14 @@ page_cleaner_flush_pages_if_needed(void) ulint pct_total = 0; int age_factor = 0; - cur_lsn = log_get_lsn(); + cur_lsn = log_get_lsn_nowait(); + + /* log_get_lsn_nowait tries to get log_sys->mutex with + mutex_enter_nowait, if this does not succeed function + returns 0, do not use that value to update stats. */ + if (cur_lsn == 0) { + return(0); + } if (prev_lsn == 0) { /* First time around. */ @@ -2411,25 +2429,16 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { - /* The page_cleaner skips sleep if the server is - idle and there are no pending IOs in the buffer pool - and there is work to do. */ - if (srv_check_activity(last_activity) - || buf_get_n_pending_read_ios() - || n_flushed == 0) { - page_cleaner_sleep_if_needed(next_loop_time); - } + page_cleaner_sleep_if_needed(next_loop_time); next_loop_time = ut_time_ms() + 1000; if (srv_check_activity(last_activity)) { last_activity = srv_get_activity_count(); - /* Flush pages from end of LRU if required */ - n_flushed = buf_flush_LRU_tail(); - /* Flush pages from flush_list if required */ - n_flushed += page_cleaner_flush_pages_if_needed(); + page_cleaner_flush_pages_if_needed(); + n_flushed = 0; } else { n_flushed = page_cleaner_do_flush_batch( PCT_IO(100), @@ -2443,6 +2452,9 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)( n_flushed); } } + + /* Flush pages from end of LRU if required */ + n_flushed = buf_flush_LRU_tail(); } ut_ad(srv_shutdown_state > 0); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 8574a6101e7..36eae54c17f 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1193,7 +1193,7 @@ buf_LRU_check_size_of_non_data_objects( buf_lru_switched_on_innodb_mon = TRUE; srv_print_innodb_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); } } else if (buf_lru_switched_on_innodb_mon) { @@ -1342,7 +1342,7 @@ loop: mon_value_was = srv_print_innodb_monitor; started_monitor = TRUE; srv_print_innodb_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); } /* If we have scanned the whole LRU and still are unable to diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index dd6fd099990..c6699296b36 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1481,7 +1481,6 @@ struct dict_foreign_remove_partial if (table != NULL) { table->referenced_set.erase(foreign); } - dict_foreign_free(foreign); } }; @@ -1699,6 +1698,10 @@ dict_table_rename_in_cache( foreign = *it; + if (foreign->referenced_table) { + foreign->referenced_table->referenced_set.erase(foreign); + } + if (ut_strlen(foreign->foreign_table_name) < ut_strlen(table->name)) { /* Allocate a longer name buffer; @@ -1850,6 +1853,10 @@ dict_table_rename_in_cache( table->foreign_set.erase(it); fk_set.insert(foreign); + + if (foreign->referenced_table) { + foreign->referenced_table->referenced_set.insert(foreign); + } } ut_a(table->foreign_set.empty()); @@ -3258,6 +3265,9 @@ dict_foreign_find( { ut_ad(mutex_own(&(dict_sys->mutex))); + ut_ad(dict_foreign_set_validate(table->foreign_set)); + ut_ad(dict_foreign_set_validate(table->referenced_set)); + dict_foreign_set::iterator it = table->foreign_set.find(foreign); if (it != table->foreign_set.end()) { @@ -5614,6 +5624,11 @@ dict_find_table_by_space( ut_ad(space_id > 0); + if (dict_sys == NULL) { + /* This could happen when it's in redo processing. */ + return(NULL); + } + table = UT_LIST_GET_FIRST(dict_sys->table_LRU); num_item = UT_LIST_GET_LEN(dict_sys->table_LRU); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index f18859393ee..16e64da6619 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -2537,6 +2537,8 @@ func_exit: } } + ut_ad(err != DB_SUCCESS || dict_foreign_set_validate(*table)); + return(table); } diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 885627a61bc..58781fce1d4 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -35,6 +35,7 @@ Created 1/8/1996 Heikki Tuuri #include "mach0data.h" #include "dict0dict.h" #include "fts0priv.h" +#include "ut0crc32.h" #ifndef UNIV_HOTBACKUP # include "ha_prototypes.h" /* innobase_casedn_str(), innobase_get_lower_case_table_names */ @@ -44,6 +45,7 @@ Created 1/8/1996 Heikki Tuuri #ifdef UNIV_BLOB_DEBUG # include "ut0rbt.h" #endif /* UNIV_BLOB_DEBUG */ +#include #define DICT_HEAP_SIZE 100 /*!< initial memory heap size when creating a table or index object */ @@ -53,6 +55,18 @@ Created 1/8/1996 Heikki Tuuri UNIV_INTERN mysql_pfs_key_t autoinc_mutex_key; #endif /* UNIV_PFS_MUTEX */ +/** System databases */ +static const char* innobase_system_databases[] = { + "mysql/", + "information_schema/", + "performance_schema/", + NullS +}; + +/** An interger randomly initialized at startup used to make a temporary +table name as unique as possible. */ +static ib_uint32_t dict_temp_file_num; + /**********************************************************************//** Creates a table memory object. @return own: table object */ @@ -85,6 +99,7 @@ dict_mem_table_create( table->flags2 = (unsigned int) flags2; table->name = static_cast(ut_malloc(strlen(name) + 1)); memcpy(table->name, name, strlen(name) + 1); + table->is_system_db = dict_mem_table_is_system(table->name); table->space = (unsigned int) space; table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS); @@ -130,6 +145,36 @@ dict_mem_table_create( return(table); } +/****************************************************************//** +Determines if a table belongs to a system database +@return */ +UNIV_INTERN +bool +dict_mem_table_is_system( +/*================*/ + char *name) /*!< in: table name */ +{ + ut_ad(name); + + /* table has the following format: database/table + and some system table are of the form SYS_* */ + if (strchr(name, '/')) { + int table_len = strlen(name); + const char *system_db; + int i = 0; + while ((system_db = innobase_system_databases[i++]) + && (system_db != NullS)) { + int len = strlen(system_db); + if (table_len > len && !strncmp(name, system_db, len)) { + return true; + } + } + return false; + } else { + return true; + } +} + /****************************************************************//** Free a table memory object. */ UNIV_INTERN @@ -614,26 +659,120 @@ dict_mem_index_free( mem_heap_free(index->heap); } -/*******************************************************************//** -Create a temporary tablename. -@return temporary tablename suitable for InnoDB use */ +/** Create a temporary tablename like "#sql-ibtid-inc where + tid = the Table ID + inc = a randomly initialized number that is incremented for each file +The table ID is a 64 bit integer, can use up to 20 digits, and is +initialized at bootstrap. The second number is 32 bits, can use up to 10 +digits, and is initialized at startup to a randomly distributed number. +It is hoped that the combination of these two numbers will provide a +reasonably unique temporary file name. +@param[in] heap A memory heap +@param[in] dbtab Table name in the form database/table name +@param[in] id Table id +@return A unique temporary tablename suitable for InnoDB use */ UNIV_INTERN char* dict_mem_create_temporary_tablename( -/*================================*/ - mem_heap_t* heap, /*!< in: memory heap */ - const char* dbtab, /*!< in: database/table name */ - table_id_t id) /*!< in: InnoDB table id */ + mem_heap_t* heap, + const char* dbtab, + table_id_t id) { - const char* dbend = strchr(dbtab, '/'); + size_t size; + char* name; + const char* dbend = strchr(dbtab, '/'); ut_ad(dbend); - size_t dblen = dbend - dbtab + 1; - size_t size = tmp_file_prefix_length + 4 + 9 + 9 + dblen; + size_t dblen = dbend - dbtab + 1; - char* name = static_cast(mem_heap_alloc(heap, size)); +#ifdef HAVE_ATOMIC_BUILTINS + /* Increment a randomly initialized number for each temp file. */ + os_atomic_increment_uint32(&dict_temp_file_num, 1); +#else /* HAVE_ATOMIC_BUILTINS */ + dict_temp_file_num++; +#endif /* HAVE_ATOMIC_BUILTINS */ + + size = tmp_file_prefix_length + 3 + 20 + 1 + 10 + dblen; + name = static_cast(mem_heap_alloc(heap, size)); memcpy(name, dbtab, dblen); ut_snprintf(name + dblen, size - dblen, - tmp_file_prefix "-ib" UINT64PF, id); + TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF, + id, dict_temp_file_num); + return(name); } +/** Initialize dict memory variables */ + +void +dict_mem_init(void) +{ + /* Initialize a randomly distributed temporary file number */ + ib_uint32_t now = static_cast(ut_time()); + + const byte* buf = reinterpret_cast(&now); + ut_ad(ut_crc32 != NULL); + + dict_temp_file_num = ut_crc32(buf, sizeof(now)); + + DBUG_PRINT("dict_mem_init", + ("Starting Temporary file number is " UINT32PF, + dict_temp_file_num)); +} + +/** Validate the search order in the foreign key set. +@param[in] fk_set the foreign key set to be validated +@return true if search order is fine in the set, false otherwise. */ +bool +dict_foreign_set_validate( + const dict_foreign_set& fk_set) +{ + dict_foreign_not_exists not_exists(fk_set); + + dict_foreign_set::iterator it = std::find_if( + fk_set.begin(), fk_set.end(), not_exists); + + if (it == fk_set.end()) { + return(true); + } + + dict_foreign_t* foreign = *it; + std::cerr << "Foreign key lookup failed: " << *foreign; + std::cerr << fk_set; + ut_ad(0); + return(false); +} + +/** Validate the search order in the foreign key sets of the table +(foreign_set and referenced_set). +@param[in] table table whose foreign key sets are to be validated +@return true if foreign key sets are fine, false otherwise. */ +bool +dict_foreign_set_validate( + const dict_table_t& table) +{ + return(dict_foreign_set_validate(table.foreign_set) + && dict_foreign_set_validate(table.referenced_set)); +} + +std::ostream& +operator<< (std::ostream& out, const dict_foreign_t& foreign) +{ + out << "[dict_foreign_t: id='" << foreign.id << "'"; + + if (foreign.foreign_table_name != NULL) { + out << ",for: '" << foreign.foreign_table_name << "'"; + } + + out << "]"; + return(out); +} + +std::ostream& +operator<< (std::ostream& out, const dict_foreign_set& fk_set) +{ + out << "[dict_foreign_set:"; + std::for_each(fk_set.begin(), fk_set.end(), dict_foreign_print(out)); + out << "]" << std::endl; + return(out); +} + diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 08839f751ff..ba0476b1772 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -140,180 +140,9 @@ UNIV_INTERN mysql_pfs_key_t fil_system_mutex_key; UNIV_INTERN mysql_pfs_key_t fil_space_latch_key; #endif /* UNIV_PFS_RWLOCK */ -/** File node of a tablespace or the log data space */ -struct fil_node_t { - fil_space_t* space; /*!< backpointer to the space where this node - belongs */ - char* name; /*!< path to the file */ - ibool open; /*!< TRUE if file open */ - os_file_t handle; /*!< OS handle to the file, if file open */ - os_event_t sync_event;/*!< Condition event to group and - serialize calls to fsync */ - ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw - device or a raw disk partition */ - ulint size; /*!< size of the file in database pages, 0 if - not known yet; the possible last incomplete - megabyte may be ignored if space == 0 */ - ulint n_pending; - /*!< count of pending i/o's on this file; - closing of the file is not allowed if - this is > 0 */ - ulint n_pending_flushes; - /*!< count of pending flushes on this file; - closing of the file is not allowed if - this is > 0 */ - ibool being_extended; - /*!< TRUE if the node is currently - being extended. */ - ib_int64_t modification_counter;/*!< when we write to the file we - increment this by one */ - ib_int64_t flush_counter;/*!< up to what - modification_counter value we have - flushed the modifications to disk */ - UT_LIST_NODE_T(fil_node_t) chain; - /*!< link field for the file chain */ - UT_LIST_NODE_T(fil_node_t) LRU; - /*!< link field for the LRU list */ - ulint magic_n;/*!< FIL_NODE_MAGIC_N */ -}; - -/** Value of fil_node_t::magic_n */ -#define FIL_NODE_MAGIC_N 89389 - -/** Tablespace or log data space: let us call them by a common name space */ -struct fil_space_t { - char* name; /*!< space name = the path to the first file in - it */ - ulint id; /*!< space id */ - ib_int64_t tablespace_version; - /*!< in DISCARD/IMPORT this timestamp - is used to check if we should ignore - an insert buffer merge request for a - page because it actually was for the - previous incarnation of the space */ - ibool mark; /*!< this is set to TRUE at database startup if - the space corresponds to a table in the InnoDB - data dictionary; so we can print a warning of - orphaned tablespaces */ - ibool stop_ios;/*!< TRUE if we want to rename the - .ibd file of tablespace and want to - stop temporarily posting of new i/o - requests on the file */ - ibool stop_new_ops; - /*!< we set this TRUE when we start - deleting a single-table tablespace. - When this is set following new ops - are not allowed: - * read IO request - * ibuf merge - * file flush - Note that we can still possibly have - new write operations because we don't - check this flag when doing flush - batches. */ - ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or - FIL_ARCH_LOG */ - UT_LIST_BASE_NODE_T(fil_node_t) chain; - /*!< base node for the file chain */ - ulint size; /*!< space size in pages; 0 if a single-table - tablespace whose size we do not know yet; - last incomplete megabytes in data files may be - ignored if space == 0 */ - ulint flags; /*!< tablespace flags; see - fsp_flags_is_valid(), - fsp_flags_get_zip_size() */ - ulint n_reserved_extents; - /*!< number of reserved free extents for - ongoing operations like B-tree page split */ - ulint n_pending_flushes; /*!< this is positive when flushing - the tablespace to disk; dropping of the - tablespace is forbidden if this is positive */ - ulint n_pending_ops;/*!< this is positive when we - have pending operations against this - tablespace. The pending operations can - be ibuf merges or lock validation code - trying to read a block. - Dropping of the tablespace is forbidden - if this is positive */ - hash_node_t hash; /*!< hash chain node */ - hash_node_t name_hash;/*!< hash chain the name_hash table */ -#ifndef UNIV_HOTBACKUP - rw_lock_t latch; /*!< latch protecting the file space storage - allocation */ -#endif /* !UNIV_HOTBACKUP */ - UT_LIST_NODE_T(fil_space_t) unflushed_spaces; - /*!< list of spaces with at least one unflushed - file we have written to */ - bool is_in_unflushed_spaces; - /*!< true if this space is currently in - unflushed_spaces */ - UT_LIST_NODE_T(fil_space_t) space_list; - /*!< list of all spaces */ - ulint magic_n;/*!< FIL_SPACE_MAGIC_N */ -}; - -/** Value of fil_space_t::magic_n */ -#define FIL_SPACE_MAGIC_N 89472 - -/** The tablespace memory cache; also the totality of logs (the log -data space) is stored here; below we talk about tablespaces, but also -the ib_logfiles form a 'space' and it is handled here */ -struct fil_system_t { -#ifndef UNIV_HOTBACKUP - ib_mutex_t mutex; /*!< The mutex protecting the cache */ -#endif /* !UNIV_HOTBACKUP */ - hash_table_t* spaces; /*!< The hash table of spaces in the - system; they are hashed on the space - id */ - hash_table_t* name_hash; /*!< hash table based on the space - name */ - UT_LIST_BASE_NODE_T(fil_node_t) LRU; - /*!< base node for the LRU list of the - most recently used open files with no - pending i/o's; if we start an i/o on - the file, we first remove it from this - list, and return it to the start of - the list when the i/o ends; - log files and the system tablespace are - not put to this list: they are opened - after the startup, and kept open until - shutdown */ - UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; - /*!< base node for the list of those - tablespaces whose files contain - unflushed writes; those spaces have - at least one file node where - modification_counter > flush_counter */ - ulint n_open; /*!< number of files currently open */ - ulint max_n_open; /*!< n_open is not allowed to exceed - this */ - ib_int64_t modification_counter;/*!< when we write to a file we - increment this by one */ - ulint max_assigned_id;/*!< maximum space id in the existing - tables, or assigned during the time - mysqld has been up; at an InnoDB - startup we scan the data dictionary - and set here the maximum of the - space id's of the tables there */ - ib_int64_t tablespace_version; - /*!< a counter which is incremented for - every space object memory creation; - every space mem object gets a - 'timestamp' from this; in DISCARD/ - IMPORT this is used to check if we - should ignore an insert buffer merge - request */ - UT_LIST_BASE_NODE_T(fil_space_t) space_list; - /*!< list of all file spaces */ - ibool space_id_reuse_warned; - /* !< TRUE if fil_space_create() - has issued a warning about - potential space_id reuse */ -}; - /** The tablespace memory cache. This variable is NULL before the module is initialized. */ -static fil_system_t* fil_system = NULL; +fil_system_t* fil_system = NULL; /** Determine if (i) is a user tablespace id or not. */ # define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open) diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 848d60f6e3f..ae61b77c6de 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -3393,7 +3393,8 @@ fts_fetch_doc_from_rec( dict_table_zip_size(table), clust_pos, &doc->text.f_len, static_cast( - doc->self_heap->arg)); + doc->self_heap->arg), + NULL); } else { doc->text.f_str = (byte*) rec_get_nth_field( clust_rec, offsets, clust_pos, @@ -7077,7 +7078,8 @@ fts_init_recover_doc( &doc.text.f_len, static_cast(dfield_get_data(dfield)), zip_size, len, - static_cast(doc.self_heap->arg)); + static_cast(doc.self_heap->arg), + NULL); } else { doc.text.f_str = static_cast( dfield_get_data(dfield)); diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index f26fd89ac76..8f4813e4b3f 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -1918,7 +1918,8 @@ fts_query_fetch_document( if (dfield_is_ext(dfield)) { data = btr_copy_externally_stored_field( &cur_len, data, phrase->zip_size, - dfield_get_len(dfield), phrase->heap); + dfield_get_len(dfield), phrase->heap, + NULL); } else { cur_len = dfield_get_len(dfield); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4cab6471c14..5c433e0d771 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -282,9 +282,9 @@ static TYPELIB innodb_checksum_algorithm_typelib = { }; /* The following counter is used to convey information to InnoDB -about server activity: in selects it is not sensible to call -srv_active_wake_master_thread after each fetch or search, we only do -it every INNOBASE_WAKE_INTERVAL'th step. */ +about server activity: in case of normal DML ops it is not +sensible to call srv_active_wake_master_thread after each +operation, we only do it every INNOBASE_WAKE_INTERVAL'th step. */ #define INNOBASE_WAKE_INTERVAL 32 static ulong innobase_active_counter = 0; @@ -708,6 +708,14 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_rows_read, SHOW_LONG}, {"rows_updated", (char*) &export_vars.innodb_rows_updated, SHOW_LONG}, + {"system_rows_deleted", + (char*) &export_vars.innodb_system_rows_deleted, SHOW_LONG}, + {"system_rows_inserted", + (char*) &export_vars.innodb_system_rows_inserted, SHOW_LONG}, + {"system_rows_read", + (char*) &export_vars.innodb_system_rows_read, SHOW_LONG}, + {"system_rows_updated", + (char*) &export_vars.innodb_system_rows_updated, SHOW_LONG}, {"num_open_files", (char*) &export_vars.innodb_num_open_files, SHOW_LONG}, {"truncated_status_writes", @@ -2591,11 +2599,25 @@ innobase_invalidate_query_cache( above the InnoDB trx_sys_t->lock. The caller of this function must not have latches of a lower rank. */ - /* Argument TRUE below means we are using transactions */ #ifdef HAVE_QUERY_CACHE + char qcache_key_name[2 * (NAME_LEN + 1)]; + size_t tabname_len; + size_t dbname_len; + + /* Construct the key("db-name\0table$name\0") for the query cache using + the path name("db@002dname\0table@0024name\0") of the table in its + canonical form. */ + dbname_len = filename_to_tablename(full_name, qcache_key_name, + sizeof(qcache_key_name)); + tabname_len = filename_to_tablename(full_name + strlen(full_name) + 1, + qcache_key_name + dbname_len + 1, + sizeof(qcache_key_name) + - dbname_len - 1); + + /* Argument TRUE below means we are using transactions */ mysql_query_cache_invalidate4(trx->mysql_thd, - full_name, - (uint32) full_name_len, + qcache_key_name, + (dbname_len + tabname_len + 2), TRUE); #endif } @@ -3180,7 +3202,7 @@ innobase_change_buffering_inited_ok: " cannot be set higher than" " innodb_max_dirty_pages_pct.\n" "InnoDB: Setting" - " innodb_max_dirty_pages_pct_lwm to %lu\n", + " innodb_max_dirty_pages_pct_lwm to %lf\n", srv_max_buf_pool_modified_pct); srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; @@ -3835,10 +3857,6 @@ innobase_commit( innobase_srv_conc_force_exit_innodb(trx); - /* Tell the InnoDB server that there might be work for utility - threads: */ - srv_active_wake_master_thread(); - DBUG_RETURN(0); } @@ -8565,7 +8583,8 @@ ha_innobase::index_read( row_sel_convert_mysql_key_to_innobase( prebuilt->search_tuple, - srch_key_val1, sizeof(srch_key_val1), + prebuilt->srch_key_val1, + prebuilt->srch_key_val_len, index, (byte*) key_ptr, (ulint) key_len, @@ -8611,7 +8630,13 @@ ha_innobase::index_read( case DB_SUCCESS: error = 0; table->status = 0; - srv_stats.n_rows_read.add((size_t) prebuilt->trx->id, 1); + if (prebuilt->table->is_system_db) { + srv_stats.n_system_rows_read.add( + (size_t) prebuilt->trx->id, 1); + } else { + srv_stats.n_rows_read.add( + (size_t) prebuilt->trx->id, 1); + } break; case DB_RECORD_NOT_FOUND: error = HA_ERR_KEY_NOT_FOUND; @@ -8887,7 +8912,13 @@ ha_innobase::general_fetch( case DB_SUCCESS: error = 0; table->status = 0; - srv_stats.n_rows_read.add((size_t) prebuilt->trx->id, 1); + if (prebuilt->table->is_system_db) { + srv_stats.n_system_rows_read.add( + (size_t) prebuilt->trx->id, 1); + } else { + srv_stats.n_rows_read.add( + (size_t) prebuilt->trx->id, 1); + } break; case DB_RECORD_NOT_FOUND: error = HA_ERR_END_OF_FILE; @@ -11559,11 +11590,6 @@ ha_innobase::delete_table( log_buffer_flush_to_disk(); - /* Tell the InnoDB server that there might be work for - utility threads: */ - - srv_active_wake_master_thread(); - innobase_commit_low(trx); trx_free_for_mysql(trx); @@ -11645,11 +11671,6 @@ innobase_drop_database( log_buffer_flush_to_disk(); - /* Tell the InnoDB server that there might be work for - utility threads: */ - - srv_active_wake_master_thread(); - innobase_commit_low(trx); trx_free_for_mysql(trx); } @@ -11799,11 +11820,6 @@ ha_innobase::rename_table( DEBUG_SYNC(thd, "after_innobase_rename_table"); - /* Tell the InnoDB server that there might be work for - utility threads: */ - - srv_active_wake_master_thread(); - innobase_commit_low(trx); trx_free_for_mysql(trx); @@ -11919,7 +11935,8 @@ ha_innobase::records_in_range( row_sel_convert_mysql_key_to_innobase( range_start, - srch_key_val1, sizeof(srch_key_val1), + prebuilt->srch_key_val1, + prebuilt->srch_key_val_len, index, (byte*) (min_key ? min_key->key : (const uchar*) 0), @@ -11931,7 +11948,8 @@ ha_innobase::records_in_range( row_sel_convert_mysql_key_to_innobase( range_end, - srch_key_val2, sizeof(srch_key_val2), + prebuilt->srch_key_val2, + prebuilt->srch_key_val_len, index, (byte*) (max_key ? max_key->key : (const uchar*) 0), @@ -11950,7 +11968,7 @@ ha_innobase::records_in_range( n_rows = btr_estimate_n_rows_in_range(index, range_start, mode1, range_end, - mode2); + mode2, prebuilt->trx); } else { n_rows = HA_POS_ERROR; @@ -15141,11 +15159,6 @@ innobase_xa_prepare( trx_mark_sql_stat_end(trx); } - /* Tell the InnoDB server that there might be work for utility - threads: */ - - srv_active_wake_master_thread(); - return(error); } @@ -15333,14 +15346,17 @@ innodb_io_capacity_max_update( { ulong in_val = *static_cast(save); if (in_val < srv_io_capacity) { - in_val = srv_io_capacity; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, - "innodb_io_capacity_max cannot be" - " set lower than innodb_io_capacity."); + "Setting innodb_io_capacity_max %lu" + " lower than innodb_io_capacity %lu.", + in_val, srv_io_capacity); + + srv_io_capacity = in_val; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, - "Setting innodb_io_capacity_max to %lu", + "Setting innodb_io_capacity to %lu", srv_io_capacity); } @@ -15363,15 +15379,19 @@ innodb_io_capacity_update( from check function */ { ulong in_val = *static_cast(save); + if (in_val > srv_max_io_capacity) { - in_val = srv_max_io_capacity; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, - "innodb_io_capacity cannot be set" - " higher than innodb_io_capacity_max."); + "Setting innodb_io_capacity to %lu" + " higher than innodb_io_capacity_max %lu", + in_val, srv_max_io_capacity); + + srv_max_io_capacity = in_val * 2; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, - "Setting innodb_io_capacity to %lu", + "Setting innodb_max_io_capacity to %lu", srv_max_io_capacity); } @@ -15393,7 +15413,7 @@ innodb_max_dirty_pages_pct_update( const void* save) /*!< in: immediate result from check function */ { - ulong in_val = *static_cast(save); + double in_val = *static_cast(save); if (in_val < srv_max_dirty_pages_pct_lwm) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, @@ -15403,7 +15423,7 @@ innodb_max_dirty_pages_pct_update( push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, "Lowering" - " innodb_max_dirty_page_pct_lwm to %lu", + " innodb_max_dirty_page_pct_lwm to %lf", in_val); srv_max_dirty_pages_pct_lwm = in_val; @@ -15427,7 +15447,7 @@ innodb_max_dirty_pages_pct_lwm_update( const void* save) /*!< in: immediate result from check function */ { - ulong in_val = *static_cast(save); + double in_val = *static_cast(save); if (in_val > srv_max_buf_pool_modified_pct) { in_val = srv_max_buf_pool_modified_pct; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -15438,7 +15458,7 @@ innodb_max_dirty_pages_pct_lwm_update( push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_ARGUMENTS, "Setting innodb_max_dirty_page_pct_lwm" - " to %lu", + " to %lf", in_val); } @@ -17137,9 +17157,8 @@ innodb_status_output_update( const void* save __attribute__((unused))) { *static_cast(var_ptr) = *static_cast(save); - /* The lock timeout monitor thread also takes care of this - output. */ - os_event_set(lock_sys->timeout_event); + /* Wakeup server monitor thread. */ + os_event_set(srv_monitor_event); } static SHOW_VAR innodb_status_variables_export[]= { @@ -17663,22 +17682,22 @@ static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Path to InnoDB log files.", NULL, NULL, NULL); -static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, +static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, PLUGIN_VAR_RQCMDARG, "Percentage of dirty pages allowed in bufferpool.", - NULL, innodb_max_dirty_pages_pct_update, 75, 0, 99, 0); + NULL, innodb_max_dirty_pages_pct_update, 75.0, 0.001, 99.999, 0); -static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct_lwm, +static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct_lwm, srv_max_dirty_pages_pct_lwm, PLUGIN_VAR_RQCMDARG, "Percentage of dirty pages at which flushing kicks in.", - NULL, innodb_max_dirty_pages_pct_lwm_update, 0, 0, 99, 0); + NULL, innodb_max_dirty_pages_pct_lwm_update, 0.001, 0.000, 99.999, 0); -static MYSQL_SYSVAR_ULONG(adaptive_flushing_lwm, +static MYSQL_SYSVAR_DOUBLE(adaptive_flushing_lwm, srv_adaptive_flushing_lwm, PLUGIN_VAR_RQCMDARG, "Percentage of log capacity below which no adaptive flushing happens.", - NULL, NULL, 10, 0, 70, 0); + NULL, NULL, 10.0, 0.0, 70.0, 0); static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing, PLUGIN_VAR_NOCMDARG, @@ -17753,6 +17772,16 @@ static MYSQL_SYSVAR_ULONGLONG(stats_persistent_sample_pages, "statistics (by ANALYZE, default 20)", NULL, NULL, 20, 1, ~0ULL, 0); +static MYSQL_SYSVAR_ULONGLONG(stats_modified_counter, srv_stats_modified_counter, + PLUGIN_VAR_RQCMDARG, + "The number of rows modified before we calculate new statistics (default 0 = current limits)", + NULL, NULL, 0, 0, ~0ULL, 0); + +static MYSQL_SYSVAR_BOOL(stats_traditional, srv_stats_sample_traditional, + PLUGIN_VAR_RQCMDARG, + "Enable traditional statistic calculation based on number of configured pages (default true)", + NULL, NULL, TRUE); + static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled, PLUGIN_VAR_OPCMDARG, "Enable InnoDB adaptive hash index (enabled by default). " @@ -18412,6 +18441,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(stats_persistent), MYSQL_SYSVAR(stats_persistent_sample_pages), MYSQL_SYSVAR(stats_auto_recalc), + MYSQL_SYSVAR(stats_modified_counter), + MYSQL_SYSVAR(stats_traditional), MYSQL_SYSVAR(adaptive_hash_index), MYSQL_SYSVAR(stats_method), MYSQL_SYSVAR(replication_delay), diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 8c7d8f64957..87fe658fc17 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -71,13 +71,6 @@ class ha_innobase: public handler uchar* upd_buf; /*!< buffer used in updates */ ulint upd_buf_size; /*!< the size of upd_buf in bytes */ - uchar srch_key_val1[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; - uchar srch_key_val2[MAX_KEY_LENGTH + MAX_REF_PARTS*2]; - /*!< buffers used in converting - search key values from MySQL format - to InnoDB format. For each column - 2 bytes are used to store length, - hence MAX_REF_PARTS*2. */ Table_flags int_table_flags; uint primary_key; ulong start_of_scan; /*!< this is set to 1 when we are diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 6062e25233f..728c3bb2cf5 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -21,6 +21,7 @@ this program; if not, write to the Free Software Foundation, Inc., Smart ALTER TABLE *******************************************************/ +#include #include #include #include @@ -2240,7 +2241,7 @@ innobase_check_foreigns_low( /* Check if any FOREIGN KEY constraints are defined on this column. */ - for (dict_foreign_set::iterator it = user_table->foreign_set.begin(); + for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin(); it != user_table->foreign_set.end(); ++it) { @@ -2277,7 +2278,7 @@ innobase_check_foreigns_low( /* Check if any FOREIGN KEY constraints in other tables are referring to the column that is being dropped. */ - for (dict_foreign_set::iterator it + for (dict_foreign_set::const_iterator it = user_table->referenced_set.begin(); it != user_table->referenced_set.end(); ++it) { @@ -2463,7 +2464,7 @@ innobase_build_col_map( innobase_build_col_map_add( heap, dtuple_get_nth_field(add_cols, i), - altered_table->s->field[sql_idx], + altered_table->field[sql_idx], dict_table_is_comp(new_table)); found_col: i++; @@ -3247,9 +3248,6 @@ err_exit: delete ctx; ha_alter_info->handler_ctx = NULL; - /* There might be work for utility threads.*/ - srv_active_wake_master_thread(); - DBUG_RETURN(true); } @@ -4275,7 +4273,6 @@ func_exit: } trx_commit_for_mysql(prebuilt->trx); - srv_active_wake_master_thread(); MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); DBUG_RETURN(fail); } @@ -4449,7 +4446,7 @@ err_exit: rename_foreign: trx->op_info = "renaming column in SYS_FOREIGN_COLS"; - for (dict_foreign_set::iterator it = user_table->foreign_set.begin(); + for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin(); it != user_table->foreign_set.end(); ++it) { @@ -4484,7 +4481,7 @@ rename_foreign: } } - for (dict_foreign_set::iterator it + for (dict_foreign_set::const_iterator it = user_table->referenced_set.begin(); it != user_table->referenced_set.end(); ++it) { @@ -4788,14 +4785,17 @@ innobase_update_foreign_try( /** Update the foreign key constraint definitions in the data dictionary cache after the changes to data dictionary tables were committed. @param ctx In-place ALTER TABLE context +@param user_thd MySQL connection @return InnoDB error code (should always be DB_SUCCESS) */ static __attribute__((nonnull, warn_unused_result)) dberr_t innobase_update_foreign_cache( /*==========================*/ - ha_innobase_inplace_ctx* ctx) + ha_innobase_inplace_ctx* ctx, + THD* user_thd) { dict_table_t* user_table; + dberr_t err = DB_SUCCESS; DBUG_ENTER("innobase_update_foreign_cache"); @@ -4830,9 +4830,34 @@ innobase_update_foreign_cache( /* Load the old or added foreign keys from the data dictionary and prevent the table from being evicted from the data dictionary cache (work around the lack of WL#6049). */ - DBUG_RETURN(dict_load_foreigns(user_table->name, - ctx->col_names, false, true, - DICT_ERR_IGNORE_NONE)); + err = dict_load_foreigns(user_table->name, + ctx->col_names, false, true, + DICT_ERR_IGNORE_NONE); + + if (err == DB_CANNOT_ADD_CONSTRAINT) { + /* It is possible there are existing foreign key are + loaded with "foreign_key checks" off, + so let's retry the loading with charset_check is off */ + err = dict_load_foreigns(user_table->name, + ctx->col_names, false, false, + DICT_ERR_IGNORE_NONE); + + /* The load with "charset_check" off is successful, warn + the user that the foreign key has loaded with mis-matched + charset */ + if (err == DB_SUCCESS) { + push_warning_printf( + user_thd, + Sql_condition::WARN_LEVEL_WARN, + ER_ALTER_INFO, + "Foreign key constraints for table '%s'" + " are loaded with charset check off", + user_table->name); + + } + } + + DBUG_RETURN(err); } /** Commit the changes made during prepare_inplace_alter_table() @@ -5708,12 +5733,12 @@ ha_innobase::commit_inplace_alter_table( /* Rename the tablespace files. */ commit_cache_rebuild(ctx); - error = innobase_update_foreign_cache(ctx); + error = innobase_update_foreign_cache(ctx, user_thd); if (error != DB_SUCCESS) { goto foreign_fail; } } else { - error = innobase_update_foreign_cache(ctx); + error = innobase_update_foreign_cache(ctx, user_thd); if (error != DB_SUCCESS) { foreign_fail: diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index f1e4406fcf7..d0fd5c2158a 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -561,7 +561,8 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */ ulint mode1, /*!< in: search mode for range start */ const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */ - ulint mode2); /*!< in: search mode for range end */ + ulint mode2, /*!< in: search mode for range end */ + trx_t* trx); /*!< in: trx */ /*******************************************************************//** Estimates the number of different key values in a given index, for each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index). @@ -697,7 +698,8 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len);/*!< in: length of data, in bytes */ + ulint local_len,/*!< in: length of data, in bytes */ + trx_t* trx); /*!< in: transaction handle */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. The clustered index record must be protected by a lock or a page latch. @@ -714,7 +716,8 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap); /*!< in: mem heap */ + mem_heap_t* heap, /*!< in: mem heap */ + trx_t* trx); /*!< in: transaction handle */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. @return the field copied to heap, or NULL if the field is incomplete */ @@ -729,7 +732,8 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap); /*!< in: mem heap */ + mem_heap_t* heap, /*!< in: mem heap */ + trx_t* trx); /*!< in: transaction handle */ /*******************************************************************//** Flags the data tuple fields that are marked as extern storage in the update vector. We use this function to remember which fields we must diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 3f2ac4980cf..31ec6b9ef8b 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -794,7 +794,7 @@ Returns the ratio in percents of modified pages in the buffer pool / database pages in the buffer pool. @return modified page percentage ratio */ UNIV_INTERN -ulint +double buf_get_modified_ratio_pct(void); /*============================*/ /**********************************************************************//** diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 8a0913e11a8..ba160e023c5 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -49,6 +49,7 @@ Created 1/8/1996 Heikki Tuuri #include "os0once.h" #include #include +#include /* Forward declaration. */ struct ib_rbt_t; @@ -256,6 +257,14 @@ dict_mem_table_create( ulint n_cols, /*!< in: number of columns */ ulint flags, /*!< in: table flags */ ulint flags2); /*!< in: table flags2 */ +/**********************************************************************//** +Determines if a table belongs to a system database +@return */ +UNIV_INTERN +bool +dict_mem_table_is_system( +/*==================*/ + char *name); /*!< in: table name */ /****************************************************************//** Free a table memory object. */ UNIV_INTERN @@ -384,16 +393,29 @@ dict_mem_referenced_table_name_lookup_set( dict_foreign_t* foreign, /*!< in/out: foreign struct */ ibool do_alloc); /*!< in: is an alloc needed */ -/*******************************************************************//** -Create a temporary tablename. -@return temporary tablename suitable for InnoDB use */ -UNIV_INTERN __attribute__((nonnull, warn_unused_result)) +/** Create a temporary tablename like "#sql-ibtid-inc where + tid = the Table ID + inc = a randomly initialized number that is incremented for each file +The table ID is a 64 bit integer, can use up to 20 digits, and is +initialized at bootstrap. The second number is 32 bits, can use up to 10 +digits, and is initialized at startup to a randomly distributed number. +It is hoped that the combination of these two numbers will provide a +reasonably unique temporary file name. +@param[in] heap A memory heap +@param[in] dbtab Table name in the form database/table name +@param[in] id Table id +@return A unique temporary tablename suitable for InnoDB use */ +UNIV_INTERN char* dict_mem_create_temporary_tablename( -/*================================*/ - mem_heap_t* heap, /*!< in: memory heap */ - const char* dbtab, /*!< in: database/table name */ - table_id_t id); /*!< in: InnoDB table id */ + mem_heap_t* heap, + const char* dbtab, + table_id_t id); + +/** Initialize dict memory variables */ + +void +dict_mem_init(void); /** Data structure for a column in a table */ struct dict_col_t{ @@ -713,6 +735,22 @@ struct dict_foreign_t{ dict_index_t* referenced_index;/*!< referenced index */ }; +std::ostream& +operator<< (std::ostream& out, const dict_foreign_t& foreign); + +struct dict_foreign_print { + + dict_foreign_print(std::ostream& out) + : m_out(out) + {} + + void operator()(const dict_foreign_t* foreign) { + m_out << *foreign; + } +private: + std::ostream& m_out; +}; + /** Compare two dict_foreign_t objects using their ids. Used in the ordering of dict_table_t::foreign_set and dict_table_t::referenced_set. It returns true if the first argument is considered to go before the second in the @@ -782,6 +820,40 @@ struct dict_foreign_matches_id { typedef std::set dict_foreign_set; +std::ostream& +operator<< (std::ostream& out, const dict_foreign_set& fk_set); + +/** Function object to check if a foreign key object is there +in the given foreign key set or not. It returns true if the +foreign key is not found, false otherwise */ +struct dict_foreign_not_exists { + dict_foreign_not_exists(const dict_foreign_set& obj_) + : m_foreigns(obj_) + {} + + /* Return true if the given foreign key is not found */ + bool operator()(dict_foreign_t* const & foreign) const { + return(m_foreigns.find(foreign) == m_foreigns.end()); + } +private: + const dict_foreign_set& m_foreigns; +}; + +/** Validate the search order in the foreign key set. +@param[in] fk_set the foreign key set to be validated +@return true if search order is fine in the set, false otherwise. */ +bool +dict_foreign_set_validate( + const dict_foreign_set& fk_set); + +/** Validate the search order in the foreign key sets of the table +(foreign_set and referenced_set). +@param[in] table table whose foreign key sets are to be validated +@return true if foreign key sets are fine, false otherwise. */ +bool +dict_foreign_set_validate( + const dict_table_t& table); + /*********************************************************************//** Frees a foreign key struct. */ inline @@ -883,6 +955,10 @@ struct dict_table_t{ the string contains n_cols, it will be allocated from a temporary heap. The final string will be allocated from table->heap. */ + bool is_system_db; + /*!< True if the table belongs to a system + database (mysql, information_schema or + performance_schema) */ #ifndef UNIV_HOTBACKUP hash_node_t name_hash; /*!< hash chain node */ hash_node_t id_hash; /*!< hash chain node */ diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 1299445a8ee..d34b6f7eab3 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -78,6 +78,7 @@ enum ib_quiesce_t { /** Prefix for tmp tables, adopted from sql/table.h */ #define tmp_file_prefix "#sql" #define tmp_file_prefix_length 4 +#define TEMP_FILE_PREFIX_INNODB "#sql-ib" #define TEMP_TABLE_PREFIX "#sql" #define TEMP_TABLE_PATH_PREFIX "/" TEMP_TABLE_PREFIX diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index b607ca36d70..798423eeddd 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -33,6 +33,7 @@ Created 10/25/1995 Heikki Tuuri #include "dict0types.h" #include "ut0byte.h" #include "os0file.h" +#include "hash0hash.h" #ifndef UNIV_HOTBACKUP #include "sync0rw.h" #include "ibuf0types.h" @@ -190,6 +191,183 @@ struct fsp_open_info { #endif /* UNIV_LOG_ARCHIVE */ }; +struct fil_space_t; + +/** File node of a tablespace or the log data space */ +struct fil_node_t { + fil_space_t* space; /*!< backpointer to the space where this node + belongs */ + char* name; /*!< path to the file */ + ibool open; /*!< TRUE if file open */ + os_file_t handle; /*!< OS handle to the file, if file open */ + os_event_t sync_event;/*!< Condition event to group and + serialize calls to fsync */ + ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw + device or a raw disk partition */ + ulint size; /*!< size of the file in database pages, 0 if + not known yet; the possible last incomplete + megabyte may be ignored if space == 0 */ + ulint n_pending; + /*!< count of pending i/o's on this file; + closing of the file is not allowed if + this is > 0 */ + ulint n_pending_flushes; + /*!< count of pending flushes on this file; + closing of the file is not allowed if + this is > 0 */ + ibool being_extended; + /*!< TRUE if the node is currently + being extended. */ + ib_int64_t modification_counter;/*!< when we write to the file we + increment this by one */ + ib_int64_t flush_counter;/*!< up to what + modification_counter value we have + flushed the modifications to disk */ + UT_LIST_NODE_T(fil_node_t) chain; + /*!< link field for the file chain */ + UT_LIST_NODE_T(fil_node_t) LRU; + /*!< link field for the LRU list */ + ulint magic_n;/*!< FIL_NODE_MAGIC_N */ +}; + +/** Value of fil_node_t::magic_n */ +#define FIL_NODE_MAGIC_N 89389 + +/** Tablespace or log data space: let us call them by a common name space */ +struct fil_space_t { + char* name; /*!< space name = the path to the first file in + it */ + ulint id; /*!< space id */ + ib_int64_t tablespace_version; + /*!< in DISCARD/IMPORT this timestamp + is used to check if we should ignore + an insert buffer merge request for a + page because it actually was for the + previous incarnation of the space */ + ibool mark; /*!< this is set to TRUE at database startup if + the space corresponds to a table in the InnoDB + data dictionary; so we can print a warning of + orphaned tablespaces */ + ibool stop_ios;/*!< TRUE if we want to rename the + .ibd file of tablespace and want to + stop temporarily posting of new i/o + requests on the file */ + ibool stop_new_ops; + /*!< we set this TRUE when we start + deleting a single-table tablespace. + When this is set following new ops + are not allowed: + * read IO request + * ibuf merge + * file flush + Note that we can still possibly have + new write operations because we don't + check this flag when doing flush + batches. */ + ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or + FIL_ARCH_LOG */ + UT_LIST_BASE_NODE_T(fil_node_t) chain; + /*!< base node for the file chain */ + ulint size; /*!< space size in pages; 0 if a single-table + tablespace whose size we do not know yet; + last incomplete megabytes in data files may be + ignored if space == 0 */ + ulint flags; /*!< tablespace flags; see + fsp_flags_is_valid(), + fsp_flags_get_zip_size() */ + ulint n_reserved_extents; + /*!< number of reserved free extents for + ongoing operations like B-tree page split */ + ulint n_pending_flushes; /*!< this is positive when flushing + the tablespace to disk; dropping of the + tablespace is forbidden if this is positive */ + ulint n_pending_ops;/*!< this is positive when we + have pending operations against this + tablespace. The pending operations can + be ibuf merges or lock validation code + trying to read a block. + Dropping of the tablespace is forbidden + if this is positive */ + hash_node_t hash; /*!< hash chain node */ + hash_node_t name_hash;/*!< hash chain the name_hash table */ +#ifndef UNIV_HOTBACKUP + rw_lock_t latch; /*!< latch protecting the file space storage + allocation */ +#endif /* !UNIV_HOTBACKUP */ + UT_LIST_NODE_T(fil_space_t) unflushed_spaces; + /*!< list of spaces with at least one unflushed + file we have written to */ + bool is_in_unflushed_spaces; + /*!< true if this space is currently in + unflushed_spaces */ + UT_LIST_NODE_T(fil_space_t) space_list; + /*!< list of all spaces */ + ulint magic_n;/*!< FIL_SPACE_MAGIC_N */ +}; + +/** Value of fil_space_t::magic_n */ +#define FIL_SPACE_MAGIC_N 89472 + +/** The tablespace memory cache; also the totality of logs (the log +data space) is stored here; below we talk about tablespaces, but also +the ib_logfiles form a 'space' and it is handled here */ +struct fil_system_t { +#ifndef UNIV_HOTBACKUP + ib_mutex_t mutex; /*!< The mutex protecting the cache */ +#endif /* !UNIV_HOTBACKUP */ + hash_table_t* spaces; /*!< The hash table of spaces in the + system; they are hashed on the space + id */ + hash_table_t* name_hash; /*!< hash table based on the space + name */ + UT_LIST_BASE_NODE_T(fil_node_t) LRU; + /*!< base node for the LRU list of the + most recently used open files with no + pending i/o's; if we start an i/o on + the file, we first remove it from this + list, and return it to the start of + the list when the i/o ends; + log files and the system tablespace are + not put to this list: they are opened + after the startup, and kept open until + shutdown */ + UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; + /*!< base node for the list of those + tablespaces whose files contain + unflushed writes; those spaces have + at least one file node where + modification_counter > flush_counter */ + ulint n_open; /*!< number of files currently open */ + ulint max_n_open; /*!< n_open is not allowed to exceed + this */ + ib_int64_t modification_counter;/*!< when we write to a file we + increment this by one */ + ulint max_assigned_id;/*!< maximum space id in the existing + tables, or assigned during the time + mysqld has been up; at an InnoDB + startup we scan the data dictionary + and set here the maximum of the + space id's of the tables there */ + ib_int64_t tablespace_version; + /*!< a counter which is incremented for + every space object memory creation; + every space mem object gets a + 'timestamp' from this; in DISCARD/ + IMPORT this is used to check if we + should ignore an insert buffer merge + request */ + UT_LIST_BASE_NODE_T(fil_space_t) space_list; + /*!< list of all file spaces */ + ibool space_id_reuse_warned; + /* !< TRUE if fil_space_create() + has issued a warning about + potential space_id reuse */ +}; + +/** The tablespace memory cache. This variable is NULL before the module is +initialized. */ +extern fil_system_t* fil_system; + #ifndef UNIV_HOTBACKUP /*******************************************************************//** Returns the version number of a tablespace, -1 if not found. diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic index 7c79eb96ca9..38ed2b51a4e 100644 --- a/storage/innobase/include/log0log.ic +++ b/storage/innobase/include/log0log.ic @@ -442,14 +442,14 @@ lsn_t log_get_lsn_nowait(void) /*=============*/ { - lsn_t lsn; + lsn_t lsn=0; - if (mutex_enter_nowait(&(log_sys->mutex))) - return 0; + if (!mutex_enter_nowait(&(log_sys->mutex))) { - lsn = log_sys->lsn; + lsn = log_sys->lsn; - mutex_exit(&(log_sys->mutex)); + mutex_exit(&(log_sys->mutex)); + } return(lsn); } diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index ed7fd76d425..b91dbd0353c 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -35,6 +35,7 @@ Created 11/26/1995 Heikki Tuuri #include "ut0byte.h" #include "mtr0types.h" #include "page0types.h" +#include "trx0types.h" /* Logging modes for a mini-transaction */ #define MTR_LOG_ALL 21 /* default mode: log all operations @@ -200,6 +201,15 @@ functions). The page number parameter was originally written as 0. @{ */ /* included here because it needs MLOG_LSN defined */ #include "log0log.h" +/***************************************************************//** +Starts a mini-transaction. */ +UNIV_INLINE +void +mtr_start_trx( +/*======*/ + mtr_t* mtr, /*!< out: mini-transaction */ + trx_t* trx) /*!< in: transaction */ + __attribute__((nonnull (1))); /***************************************************************//** Starts a mini-transaction. */ UNIV_INLINE @@ -207,7 +217,10 @@ void mtr_start( /*======*/ mtr_t* mtr) /*!< out: mini-transaction */ - __attribute__((nonnull)); +{ + mtr_start_trx(mtr, NULL); +} + __attribute__((nonnull)) /***************************************************************//** Commits a mini-transaction. */ UNIV_INTERN @@ -403,6 +416,7 @@ struct mtr_t{ #ifdef UNIV_DEBUG ulint magic_n; #endif /* UNIV_DEBUG */ + trx_t* trx; /*!< transaction */ }; #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index a9f02430220..44d548e9b64 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -43,9 +43,10 @@ mtr_block_dirtied( Starts a mini-transaction. */ UNIV_INLINE void -mtr_start( +mtr_start_trx( /*======*/ - mtr_t* mtr) /*!< out: mini-transaction */ + mtr_t* mtr, /*!< out: mini-transaction */ + trx_t* trx) /*!< in: transaction */ { UNIV_MEM_INVALID(mtr, sizeof *mtr); @@ -58,6 +59,7 @@ mtr_start( mtr->made_dirty = FALSE; mtr->n_log_recs = 0; mtr->n_freed_pages = 0; + mtr->trx = trx; ut_d(mtr->state = MTR_ACTIVE); ut_d(mtr->magic_n = MTR_MAGIC_N); diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h index 8bf57677ecf..b16a99b51c0 100644 --- a/storage/innobase/include/os0sync.h +++ b/storage/innobase/include/os0sync.h @@ -321,6 +321,15 @@ pfs_os_fast_mutex_unlock( os_fast_mutex_free_func(&((os_fast_mutex_t*)(M))->mutex) #endif /* UNIV_PFS_MUTEX */ +/**********************************************************//** +Acquires ownership of a fast mutex. Implies a full memory barrier even on +platforms such as PowerPC where this is not normally required. +@return 0 if success, != 0 if was reserved by another thread */ +UNIV_INLINE +ulint +os_fast_mutex_trylock_full_barrier( +/*==================*/ + os_fast_mutex_t* fast_mutex); /*!< in: mutex to acquire */ /**********************************************************//** Releases ownership of a fast mutex. */ UNIV_INTERN @@ -328,6 +337,14 @@ void os_fast_mutex_unlock_func( /*======================*/ fast_mutex_t* fast_mutex); /*!< in: mutex to release */ +/**********************************************************//** +Releases ownership of a fast mutex. Implies a full memory barrier even on +platforms such as PowerPC where this is not normally required. */ +UNIV_INTERN +void +os_fast_mutex_unlock_full_barrier( +/*=================*/ + os_fast_mutex_t* fast_mutex); /*!< in: mutex to release */ /*********************************************************//** Initializes an operating system fast mutex semaphore. */ UNIV_INTERN @@ -432,14 +449,31 @@ amount to decrement. */ /**********************************************************//** Returns the old value of *ptr, atomically sets *ptr to new_val */ -# define os_atomic_test_and_set_byte(ptr, new_val) \ - __sync_lock_test_and_set(ptr, (byte) new_val) - # define os_atomic_test_and_set_ulint(ptr, new_val) \ __sync_lock_test_and_set(ptr, new_val) -# define os_atomic_lock_release_byte(ptr) \ - __sync_lock_release(ptr) +#ifdef __powerpc__ +/* + os_atomic_test_and_set_byte_release() should imply a release barrier before + setting, and a full barrier after. But __sync_lock_test_and_set() is only + documented as an aquire barrier. So on PowerPC we need to add the full + barrier explicitly. */ +# define os_atomic_test_and_set_byte_release(ptr, new_val) \ + do { __sync_lock_release(ptr); \ + __sync_synchronize(); } while (0) +#else +/* + On x86, __sync_lock_test_and_set() happens to be full barrier, due to + LOCK prefix. +*/ +# define os_atomic_test_and_set_byte_release(ptr, new_val) \ + __sync_lock_test_and_set(ptr, (byte) new_val) +#endif +/* + os_atomic_test_and_set_byte_acquire() is a full memory barrier on x86. But + in general, just an aquire barrier should be sufficient. */ +# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \ + __sync_lock_test_and_set(ptr, (byte) new_val) #elif defined(HAVE_IB_SOLARIS_ATOMICS) @@ -517,14 +551,14 @@ amount to decrement. */ /**********************************************************//** Returns the old value of *ptr, atomically sets *ptr to new_val */ -# define os_atomic_test_and_set_byte(ptr, new_val) \ - atomic_swap_uchar(ptr, new_val) - # define os_atomic_test_and_set_ulint(ptr, new_val) \ atomic_swap_ulong(ptr, new_val) -# define os_atomic_lock_release_byte(ptr) \ - (void) atomic_swap_uchar(ptr, 0) +# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \ + atomic_swap_uchar(ptr, new_val) + +# define os_atomic_test_and_set_byte_release(ptr, new_val) \ + atomic_swap_uchar(ptr, new_val) #elif defined(HAVE_WINDOWS_ATOMICS) @@ -644,7 +678,9 @@ Returns the old value of *ptr, atomically sets *ptr to new_val. InterlockedExchange() operates on LONG, and the LONG will be clobbered */ -# define os_atomic_test_and_set_byte(ptr, new_val) \ +# define os_atomic_test_and_set_byte_acquire(ptr, new_val) \ + ((byte) InterlockedExchange(ptr, new_val)) +# define os_atomic_test_and_set_byte_release(ptr, new_val) \ ((byte) InterlockedExchange(ptr, new_val)) # define os_atomic_test_and_set_ulong(ptr, new_val) \ @@ -713,11 +749,7 @@ architecture. Disable memory barrier for Intel architecture for now. */ # define HAVE_MEMORY_BARRIER # define os_rmb __atomic_thread_fence(__ATOMIC_ACQUIRE) # define os_wmb __atomic_thread_fence(__ATOMIC_RELEASE) -#ifdef __powerpc__ -# define os_isync __asm __volatile ("isync":::"memory") -#else -#define os_isync do { } while(0) -#endif +# define os_mb __atomic_thread_fence(__ATOMIC_SEQ_CST) # define IB_MEMORY_BARRIER_STARTUP_MSG \ "GCC builtin __atomic_thread_fence() is used for memory barrier" @@ -726,7 +758,7 @@ architecture. Disable memory barrier for Intel architecture for now. */ # define HAVE_MEMORY_BARRIER # define os_rmb __sync_synchronize() # define os_wmb __sync_synchronize() -# define os_isync __sync_synchronize() +# define os_mb __sync_synchronize() # define IB_MEMORY_BARRIER_STARTUP_MSG \ "GCC builtin __sync_synchronize() is used for memory barrier" @@ -735,7 +767,7 @@ architecture. Disable memory barrier for Intel architecture for now. */ # include # define os_rmb __machine_r_barrier() # define os_wmb __machine_w_barrier() -# define os_isync os_rmb; os_wmb +# define os_mb __machine_rw_barrier() # define IB_MEMORY_BARRIER_STARTUP_MSG \ "Solaris memory ordering functions are used for memory barrier" @@ -744,17 +776,14 @@ architecture. Disable memory barrier for Intel architecture for now. */ # include # define os_rmb _mm_lfence() # define os_wmb _mm_sfence() -# define os_isync os_rmb; os_wmb +# define os_mb _mm_mfence() # define IB_MEMORY_BARRIER_STARTUP_MSG \ "_mm_lfence() and _mm_sfence() are used for memory barrier" -# define os_atomic_lock_release_byte(ptr) \ - (void) InterlockedExchange(ptr, 0) - #else # define os_rmb do { } while(0) # define os_wmb do { } while(0) -# define os_isync do { } while(0) +# define os_mb do { } while(0) # define IB_MEMORY_BARRIER_STARTUP_MSG \ "Memory barrier is not used" #endif diff --git a/storage/innobase/include/os0sync.ic b/storage/innobase/include/os0sync.ic index 9a7e520ece6..4ebf84dba98 100644 --- a/storage/innobase/include/os0sync.ic +++ b/storage/innobase/include/os0sync.ic @@ -232,3 +232,35 @@ win_cmp_and_xchg_dword( #endif /* HAVE_WINDOWS_ATOMICS */ + +/**********************************************************//** +Acquires ownership of a fast mutex. Implies a full memory barrier even on +platforms such as PowerPC where this is not normally required. +@return 0 if success, != 0 if was reserved by another thread */ +UNIV_INLINE +ulint +os_fast_mutex_trylock_full_barrier( +/*==================*/ + os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */ +{ +#ifdef __WIN__ + if (TryEnterCriticalSection(&fast_mutex->mutex)) { + + return(0); + } else { + + return(1); + } +#else + /* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock + so that it returns 0 on success. In the operating system + libraries, HP-UX-10.20 follows the old Posix 1003.4a Draft 4 and + returns 1 on success (but MySQL remaps that to 0), while Linux, + FreeBSD, Solaris, AIX, Tru64 Unix, HP-UX-11.0 return 0 on success. */ + +#ifdef __powerpc__ + os_mb; +#endif + return((ulint) pthread_mutex_trylock(&fast_mutex->mutex)); +#endif +} diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 1e0f3b30f8c..06c07002c2b 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -871,6 +871,14 @@ struct row_prebuilt_t { unsigned innodb_api:1; /*!< whether this is a InnoDB API query */ const rec_t* innodb_api_rec; /*!< InnoDB API search result */ + byte* srch_key_val1; /*!< buffer used in converting + search key values from MySQL format + to InnoDB format.*/ + byte* srch_key_val2; /*!< buffer used in converting + search key values from MySQL format + to InnoDB format.*/ + uint srch_key_val_len; /*!< Size of search key */ + }; /** Callback for row_mysql_sys_index_iterate() */ diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index e2ab81bf53a..2d90f47eefe 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -369,6 +369,10 @@ enum monitor_id_t { MONITOR_OLVD_ROW_INSERTED, MONITOR_OLVD_ROW_DELETED, MONITOR_OLVD_ROW_UPDTATED, + MONITOR_OLVD_SYSTEM_ROW_READ, + MONITOR_OLVD_SYSTEM_ROW_INSERTED, + MONITOR_OLVD_SYSTEM_ROW_DELETED, + MONITOR_OLVD_SYSTEM_ROW_UPDATED, /* Data DDL related counters */ MONITOR_MODULE_DDL_STATS, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 2b58e0717fb..c0dc7e7ccc6 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -126,6 +126,18 @@ struct srv_stats_t { /** Number of rows inserted */ ulint_ctr_64_t n_rows_inserted; + + /** Number of system rows read. */ + ulint_ctr_64_t n_system_rows_read; + + /** Number of system rows updated */ + ulint_ctr_64_t n_system_rows_updated; + + /** Number of system rows deleted */ + ulint_ctr_64_t n_system_rows_deleted; + + /** Number of system rows inserted */ + ulint_ctr_64_t n_system_rows_inserted; }; extern const char* srv_main_thread_op_info; @@ -324,10 +336,10 @@ extern ulint srv_win_file_flush_method; extern ulint srv_max_n_open_files; -extern ulong srv_max_dirty_pages_pct; -extern ulong srv_max_dirty_pages_pct_lwm; +extern double srv_max_dirty_pages_pct; +extern double srv_max_dirty_pages_pct_lwm; -extern ulong srv_adaptive_flushing_lwm; +extern double srv_adaptive_flushing_lwm; extern ulong srv_flushing_avg_loops; extern ulong srv_force_recovery; @@ -348,6 +360,8 @@ extern unsigned long long srv_stats_transient_sample_pages; extern my_bool srv_stats_persistent; extern unsigned long long srv_stats_persistent_sample_pages; extern my_bool srv_stats_auto_recalc; +extern unsigned long long srv_stats_modified_counter; +extern my_bool srv_stats_sample_traditional; extern ibool srv_use_doublewrite_buf; extern ulong srv_doublewrite_batch_size; @@ -358,7 +372,7 @@ extern ibool srv_use_atomic_writes; extern ibool srv_use_posix_fallocate; #endif -extern ulong srv_max_buf_pool_modified_pct; +extern double srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag_delay; @@ -850,6 +864,10 @@ struct export_var_t{ ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */ ulint innodb_rows_updated; /*!< srv_n_rows_updated */ ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */ + ulint innodb_system_rows_read; /*!< srv_n_system_rows_read */ + ulint innodb_system_rows_inserted; /*!< srv_n_system_rows_inserted */ + ulint innodb_system_rows_updated; /*!< srv_n_system_rows_updated */ + ulint innodb_system_rows_deleted; /*!< srv_n_system_rows_deleted*/ ulint innodb_num_open_files; /*!< fil_n_file_opened */ ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */ ulint innodb_available_undo_logs; /*!< srv_available_undo_logs */ diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h index 15dbdcb540d..0e735192024 100644 --- a/storage/innobase/include/sync0arr.h +++ b/storage/innobase/include/sync0arr.h @@ -148,6 +148,12 @@ sync_array_t* sync_array_get(void); /*================*/ +/**********************************************************************//** +Prints info of the wait array without using any mutexes/semaphores. */ +UNIV_INTERN +void +sync_array_print_innodb(void); + #ifndef UNIV_NONINL #include "sync0arr.ic" #endif diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h index 82fb353a41b..7b00e16476b 100644 --- a/storage/innobase/include/sync0sync.h +++ b/storage/innobase/include/sync0sync.h @@ -49,8 +49,6 @@ extern "C" my_bool timed_mutexes; #ifdef HAVE_WINDOWS_ATOMICS typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates on LONG variable */ -#elif defined(HAVE_ATOMIC_BUILTINS) && !defined(HAVE_ATOMIC_BUILTINS_BYTE) -typedef ulint lock_word_t; #else typedef byte lock_word_t; #endif diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index f9017230497..a5887b1fd6f 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -80,15 +80,11 @@ ib_mutex_test_and_set( ib_mutex_t* mutex) /*!< in: mutex */ { #if defined(HAVE_ATOMIC_BUILTINS) -# if defined(HAVE_ATOMIC_BUILTINS_BYTE) - return(os_atomic_test_and_set_byte(&mutex->lock_word, 1)); -# else - return(os_atomic_test_and_set_ulint(&mutex->lock_word, 1)); -# endif + return(os_atomic_test_and_set_byte_acquire(&mutex->lock_word, 1)); #else ibool ret; - ret = os_fast_mutex_trylock(&(mutex->os_fast_mutex)); + ret = os_fast_mutex_trylock_full_barrier(&(mutex->os_fast_mutex)); if (ret == 0) { /* We check that os_fast_mutex_trylock does not leak @@ -96,7 +92,6 @@ ib_mutex_test_and_set( ut_a(mutex->lock_word == 0); mutex->lock_word = 1; - os_wmb; } return((byte) ret); @@ -113,11 +108,14 @@ mutex_reset_lock_word( ib_mutex_t* mutex) /*!< in: mutex */ { #if defined(HAVE_ATOMIC_BUILTINS) - os_atomic_lock_release_byte(&mutex->lock_word); + /* In theory __sync_lock_release should be used to release the lock. + Unfortunately, it does not work properly alone. The workaround is + that more conservative __sync_lock_test_and_set is used instead. */ + os_atomic_test_and_set_byte_release(&mutex->lock_word, 0); #else mutex->lock_word = 0; - os_fast_mutex_unlock(&(mutex->os_fast_mutex)); + os_fast_mutex_unlock_full_barrier(&(mutex->os_fast_mutex)); #endif } @@ -149,7 +147,6 @@ mutex_get_waiters( ptr = &(mutex->waiters); - os_rmb; return(*ptr); /* Here we assume that the read of a single word from memory is atomic */ } @@ -184,7 +181,6 @@ mutex_exit_func( to wake up possible hanging threads if they are missed in mutex_signal_object. */ - os_isync; if (mutex_get_waiters(mutex) != 0) { mutex_signal_object(mutex); diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 61b0dabb1e6..660551961a6 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -243,22 +243,13 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end_func( +trx_undo_truncate_end( /*=======================*/ -#ifdef UNIV_DEBUG - const trx_t* trx, /*!< in: transaction whose undo log it is */ -#endif /* UNIV_DEBUG */ + trx_t* trx, /*!< in: transaction whose undo log it is */ trx_undo_t* undo, /*!< in/out: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ __attribute__((nonnull)); -#ifdef UNIV_DEBUG -# define trx_undo_truncate_end(trx,undo,limit) \ - trx_undo_truncate_end_func(trx,undo,limit) -#else /* UNIV_DEBUG */ -# define trx_undo_truncate_end(trx,undo,limit) \ - trx_undo_truncate_end_func(undo,limit) -#endif /* UNIV_DEBUG */ /***********************************************************************//** Truncates an undo log from the start. This function is used during a purge diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 2635fca3220..eeeaca166a8 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -44,7 +44,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 20 +#define INNODB_VERSION_BUGFIX 21 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; diff --git a/storage/innobase/include/ut0counter.h b/storage/innobase/include/ut0counter.h index fe0f36dfff2..63a133a175d 100644 --- a/storage/innobase/include/ut0counter.h +++ b/storage/innobase/include/ut0counter.h @@ -32,7 +32,11 @@ Created 2012/04/12 by Sunny Bains #include "os0thread.h" /** CPU cache line size */ +#ifdef __powerpc__ +#define CACHE_LINE_SIZE 128 +#else #define CACHE_LINE_SIZE 64 +#endif /** Default number of slots to use in ib_counter_t */ #define IB_N_SLOTS 64 diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 65cd15cc667..97941c0e826 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6460,6 +6460,7 @@ lock_rec_insert_check_and_lock( lock_t* lock; dberr_t err; ulint next_rec_heap_no; + ibool inherit_in = *inherit; #ifdef WITH_WSREP lock_t* c_lock=NULL; #endif @@ -6495,7 +6496,7 @@ lock_rec_insert_check_and_lock( lock_mutex_exit(); - if (!dict_index_is_clust(index)) { + if (inherit_in && !dict_index_is_clust(index)) { /* Update the page max trx id field */ page_update_max_trx_id(block, buf_block_get_page_zip(block), @@ -6556,7 +6557,7 @@ lock_rec_insert_check_and_lock( err = DB_SUCCESS; /* fall through */ case DB_SUCCESS: - if (dict_index_is_clust(index)) { + if (!inherit_in || dict_index_is_clust(index)) { break; } /* Update the page max trx id field */ diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 388c847f580..579b95a5ebd 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -281,10 +281,6 @@ lock_wait_suspend_thread( } } - /* Wake the lock timeout monitor thread, if it is suspended */ - - os_event_set(lock_sys->timeout_event); - lock_wait_mutex_exit(); trx_mutex_exit(trx); diff --git a/storage/innobase/mysql-test/storage_engine/disabled.def b/storage/innobase/mysql-test/storage_engine/disabled.def index 2f3793047f4..bad10099bbf 100644 --- a/storage/innobase/mysql-test/storage_engine/disabled.def +++ b/storage/innobase/mysql-test/storage_engine/disabled.def @@ -1,4 +1,3 @@ -autoinc_vars : MySQL:65225 (InnoDB miscalculates auto-increment) tbl_opt_ai : MySQL:65901 (AUTO_INCREMENT option on InnoDB table is ignored if added before autoinc column) delete_low_prio : InnoDB does not use table-level locking insert_high_prio : InnoDB does not use table-level locking diff --git a/storage/innobase/os/os0sync.cc b/storage/innobase/os/os0sync.cc index e42c5900c0c..451ba5285e3 100644 --- a/storage/innobase/os/os0sync.cc +++ b/storage/innobase/os/os0sync.cc @@ -686,7 +686,7 @@ os_event_wait_time_low( tv.tv_usec += time_in_usec; if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) { - tv.tv_sec += time_in_usec / MICROSECS_IN_A_SECOND; + tv.tv_sec += tv.tv_usec / MICROSECS_IN_A_SECOND; tv.tv_usec %= MICROSECS_IN_A_SECOND; } @@ -889,6 +889,25 @@ os_fast_mutex_unlock_func( #endif } +/**********************************************************//** +Releases ownership of a fast mutex. Implies a full memory barrier even on +platforms such as PowerPC where this is not normally required. */ +UNIV_INTERN +void +os_fast_mutex_unlock_full_barrier( +/*=================*/ + os_fast_mutex_t* fast_mutex) /*!< in: mutex to release */ +{ +#ifdef __WIN__ + LeaveCriticalSection(&fast_mutex->mutex); +#else + pthread_mutex_unlock(&fast_mutex->mutex); +#ifdef __powerpc__ + os_mb; +#endif +#endif +} + /**********************************************************//** Frees a mutex object. */ UNIV_INTERN diff --git a/storage/innobase/row/row0ext.cc b/storage/innobase/row/row0ext.cc index 32b78391d6a..ad852577ad2 100644 --- a/storage/innobase/row/row0ext.cc +++ b/storage/innobase/row/row0ext.cc @@ -78,7 +78,8 @@ row_ext_cache_fill( crashed during the execution of btr_free_externally_stored_field(). */ ext->len[i] = btr_copy_externally_stored_field_prefix( - buf, ext->max_len, zip_size, field, f_len); + buf, ext->max_len, zip_size, field, f_len, + NULL); } } } diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 94af15dc658..b11a9f0d85a 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -660,7 +660,8 @@ loop: doc.text.f_str = btr_copy_externally_stored_field( &doc.text.f_len, data, - zip_size, data_len, blob_heap); + zip_size, data_len, blob_heap, + NULL); } else { doc.text.f_str = data; doc.text.f_len = data_len; diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index c45d6554627..44c9ac32d16 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1314,7 +1314,7 @@ row_ins_foreign_check_on_constraint( row_mysql_freeze_data_dictionary(thr_get_trx(thr)); - mtr_start(mtr); + mtr_start_trx(mtr, trx); /* Restore pcur position */ @@ -1342,7 +1342,7 @@ nonstandard_exit_func: btr_pcur_store_position(pcur, mtr); mtr_commit(mtr); - mtr_start(mtr); + mtr_start_trx(mtr, trx); btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr); @@ -1550,7 +1550,7 @@ run_again: } } - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Store old value on n_fields_cmp */ @@ -1973,7 +1973,7 @@ row_ins_scan_sec_index_for_duplicate( do { const rec_t* rec = btr_pcur_get_rec(&pcur); const buf_block_t* block = btr_pcur_get_block(&pcur); - ulint lock_type; + const ulint lock_type = LOCK_ORDINARY; if (page_rec_is_infimum(rec)) { @@ -1983,16 +1983,6 @@ row_ins_scan_sec_index_for_duplicate( offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &offsets_heap); - /* If the transaction isolation level is no stronger than - READ COMMITTED, then avoid gap locks. */ - if (!page_rec_is_supremum(rec) - && thr_get_trx(thr)->isolation_level - <= TRX_ISO_READ_COMMITTED) { - lock_type = LOCK_REC_NOT_GAP; - } else { - lock_type = LOCK_ORDINARY; - } - if (flags & BTR_NO_LOCKING_FLAG) { /* Set no locks when applying log in online table rebuild. */ @@ -2358,7 +2348,7 @@ row_ins_clust_index_entry_low( || n_uniq == dict_index_get_n_unique(index)); ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index)); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) { mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; @@ -2571,9 +2561,10 @@ Starts a mini-transaction and checks if the index will be dropped. @return true if the index is to be dropped */ static __attribute__((nonnull, warn_unused_result)) bool -row_ins_sec_mtr_start_and_check_if_aborted( +row_ins_sec_mtr_start_trx_and_check_if_aborted( /*=======================================*/ mtr_t* mtr, /*!< out: mini-transaction */ + trx_t* trx, /*!< in: transaction handle */ dict_index_t* index, /*!< in/out: secondary index */ bool check, /*!< in: whether to check */ ulint search_mode) @@ -2581,7 +2572,7 @@ row_ins_sec_mtr_start_and_check_if_aborted( { ut_ad(!dict_index_is_clust(index)); - mtr_start(mtr); + mtr_start_trx(mtr, trx); if (!check) { return(false); @@ -2639,13 +2630,14 @@ row_ins_sec_index_entry_low( ulint n_unique; mtr_t mtr; ulint* offsets = NULL; + trx_t* trx = thr_get_trx(thr); ut_ad(!dict_index_is_clust(index)); ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE); cursor.thr = thr; ut_ad(thr_get_trx(thr)->id); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Ensure that we acquire index->lock when inserting into an index with index->online_status == ONLINE_INDEX_COMPLETE, but @@ -2706,8 +2698,8 @@ row_ins_sec_index_entry_low( DEBUG_SYNC_C("row_ins_sec_index_unique"); - if (row_ins_sec_mtr_start_and_check_if_aborted( - &mtr, index, check, search_mode)) { + if (row_ins_sec_mtr_start_trx_and_check_if_aborted( + &mtr, trx, index, check, search_mode)) { goto func_exit; } @@ -2741,8 +2733,8 @@ row_ins_sec_index_entry_low( return(err); } - if (row_ins_sec_mtr_start_and_check_if_aborted( - &mtr, index, check, search_mode)) { + if (row_ins_sec_mtr_start_trx_and_check_if_aborted( + &mtr, trx, index, check, search_mode)) { goto func_exit; } diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 24abd885f60..fd0c54d889b 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -980,7 +980,7 @@ row_log_table_get_pk_col( mem_heap_alloc(heap, field_len)); len = btr_copy_externally_stored_field_prefix( - blob_field, field_len, zip_size, field, len); + blob_field, field_len, zip_size, field, len, NULL); if (len >= max_len + 1) { return(DB_TOO_BIG_INDEX_COL); } @@ -1371,7 +1371,7 @@ row_log_table_apply_convert_mrec( data = btr_rec_copy_externally_stored_field( mrec, offsets, dict_table_zip_size(index->table), - i, &len, heap); + i, &len, heap, NULL); ut_a(data); dfield_set_data(dfield, data, len); blob_done: diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 86b47c9f3bd..e9d8bd50d6a 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2246,7 +2246,7 @@ row_merge_copy_blobs( BLOB pointers are read (row_merge_read_clustered_index()) and dereferenced (below). */ data = btr_rec_copy_externally_stored_field( - mrec, offsets, zip_size, i, &len, heap); + mrec, offsets, zip_size, i, &len, heap, NULL); /* Because we have locked the table, any records written by incomplete transactions must have been rolled back already. There must not be any incomplete diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index ca70543a97b..1138aa410cc 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -33,6 +33,7 @@ Created 9/17/2000 Heikki Tuuri #include #include +#include #include "row0ins.h" #include "row0merge.h" #include "row0sel.h" @@ -711,8 +712,10 @@ row_create_prebuilt( row_prebuilt_t* prebuilt; mem_heap_t* heap; dict_index_t* clust_index; + dict_index_t* temp_index; dtuple_t* ref; ulint ref_len; + uint srch_key_len = 0; ulint search_tuple_n_fields; search_tuple_n_fields = 2 * dict_table_get_n_cols(table); @@ -724,6 +727,14 @@ row_create_prebuilt( ref_len = dict_index_get_n_unique(clust_index); + + /* Maximum size of the buffer needed for conversion of INTs from + little endian format to big endian format in an index. An index + can have maximum 16 columns (MAX_REF_PARTS) in it. Therfore + Max size for PK: 16 * 8 bytes (BIGINT's size) = 128 bytes + Max size Secondary index: 16 * 8 bytes + PK = 256 bytes. */ +#define MAX_SRCH_KEY_VAL_BUFFER 2* (8 * MAX_REF_PARTS) + #define PREBUILT_HEAP_INITIAL_SIZE \ ( \ sizeof(*prebuilt) \ @@ -752,10 +763,38 @@ row_create_prebuilt( + sizeof(que_thr_t) \ ) + /* Calculate size of key buffer used to store search key in + InnoDB format. MySQL stores INTs in little endian format and + InnoDB stores INTs in big endian format with the sign bit + flipped. All other field types are stored/compared the same + in MySQL and InnoDB, so we must create a buffer containing + the INT key parts in InnoDB format.We need two such buffers + since both start and end keys are used in records_in_range(). */ + + for (temp_index = dict_table_get_first_index(table); temp_index; + temp_index = dict_table_get_next_index(temp_index)) { + DBUG_EXECUTE_IF("innodb_srch_key_buffer_max_value", + ut_a(temp_index->n_user_defined_cols + == MAX_REF_PARTS);); + uint temp_len = 0; + for (uint i = 0; i < temp_index->n_uniq; i++) { + if (temp_index->fields[i].col->mtype == DATA_INT) { + temp_len += + temp_index->fields[i].fixed_len; + } + } + srch_key_len = max(srch_key_len,temp_len); + } + + ut_a(srch_key_len <= MAX_SRCH_KEY_VAL_BUFFER); + + DBUG_EXECUTE_IF("innodb_srch_key_buffer_max_value", + ut_a(srch_key_len == MAX_SRCH_KEY_VAL_BUFFER);); + /* We allocate enough space for the objects that are likely to be created later in order to minimize the number of malloc() calls */ - heap = mem_heap_create(PREBUILT_HEAP_INITIAL_SIZE); + heap = mem_heap_create(PREBUILT_HEAP_INITIAL_SIZE + 2 * srch_key_len); prebuilt = static_cast( mem_heap_zalloc(heap, sizeof(*prebuilt))); @@ -768,6 +807,18 @@ row_create_prebuilt( prebuilt->sql_stat_start = TRUE; prebuilt->heap = heap; + prebuilt->srch_key_val_len = srch_key_len; + if (prebuilt->srch_key_val_len) { + prebuilt->srch_key_val1 = static_cast( + mem_heap_alloc(prebuilt->heap, + 2 * prebuilt->srch_key_val_len)); + prebuilt->srch_key_val2 = prebuilt->srch_key_val1 + + prebuilt->srch_key_val_len; + } else { + prebuilt->srch_key_val1 = NULL; + prebuilt->srch_key_val2 = NULL; + } + btr_pcur_reset(&prebuilt->pcur); btr_pcur_reset(&prebuilt->clust_pcur); @@ -1055,8 +1106,11 @@ row_update_statistics_if_needed( since the last time a statistics batch was run. We calculate statistics at most every 16th round, since we may have a counter table which is very small and updated very often. */ + ib_uint64_t threshold= 16 + n_rows / 16; /* 6.25% */ + if (srv_stats_modified_counter) + threshold= ut_min(srv_stats_modified_counter, threshold); - if (counter > 16 + n_rows / 16 /* 6.25% */) { + if (counter > threshold) { ut_ad(!mutex_own(&dict_sys->mutex)); /* this will reset table->stat_modified_counter to 0 */ @@ -1394,7 +1448,11 @@ error_exit: que_thr_stop_for_mysql_no_error(thr, trx); - srv_stats.n_rows_inserted.add((size_t)trx->id, 1); + if (table->is_system_db) { + srv_stats.n_system_rows_inserted.add((size_t)trx->id, 1); + } else { + srv_stats.n_rows_inserted.add((size_t)trx->id, 1); + } /* Not protected by dict_table_stats_lock() for performance reasons, we would rather get garbage in stat_n_rows (which is @@ -1784,9 +1842,20 @@ run_again: with a latch. */ dict_table_n_rows_dec(prebuilt->table); - srv_stats.n_rows_deleted.add((size_t)trx->id, 1); + if (table->is_system_db) { + srv_stats.n_system_rows_deleted.add( + (size_t)trx->id, 1); + } else { + srv_stats.n_rows_deleted.add((size_t)trx->id, 1); + } + } else { - srv_stats.n_rows_updated.add((size_t)trx->id, 1); + if (table->is_system_db) { + srv_stats.n_system_rows_updated.add( + (size_t)trx->id, 1); + } else { + srv_stats.n_rows_updated.add((size_t)trx->id, 1); + } } /* We update table statistics only if it is a DELETE or UPDATE @@ -1850,7 +1919,7 @@ row_unlock_for_mysql( trx_id_t rec_trx_id; mtr_t mtr; - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Restore the cursor position and find the record */ @@ -2010,9 +2079,19 @@ run_again: with a latch. */ dict_table_n_rows_dec(table); - srv_stats.n_rows_deleted.add((size_t)trx->id, 1); + if (table->is_system_db) { + srv_stats.n_system_rows_deleted.add( + (size_t)trx->id, 1); + } else { + srv_stats.n_rows_deleted.add((size_t)trx->id, 1); + } } else { - srv_stats.n_rows_updated.add((size_t)trx->id, 1); + if (table->is_system_db) { + srv_stats.n_system_rows_updated.add( + (size_t)trx->id, 1); + } else { + srv_stats.n_rows_updated.add((size_t)trx->id, 1); + } } row_update_statistics_if_needed(table); @@ -2200,23 +2279,23 @@ err_exit: /* The lock timeout monitor thread also takes care of InnoDB monitor prints */ - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); } else if (STR_EQ(table_name, table_name_len, S_innodb_lock_monitor)) { srv_print_innodb_monitor = TRUE; srv_print_innodb_lock_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); } else if (STR_EQ(table_name, table_name_len, S_innodb_tablespace_monitor)) { srv_print_innodb_tablespace_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); } else if (STR_EQ(table_name, table_name_len, S_innodb_table_monitor)) { srv_print_innodb_table_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); #ifdef UNIV_MEM_DEBUG } else if (STR_EQ(table_name, table_name_len, S_innodb_mem_validate)) { @@ -2839,7 +2918,7 @@ row_discard_tablespace_foreign_key_checks( /* Check if the table is referenced by foreign key constraints from some other table (not the table itself) */ - dict_foreign_set::iterator it + dict_foreign_set::const_iterator it = std::find_if(table->referenced_set.begin(), table->referenced_set.end(), dict_foreign_different_tables()); @@ -3412,7 +3491,7 @@ row_truncate_table_for_mysql( index = dict_table_get_next_index(index); } while (index); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); fsp_header_init(space, FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); @@ -3441,7 +3520,7 @@ row_truncate_table_for_mysql( sys_index = dict_table_get_first_index(dict_sys->sys_indexes); dict_index_copy_types(tuple, sys_index, 1); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &pcur, &mtr); for (;;) { @@ -3488,7 +3567,7 @@ row_truncate_table_for_mysql( a page in this mini-transaction, and the rest of this loop could latch another index page. */ mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr); } diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 1b836c26c25..8212a7b43e0 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -337,9 +337,24 @@ row_purge_remove_sec_if_poss_tree( if (row_purge_poss_sec(node, index, entry)) { /* Remove the index record, which should have been marked for deletion. */ - ut_ad(REC_INFO_DELETED_FLAG - & rec_get_info_bits(btr_cur_get_rec(btr_cur), - dict_table_is_comp(index->table))); + if (!rec_get_deleted_flag(btr_cur_get_rec(btr_cur), + dict_table_is_comp(index->table))) { + fputs("InnoDB: tried to purge sec index entry not" + " marked for deletion in\n" + "InnoDB: ", stderr); + dict_index_name_print(stderr, NULL, index); + fputs("\n" + "InnoDB: tuple ", stderr); + dtuple_print(stderr, entry); + fputs("\n" + "InnoDB: record ", stderr); + rec_print(stderr, btr_cur_get_rec(btr_cur), index); + putc('\n', stderr); + + ut_ad(0); + + goto func_exit; + } btr_cur_pessimistic_delete(&err, FALSE, btr_cur, 0, RB_NONE, &mtr); @@ -428,10 +443,29 @@ row_purge_remove_sec_if_poss_leaf( btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur); /* Only delete-marked records should be purged. */ - ut_ad(REC_INFO_DELETED_FLAG - & rec_get_info_bits( - btr_cur_get_rec(btr_cur), - dict_table_is_comp(index->table))); + if (!rec_get_deleted_flag( + btr_cur_get_rec(btr_cur), + dict_table_is_comp(index->table))) { + + fputs("InnoDB: tried to purge sec index" + " entry not marked for deletion in\n" + "InnoDB: ", stderr); + dict_index_name_print(stderr, NULL, index); + fputs("\n" + "InnoDB: tuple ", stderr); + dtuple_print(stderr, entry); + fputs("\n" + "InnoDB: record ", stderr); + rec_print(stderr, btr_cur_get_rec(btr_cur), + index); + putc('\n', stderr); + + ut_ad(0); + + btr_pcur_close(&pcur); + + goto func_exit_no_pcur; + } if (!btr_cur_optimistic_delete(btr_cur, 0, &mtr)) { diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index e5a7694cb93..69c8498839e 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -132,7 +132,8 @@ row_sel_sec_rec_is_for_blob( len = btr_copy_externally_stored_field_prefix(buf, prefix_len, zip_size, - clust_field, clust_len); + clust_field, clust_len, + NULL); if (UNIV_UNLIKELY(len == 0)) { /* The BLOB was being deleted as the server crashed. @@ -451,7 +452,7 @@ row_sel_fetch_columns( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(index->table), - field_no, &len, heap); + field_no, &len, heap, NULL); /* data == NULL means that the externally stored field was not @@ -1398,7 +1399,7 @@ table_loop: /* Open a cursor to index, or restore an open cursor position */ - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); if (consistent_read && plan->unique_search && !plan->pcur_is_open && !plan->must_get_clust @@ -1438,7 +1439,7 @@ table_loop: plan_reset_cursor(plan); mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); } if (search_latch_locked) { @@ -2450,13 +2451,12 @@ row_sel_convert_mysql_key_to_innobase( /* Storing may use at most data_len bytes of buf */ if (UNIV_LIKELY(!is_null)) { - ut_a(buf + data_len <= original_buf + buf_len); - row_mysql_store_col_in_innobase_format( - dfield, buf, - FALSE, /* MySQL key value format col */ - key_ptr + data_offset, data_len, - dict_table_is_comp(index->table)); - buf += data_len; + buf = row_mysql_store_col_in_innobase_format( + dfield, buf, + FALSE, /* MySQL key value format col */ + key_ptr + data_offset, data_len, + dict_table_is_comp(index->table)); + ut_a(buf <= original_buf + buf_len); } key_ptr += data_field_len; @@ -2500,9 +2500,6 @@ row_sel_convert_mysql_key_to_innobase( dfield++; } - DBUG_EXECUTE_IF("innodb_srch_key_buffer_full", - ut_a(buf == (original_buf + buf_len));); - ut_a(buf <= original_buf + buf_len); /* We set the length of tuple to n_fields: we assume that the memory @@ -2809,7 +2806,7 @@ row_sel_store_mysql_field_func( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(prebuilt->table), - field_no, &len, heap); + field_no, &len, heap, NULL); if (UNIV_UNLIKELY(!data)) { /* The externally stored field was not written @@ -3885,7 +3882,7 @@ row_search_for_mysql( } } - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /*-------------------------------------------------------------*/ /* PHASE 2: Try fast adaptive hash index search if possible */ @@ -4015,7 +4012,7 @@ release_search_latch_if_needed: } mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); } } @@ -5002,7 +4999,7 @@ next_rec: mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); if (sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr)) { @@ -5067,7 +5064,7 @@ lock_table_wait: /* It was a lock wait, and it ended */ thr->lock_state = QUE_THR_LOCK_NOLOCK; - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* Table lock waited, go try to obtain table lock again */ diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index e513d3d6d8b..8580aa45145 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -297,7 +297,7 @@ row_undo_mod_clust( pcur = &node->pcur; index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur)); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); online = dict_index_is_online_ddl(index); if (online) { @@ -326,7 +326,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); err = row_undo_mod_clust_low( node, &offsets, &offsets_heap, @@ -371,7 +371,7 @@ row_undo_mod_clust( if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) { - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); /* It is not necessary to call row_log_table, because the record is delete-marked and would thus @@ -384,7 +384,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); err = row_undo_mod_remove_clust_low(node, thr, &mtr, BTR_MODIFY_TREE); @@ -431,7 +431,7 @@ row_undo_mod_del_mark_or_remove_sec_low( enum row_search_result search_result; log_free_check(); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); if (*index->name == TEMP_INDEX_PREFIX) { /* The index->online_status may change if the @@ -487,7 +487,7 @@ row_undo_mod_del_mark_or_remove_sec_low( which cannot be purged yet, requires its existence. If some requires, we should delete mark the record. */ - mtr_start(&mtr_vers); + mtr_start_trx(&mtr_vers, thr_get_trx(thr)); success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur), &mtr_vers); @@ -603,7 +603,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( ut_ad(trx->id); log_free_check(); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); if (*index->name == TEMP_INDEX_PREFIX) { /* The index->online_status may change if the diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 5f4b48652b3..526c86c453f 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -258,7 +258,7 @@ row_upd_check_references_constraints( DEBUG_SYNC_C("foreign_constraint_check_for_update"); - mtr_start(mtr); + mtr_start_trx(mtr, trx); if (trx->dict_operation_lock_mode == 0) { got_s_lock = TRUE; @@ -1149,7 +1149,7 @@ row_upd_ext_fetch( byte* buf = static_cast(mem_heap_alloc(heap, *len)); *len = btr_copy_externally_stored_field_prefix( - buf, *len, zip_size, data, local_len); + buf, *len, zip_size, data, local_len, NULL); /* We should never update records containing a half-deleted BLOB. */ ut_a(*len); @@ -1853,7 +1853,7 @@ row_upd_sec_index_entry( } #endif /* UNIV_DEBUG */ - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); if (*index->name == TEMP_INDEX_PREFIX) { /* The index->online_status may change if the @@ -2388,7 +2388,7 @@ row_upd_clust_rec( /* We may have to modify the tree structure: do a pessimistic descent down the index tree */ - mtr_start(mtr); + mtr_start_trx(mtr, thr_get_trx(thr)); /* NOTE: this transaction has an s-lock or x-lock on the record and therefore other transactions cannot modify the record when we have no @@ -2600,7 +2600,7 @@ row_upd_clust_step( /* We have to restore the cursor to its position */ - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); /* If the restoration does not succeed, then the same transaction has deleted the record on which the cursor was, @@ -2654,7 +2654,7 @@ row_upd_clust_step( mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, thr_get_trx(thr)); success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, &mtr); diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 64417b1e5fb..f29621bc90a 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1165,6 +1165,26 @@ static monitor_info_t innodb_counter_info[] = MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_UPDTATED}, + {"dml_system_reads", "dml", "Number of system rows read", + static_cast( + MONITOR_EXISTING | MONITOR_DEFAULT_ON), + MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_READ}, + + {"dml_system_inserts", "dml", "Number of system rows inserted", + static_cast( + MONITOR_EXISTING | MONITOR_DEFAULT_ON), + MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_INSERTED}, + + {"dml_system_deletes", "dml", "Number of system rows deleted", + static_cast( + MONITOR_EXISTING | MONITOR_DEFAULT_ON), + MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_DELETED}, + + {"dml_system_updates", "dml", "Number of system rows updated", + static_cast( + MONITOR_EXISTING | MONITOR_DEFAULT_ON), + MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_UPDATED}, + /* ========== Counters for DDL operations ========== */ {"module_ddl", "ddl", "Statistics for DDLs", MONITOR_MODULE, @@ -1683,6 +1703,26 @@ srv_mon_process_existing_counter( value = srv_stats.n_rows_updated; break; + /* innodb_system_rows_read */ + case MONITOR_OLVD_SYSTEM_ROW_READ: + value = srv_stats.n_system_rows_read; + break; + + /* innodb_system_rows_inserted */ + case MONITOR_OLVD_SYSTEM_ROW_INSERTED: + value = srv_stats.n_system_rows_inserted; + break; + + /* innodb_system_rows_deleted */ + case MONITOR_OLVD_SYSTEM_ROW_DELETED: + value = srv_stats.n_system_rows_deleted; + break; + + /* innodb_system_rows_updated */ + case MONITOR_OLVD_SYSTEM_ROW_UPDATED: + value = srv_stats.n_system_rows_updated; + break; + /* innodb_row_lock_current_waits */ case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT: value = srv_stats.n_lock_wait_current_count; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 758e94efbc7..c754544b136 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -284,12 +284,12 @@ in the buffer pool to all database pages in the buffer pool smaller than the following number. But it is not guaranteed that the value stays below that during a time of heavy update/insert activity. */ -UNIV_INTERN ulong srv_max_buf_pool_modified_pct = 75; -UNIV_INTERN ulong srv_max_dirty_pages_pct_lwm = 50; +UNIV_INTERN double srv_max_buf_pool_modified_pct = 75.0; +UNIV_INTERN double srv_max_dirty_pages_pct_lwm = 50.0; /* This is the percentage of log capacity at which adaptive flushing, if enabled, will kick in. */ -UNIV_INTERN ulong srv_adaptive_flushing_lwm = 10; +UNIV_INTERN double srv_adaptive_flushing_lwm = 10.0; /* Number of iterations over which adaptive flushing is averaged. */ UNIV_INTERN ulong srv_flushing_avg_loops = 30; @@ -348,6 +348,14 @@ UNIV_INTERN my_bool srv_stats_persistent = TRUE; UNIV_INTERN unsigned long long srv_stats_persistent_sample_pages = 20; UNIV_INTERN my_bool srv_stats_auto_recalc = TRUE; +/* The number of rows modified before we calculate new statistics (default 0 += current limits) */ +UNIV_INTERN unsigned long long srv_stats_modified_counter = 0; + +/* Enable traditional statistic calculation based on number of configured +pages default true. */ +UNIV_INTERN my_bool srv_stats_sample_traditional = TRUE; + UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE; /** doublewrite buffer is 1MB is size i.e.: it can hold 128 16K pages. @@ -385,6 +393,10 @@ static ulint srv_n_rows_inserted_old = 0; static ulint srv_n_rows_updated_old = 0; static ulint srv_n_rows_deleted_old = 0; static ulint srv_n_rows_read_old = 0; +static ulint srv_n_system_rows_inserted_old = 0; +static ulint srv_n_system_rows_updated_old = 0; +static ulint srv_n_system_rows_deleted_old = 0; +static ulint srv_n_system_rows_read_old = 0; UNIV_INTERN ulint srv_truncated_status_writes = 0; UNIV_INTERN ulint srv_available_undo_logs = 0; @@ -1009,6 +1021,8 @@ srv_init(void) trx_i_s_cache_init(trx_i_s_cache); ut_crc32_init(); + + dict_mem_init(); } /*********************************************************************//** @@ -1126,6 +1140,11 @@ srv_refresh_innodb_monitor_stats(void) srv_n_rows_deleted_old = srv_stats.n_rows_deleted; srv_n_rows_read_old = srv_stats.n_rows_read; + srv_n_system_rows_inserted_old = srv_stats.n_system_rows_inserted; + srv_n_system_rows_updated_old = srv_stats.n_system_rows_updated; + srv_n_system_rows_deleted_old = srv_stats.n_system_rows_deleted; + srv_n_system_rows_read_old = srv_stats.n_system_rows_read; + mutex_exit(&srv_innodb_monitor_mutex); } @@ -1317,11 +1336,33 @@ srv_printf_innodb_monitor( / time_elapsed, ((ulint) srv_stats.n_rows_read - srv_n_rows_read_old) / time_elapsed); - + fprintf(file, + "Number of system rows inserted " ULINTPF + ", updated " ULINTPF ", deleted " ULINTPF + ", read " ULINTPF "\n", + (ulint) srv_stats.n_system_rows_inserted, + (ulint) srv_stats.n_system_rows_updated, + (ulint) srv_stats.n_system_rows_deleted, + (ulint) srv_stats.n_system_rows_read); + fprintf(file, + "%.2f inserts/s, %.2f updates/s," + " %.2f deletes/s, %.2f reads/s\n", + ((ulint) srv_stats.n_system_rows_inserted + - srv_n_system_rows_inserted_old) / time_elapsed, + ((ulint) srv_stats.n_system_rows_updated + - srv_n_system_rows_updated_old) / time_elapsed, + ((ulint) srv_stats.n_system_rows_deleted + - srv_n_system_rows_deleted_old) / time_elapsed, + ((ulint) srv_stats.n_system_rows_read + - srv_n_system_rows_read_old) / time_elapsed); srv_n_rows_inserted_old = srv_stats.n_rows_inserted; srv_n_rows_updated_old = srv_stats.n_rows_updated; srv_n_rows_deleted_old = srv_stats.n_rows_deleted; srv_n_rows_read_old = srv_stats.n_rows_read; + srv_n_system_rows_inserted_old = srv_stats.n_system_rows_inserted; + srv_n_system_rows_updated_old = srv_stats.n_system_rows_updated; + srv_n_system_rows_deleted_old = srv_stats.n_system_rows_deleted; + srv_n_system_rows_read_old = srv_stats.n_system_rows_read; fputs("----------------------------\n" "END OF INNODB MONITOR OUTPUT\n" @@ -1476,6 +1517,17 @@ srv_export_innodb_status(void) export_vars.innodb_rows_deleted = srv_stats.n_rows_deleted; + export_vars.innodb_system_rows_read = srv_stats.n_system_rows_read; + + export_vars.innodb_system_rows_inserted = + srv_stats.n_system_rows_inserted; + + export_vars.innodb_system_rows_updated = + srv_stats.n_system_rows_updated; + + export_vars.innodb_system_rows_deleted = + srv_stats.n_system_rows_deleted; + export_vars.innodb_num_open_files = fil_n_file_opened; export_vars.innodb_truncated_status_writes = diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index f643e5b794f..10c201e990e 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -1074,7 +1074,7 @@ sync_array_print_long_waits( (ulong) os_file_n_pending_pwrites); srv_print_innodb_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + os_event_set(srv_monitor_event); os_thread_sleep(30000000); @@ -1219,3 +1219,66 @@ sync_array_get(void) return(sync_wait_array[i % sync_array_size]); } + +/**********************************************************************//** +Prints info of the wait array without using any mutexes/semaphores. */ +UNIV_INTERN +void +sync_array_print_innodb(void) +/*=========================*/ +{ + ulint i; + sync_array_t* arr = sync_array_get(); + + fputs("InnoDB: Semaphore wait debug output started for InnoDB:\n", stderr); + + for (i = 0; i < arr->n_cells; i++) { + void* wait_object; + sync_cell_t* cell; + os_thread_id_t reserver=(os_thread_id_t)ULINT_UNDEFINED; + ulint loop=0; + + cell = sync_array_get_nth_cell(arr, i); + + wait_object = cell->wait_object; + + if (wait_object == NULL || !cell->waiting) { + + continue; + } + + fputs("InnoDB: Warning: semaphore wait:\n", + stderr); + sync_array_cell_print(stderr, cell, &reserver); + + /* Try to output cell information for writer recursive way */ + while (reserver != (os_thread_id_t)ULINT_UNDEFINED) { + sync_cell_t* reserver_wait; + + reserver_wait = sync_array_find_thread(arr, reserver); + + if (reserver_wait && + reserver_wait->wait_object != NULL && + reserver_wait->waiting) { + fputs("InnoDB: Warning: Writer thread is waiting this semaphore:\n", + stderr); + sync_array_cell_print(stderr, reserver_wait, &reserver); + + if (reserver_wait->thread == reserver) { + reserver = (os_thread_id_t)ULINT_UNDEFINED; + } + } else { + reserver = (os_thread_id_t)ULINT_UNDEFINED; + } + + /* This is protection against loop */ + if (loop > 100) { + fputs("InnoDB: Warning: Too many waiting threads.\n", stderr); + break; + } + } + } + + fputs("InnoDB: Semaphore wait debug output ended:\n", stderr); + +} diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc index 6494191bfe9..fb559f26bd4 100644 --- a/storage/innobase/sync/sync0sync.cc +++ b/storage/innobase/sync/sync0sync.cc @@ -457,8 +457,6 @@ mutex_set_waiters( ptr = &(mutex->waiters); - os_wmb; - *ptr = n; /* Here we assume that the write of a single word in memory is atomic */ } @@ -553,6 +551,11 @@ spin_loop: mutex_set_waiters(mutex, 1); + /* Make sure waiters store won't pass over mutex_test_and_set */ +#ifdef __powerpc__ + os_mb; +#endif + /* Try to reserve still a few times */ for (i = 0; i < 4; i++) { if (ib_mutex_test_and_set(mutex) == 0) { diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 01ccfb8a6d0..993006efc6d 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -1639,7 +1639,7 @@ trx_i_s_create_lock_id( } else { /* table lock */ res_len = ut_snprintf(lock_id, lock_id_size, - TRX_ID_FMT":" UINT64PF, + TRX_ID_FMT ":" UINT64PF, row->lock_trx_id, row->lock_table_id); } diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index a698b37c2a6..11ad7fe4afd 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -466,7 +466,7 @@ trx_undo_page_fetch_ext( { /* Fetch the BLOB. */ ulint ext_len = btr_copy_externally_stored_field_prefix( - ext_buf, prefix_len, zip_size, field, *len); + ext_buf, prefix_len, zip_size, field, *len, NULL); /* BLOBs should always be nonempty. */ ut_a(ext_len); /* Append the BLOB pointer to the prefix. */ @@ -1247,7 +1247,7 @@ trx_undo_report_row_operation( rseg = trx->rseg; - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); mutex_enter(&trx->undo_mutex); /* If the undo log is not assigned yet, assign one */ @@ -1336,7 +1336,7 @@ trx_undo_report_row_operation( latches, such as SYNC_FSP and SYNC_FSP_PAGE. */ mtr_commit(&mtr); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); mutex_enter(&rseg->mutex); trx_undo_free_last_page(trx, undo, &mtr); @@ -1373,7 +1373,7 @@ trx_undo_report_row_operation( /* We have to extend the undo log by one page */ ut_ad(++loop_count < 2); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); /* When we add a page to an undo log, this is analogous to a pessimistic insert in a B-tree, and we must reserve the diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index eb2af877a6d..3484c1f818d 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -129,6 +129,9 @@ trx_rollback_to_savepoint_low( mem_heap_free(heap); + /* There might be work for utility threads.*/ + srv_active_wake_master_thread(); + MONITOR_DEC(MONITOR_TRX_ACTIVE); } @@ -146,20 +149,10 @@ trx_rollback_to_savepoint( { ut_ad(!trx_mutex_own(trx)); - /* Tell Innobase server that there might be work for - utility threads: */ - - srv_active_wake_master_thread(); - trx_start_if_not_started_xa(trx); trx_rollback_to_savepoint_low(trx, savept); - /* Tell Innobase server that there might be work for - utility threads: */ - - srv_active_wake_master_thread(); - return(trx->error_state); } @@ -172,8 +165,6 @@ trx_rollback_for_mysql_low( /*=======================*/ trx_t* trx) /*!< in/out: transaction */ { - srv_active_wake_master_thread(); - trx->op_info = "rollback"; /* If we are doing the XA recovery of prepared transactions, @@ -187,8 +178,6 @@ trx_rollback_for_mysql_low( ut_a(trx->error_state == DB_SUCCESS); - srv_active_wake_master_thread(); - return(trx->error_state); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 272f8377f68..c0837bca635 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -1306,6 +1306,12 @@ trx_commit_in_memory( } trx->commit_lsn = lsn; + + /* Tell server some activity has happened, since the trx + does changes something. Background utility threads like + master thread, purge thread or page_cleaner thread might + have some work to do. */ + srv_active_wake_master_thread(); } /* undo_no is non-zero if we're doing the final commit. */ diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 290271c6cab..edb85a89c17 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -1067,11 +1067,9 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end_func( +trx_undo_truncate_end( /*=======================*/ -#ifdef UNIV_DEBUG - const trx_t* trx, /*!< in: transaction whose undo log it is */ -#endif /* UNIV_DEBUG */ + trx_t* trx, /*!< in: transaction whose undo log it is */ trx_undo_t* undo, /*!< in: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ @@ -1086,7 +1084,7 @@ trx_undo_truncate_end_func( ut_ad(mutex_own(&(trx->rseg->mutex))); for (;;) { - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); trunc_here = NULL; @@ -1773,7 +1771,7 @@ trx_undo_assign_undo( ut_ad(mutex_own(&(trx->undo_mutex))); - mtr_start(&mtr); + mtr_start_trx(&mtr, trx); mutex_enter(&rseg->mutex); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 7155faa72f4..e80ce15165b 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -21,7 +21,7 @@ #endif #define MYSQL_SERVER 1 -#include +#include #include #include #include diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c index 3e4bc755832..6ecec9bbc19 100644 --- a/storage/maria/unittest/ma_maria_log_cleanup.c +++ b/storage/maria/unittest/ma_maria_log_cleanup.c @@ -14,7 +14,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../maria_def.h" -#include #ifdef _WIN32 #include /* rmdir */ #endif diff --git a/storage/maria/unittest/test_file.c b/storage/maria/unittest/test_file.c index 567f4ef8b94..1a14f2e8ec5 100644 --- a/storage/maria/unittest/test_file.c +++ b/storage/maria/unittest/test_file.c @@ -13,7 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include /* Includes my_global.h */ #include #include #include "test_file.h" diff --git a/storage/mroonga/AUTHORS b/storage/mroonga/AUTHORS new file mode 100644 index 00000000000..c29bd9cc5fa --- /dev/null +++ b/storage/mroonga/AUTHORS @@ -0,0 +1,7 @@ +Active developers: +* Kentoku SHIBA +* Kouhei Sutou + +Inactive developers: +* Tetsuro IKEDA: The original author: Active +* Yoshinori Matsunobu: The original author of information schema diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt new file mode 100644 index 00000000000..faad871fa95 --- /dev/null +++ b/storage/mroonga/CMakeLists.txt @@ -0,0 +1,371 @@ +# -*- indent-tabs-mode: nil -*- +# +# Copyright(C) 2012-2014 Kouhei Sutou +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +cmake_minimum_required(VERSION 2.6) +project(mroonga) + +include(TestBigEndian) +test_big_endian(BIG_ENDIAN) +if(BIG_ENDIAN) + message(STATUS "Mroonga is not supported on big-endian") + return() +endif() + +if(MSVC) + if(MSVC_VERSION LESS 1600) + message(STATUS "Mroonga supports only MSVC 2010 or later") + return() + endif() +endif() + +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + set(MRN_BUNDLED FALSE) +else() + set(MRN_BUNDLED TRUE) +endif() + +if(MRN_BUNDLED) + if(WITHOUT_MROONGA OR WITHOUT_MROONGA_STORAGE_ENGINE) + return() + endif() +endif() + +set(MRN_BUNDLED_GROONGA_RELATIVE_DIR "vendor/groonga") +set(MRN_BUNDLED_GROONGA_DIR + "${CMAKE_CURRENT_SOURCE_DIR}/${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") +if(EXISTS "${MRN_BUNDLED_GROONGA_DIR}") + set(MRN_GROONGA_BUNDLED TRUE) + if(MSVC) + message(STATUS "Bundled Mroonga does not support MSVC yet") + return() + endif() +else() + set(MRN_GROONGA_BUNDLED FALSE) +endif() + +set(MRN_PLUGIN_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) + +if(MRN_BUNDLED) + set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR}/storage/mroonga) +else() + set(MRN_SOURCE_DIR ${CMAKE_SOURCE_DIR}) +endif() + +file(READ ${MRN_SOURCE_DIR}/version MRN_VERSION) +file(READ ${MRN_SOURCE_DIR}/version_major MRN_VERSION_MAJOR) +file(READ ${MRN_SOURCE_DIR}/version_minor MRN_VERSION_MINOR) +file(READ ${MRN_SOURCE_DIR}/version_micro MRN_VERSION_MICRO) +file(READ ${MRN_SOURCE_DIR}/version_in_hex MRN_VERSION_IN_HEX) +file(READ ${MRN_SOURCE_DIR}/plugin_version MRN_PLUGIN_VERSION) + +if(MRN_GROONGA_BUNDLED) + add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}") +else() + file(READ ${MRN_SOURCE_DIR}/required_groonga_version REQUIRED_GROONGA_VERSION) + string(STRIP "${REQUIRED_GROONGA_VERSION}" REQUIRED_GROONGA_VERSION) + + file(READ + ${MRN_SOURCE_DIR}/required_groonga_normalizer_mysql_version + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) + string(STRIP + "${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}" + REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION) +endif() + +set(MRN_PACKAGE_STRING "${PROJECT_NAME} ${MRN_VERSION}") + +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) +include(${MRN_SOURCE_DIR}/build/cmake_modules/ReadFileList.cmake) + +set(MRN_C_COMPILE_FLAGS "") +set(MRN_CXX_COMPILE_FLAGS "") + +macro(mrn_check_cflag flag) + check_c_compiler_flag(${flag} "HAVE_C_${flag}") + if(HAVE_C_${flag}) + set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} ${flag}") + endif() +endmacro() + +macro(mrn_check_cxxflag flag) + check_cxx_compiler_flag(${flag} "HAVE_CXX_${flag}") + if(HAVE_CXX_${flag}) + set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} ${flag}") + endif() +endmacro() + +macro(mrn_build_flag flag) + mrn_check_cflag(${flag}) + mrn_check_cxxflag(${flag}) +endmacro() + +if(MRN_BUNDLED) + set(MRN_RELATIVE_DIR_PREFIX "${MRN_SOURCE_DIR}/") +else() + set(MRN_RELATIVE_DIR_PREFIX "") +endif() + +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am MROONGA_SOURCES) +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_no_mysql_sources.am + LIBMRN_NO_MYSQL_SOURCES) +string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}lib/\\1" + LIBMRN_NO_MYSQL_SOURCES "${LIBMRN_NO_MYSQL_SOURCES}") +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/lib/libmrn_need_mysql_sources.am + LIBMRN_NEED_MYSQL_SOURCES) +string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}lib/\\1" + LIBMRN_NEED_MYSQL_SOURCES "${LIBMRN_NEED_MYSQL_SOURCES}") +read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/udf/sources.am MRN_UDF_SOURCES) +string(REGEX REPLACE "([^;]+)" "${MRN_RELATIVE_DIR_PREFIX}udf/\\1" + MRN_UDF_SOURCES "${MRN_UDF_SOURCES}") + +if(MRN_BUNDLED) + set(MYSQL_SOURCE_DIR ${CMAKE_SOURCE_DIR}) + set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR}) + set(MYSQL_CONFIG ${CMAKE_SOURCE_DIR}/scripts/mysql_config) +else() + set(MYSQL_SOURCE_DIR "/PATH/TO/MYSQL/SOURCE/DIRECTORY/" + CACHE PATH "MySQL source directory") + if(NOT EXISTS ${MYSQL_SOURCE_DIR}) + message(FATAL_ERROR + "MySQL source directory (MYSQL_SOURCE_DIR) doesn't exist: <${MYSQL_SOURCE_DIR}>") + endif() + set(MYSQL_BUILD_DIR ${MYSQL_SOURCE_DIR} CACHE PATH "MySQL build directory") + set(MYSQL_CONFIG "mysql_config" CACHE PATH "mysql-config command path") +endif() +find_path(MYSQL_CONFIG "${MYSQL_CONFIG}") + +if(EXISTS "${MYSQL_SOURCE_DIR}/pcre") + set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/pcre") +else() + set(MYSQL_REGEX_INCLUDE_DIR "${MYSQL_SOURCE_DIR}/regex") +endif() + +set(MYSQL_INCLUDE_DIRS + "${MYSQL_BUILD_DIR}/include" + "${MYSQL_SOURCE_DIR}/sql" + "${MYSQL_SOURCE_DIR}/include" + "${MYSQL_REGEX_INCLUDE_DIR}" + "${MYSQL_SOURCE_DIR}") + +if(MRN_BUNDLED) + set(MYSQL_PLUGIN_DIR "${INSTALL_PLUGINDIR}") + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_DIR}/libservices") + set(MYSQL_CFLAGS "${CMAKE_C_FLAGS}") + set(MYSQL_VERSION "${MYSQL_BASE_VERSION}") +else() + macro(SET_MYSQL_CONFIG_VALUE OPTION VARIABLE) + if(NOT ${VARIABLE}) + execute_process(COMMAND "${MYSQL_CONFIG}" ${OPTION} + OUTPUT_VARIABLE MYSQL_CONFIG_OUTPUT) + string(STRIP ${MYSQL_CONFIG_OUTPUT} ${VARIABLE}) + endif() + endmacro() + + set_mysql_config_value("--plugindir" MYSQL_PLUGIN_DIR) + set_mysql_config_value("--variable=pkglibdir" MYSQL_PKG_LIB_DIR) + set(MYSQL_BUILD_LIBSERVICES_DIR "${MYSQL_BUILD_DIR}/libservices") + if(EXISTS "${MYSQL_BUILD_LIBSERVICES_DIR}/libmysqlservices.a") + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_BUILD_LIBSERVICES_DIR}") + else() + set(MYSQL_SERVICES_LIB_DIR "${MYSQL_PKG_LIB_DIR}") + endif() + set_mysql_config_value("--cflags" MYSQL_CFLAGS) + set_mysql_config_value("--version" MYSQL_VERSION) +endif() + +if(${MYSQL_VERSION} VERSION_GREATER "10.0.0" AND + ${MYSQL_VERSION} VERSION_LESS "10.0.9") + message(FATAL_ERROR + "Mroonga doesn't support MariaDB 10.0.0-10.0.8: <${MYSQL_VERSION}>") + return() +endif() + +if(MRN_GROONGA_BUNDLED) + set(GROONGA_INCLUDE_DIRS "${MRN_BUNDLED_GROONGA_DIR}/include") + set(GROONGA_LIBRARY_DIRS "${MRN_BUNDLED_GROONGA_DIR}/lib") + set(GROONGA_LIBRARIES "libgroonga") + if(EXISTS "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql") + set(GROONGA_NORMALIZER_MYSQL_FOUND TRUE) + else() + set(GROONGA_NORMALIZER_MYSQL_FOUND FALSE) + endif() +else() + include(FindPkgConfig) + pkg_check_modules(GROONGA REQUIRED "groonga >= ${REQUIRED_GROONGA_VERSION}") + pkg_check_modules(GROONGA_NORMALIZER_MYSQL + "groonga-normalizer-mysql >= ${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}") +endif() + +if(GROONGA_NORMALIZER_MYSQL_FOUND AND MRN_GROONGA_BUNDLED) + read_file_list(${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql/normalizers/mysql_sources.am MRN_GRN_NORMALIZER_MYSQL_SOURCES) + string(REGEX REPLACE "([^;]+)" "${MRN_BUNDLED_GROONGA_DIR}/vendor/plugins/groonga-normalizer-mysql/normalizers/\\1" + MRN_GRN_NORMALIZER_MYSQL_SOURCES "${MRN_GRN_NORMALIZER_MYSQL_SOURCES}") +endif() + +include_directories( + "${PROJECT_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/lib" + ${MYSQL_INCLUDE_DIRS} + ${GROONGA_INCLUDE_DIRS}) + +if(WIN32) + set(MYSQL_LIBRARY_DIRS + "${MYSQL_BUILD_DIR}/lib" + "${MYSQL_BUILD_DIR}/libmysqld") +else() + set(MYSQL_LIBRARY_DIRS + "${MYSQL_SERVICES_LIB_DIR}") +endif() +link_directories( + ${GROONGA_LIBRARY_DIRS} + ${MYSQL_LIBRARY_DIRS}) + +if(MRN_BUNDLED) + if(GROONGA_NORMALIZER_MYSQL_FOUND AND MRN_GROONGA_BUNDLED) + mysql_add_plugin(mroonga + "${MROONGA_SOURCES};${MRN_UDF_SOURCES};${MRN_GRN_NORMALIZER_MYSQL_SOURCES};${LIBMRN_NEED_MYSQL_SOURCES};${LIBMRN_NO_MYSQL_SOURCES}" + STORAGE_ENGINE MODULE_ONLY + LINK_LIBRARIES ${GROONGA_LIBRARIES}) + else() + mysql_add_plugin(mroonga + "${MROONGA_SOURCES};${MRN_UDF_SOURCES};${LIBMRN_NEED_MYSQL_SOURCES};${LIBMRN_NO_MYSQL_SOURCES}" + STORAGE_ENGINE MODULE_ONLY + LINK_LIBRARIES ${GROONGA_LIBRARIES}) + endif() + else() +else() + add_library(mroonga MODULE + ${MROONGA_SOURCES} + ${MRN_UDF_SOURCES} + ${LIBMRN_NO_MYSQL_SOURCES} + ${LIBMRN_NEED_MYSQL_SOURCES}) + + set(MYSQL_LIBRARIES "mysqlservices") + target_link_libraries(mroonga ${GROONGA_LIBRARIES} ${MYSQL_LIBRARIES}) + + option(WITH_DEBUG "Enable debug options" OFF) + if(WITH_DEBUG) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "SAFE_MUTEX") + if(CMAKE_COMPILER_IS_GNUCXX) + set(MRN_C_COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS} -g3 -O0") + set(MRN_CXX_COMPILE_FLAGS "${MRN_CXX_COMPILE_FLAGS} -g3 -O0") + endif() + else() + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "DBUG_OFF") + endif() + + option(WITH_DEBUG_FULL "Enable full debug options" OFF) + if(WITH_DEBUG_FULL) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "SAFE_MUTEX" "SAFEMALLOC") + endif() + + option(DISABLE_FAST_MUTEXES "Force disabling fast mutex" OFF) + if(DISABLE_FAST_MUTEXES) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "FORCE_FAST_MUTEX_DISABLED=1") + endif() + + option(WITH_FAST_MUTEXES "Enable fast mutex" OFF) + if(WITH_FAST_MUTEXES) + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MY_PTHREAD_FASTMUTEX") + endif() + + if(CMAKE_COMPILER_IS_GNUCXX) + mrn_build_flag("-Wall") + mrn_build_flag("-Wextra") + mrn_build_flag("-Wno-unused-parameter") + mrn_build_flag("-Wno-strict-aliasing") + mrn_build_flag("-Wno-deprecated") + mrn_check_cxxflag("-fno-implicit-templates") + mrn_check_cxxflag("-fno-exceptions") + mrn_check_cxxflag("-fno-rtti") + mrn_check_cxxflag("-felide-constructors") + endif() + set_source_files_properties(${MROONGA_SOURCES} PROPERTIES + COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}") + set_source_files_properties(${LIBMRN_NEED_MYSQL_SOURCES} PROPERTIES + COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}") + set_source_files_properties(${MRN_UDF_SOURCES} PROPERTIES + COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS}") + set_source_files_properties(${LIBMRN_NO_MYSQL_SOURCES} PROPERTIES + COMPILE_FLAGS "${MRN_C_COMPILE_FLAGS}") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "MYSQL_DYNAMIC_PLUGIN") + set_target_properties(mroonga PROPERTIES + PREFIX "" + OUTPUT_NAME "ha_mroonga") + + install(TARGETS mroonga DESTINATION "${MYSQL_PLUGIN_DIR}") +endif() + +if(GROONGA_NORMALIZER_MYSQL_FOUND) + set(WITH_GROONGA_NORMALIZER_MYSQL 1) + ADD_DEFINITIONS(-DWITH_GROONGA_NORMALIZER_MYSQL=1) + if(MRN_GROONGA_BUNDLED) + ADD_DEFINITIONS(-DGROONGA_NORMALIZER_MYSQL_PLUGIN_IS_BUNDLED_STATIC=1) + else() + set(GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME \"normalizers/mysql\") + set_property(TARGET mroonga APPEND PROPERTY + COMPILE_DEFINITIONS "GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=\"normalizers/mysql\"") + endif() +endif() + +set(MRN_DEFAULT_PARSER "TokenBigram" CACHE STRING "The default fulltext parser") +ADD_DEFINITIONS(-DMRN_PARSER_DEFAULT="${MRN_DEFAULT_PARSER}") + +configure_file( + "${PROJECT_SOURCE_DIR}/mrn_version.h.in" + "${PROJECT_BINARY_DIR}/mrn_version.h") + +configure_file( + "${PROJECT_SOURCE_DIR}/config.sh.in" + "${PROJECT_BINARY_DIR}/config.sh") + +set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga") +if(NOT EXISTS "${MRN_TEST_SUITE_DIR}") + set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga") +endif() +configure_file( + "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in" + "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result" + NEWLINE_STYLE LF) +configure_file( + "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in" + "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result" + NEWLINE_STYLE LF) + +configure_file( + "${PROJECT_SOURCE_DIR}/data/install.sql.in" + "${PROJECT_BINARY_DIR}/data/install.sql") + +if(MRN_BUNDLED) + set(MRN_DATA_DIR "${INSTALL_MYSQLSHAREDIR}/${PROJECT_NAME}") +else() + set(MRN_DATA_DIR "share/${PROJECT_NAME}") +endif() +install(FILES + "${PROJECT_BINARY_DIR}/data/install.sql" + "${PROJECT_SOURCE_DIR}/data/uninstall.sql" + DESTINATION "${MRN_DATA_DIR}/") diff --git a/storage/mroonga/ChangeLog b/storage/mroonga/ChangeLog new file mode 100644 index 00000000000..1a63e191506 --- /dev/null +++ b/storage/mroonga/ChangeLog @@ -0,0 +1,3 @@ +2009-01-27 Tetsuro IKEDA + + * initial import for development diff --git a/storage/mroonga/Makefile.am b/storage/mroonga/Makefile.am new file mode 100644 index 00000000000..32fc88ad061 --- /dev/null +++ b/storage/mroonga/Makefile.am @@ -0,0 +1,156 @@ +AUTOMAKE_OPTIONS = 1.9.7 + +LOCALES = ja + +AM_CPPFLAGS = $(MYSQL_INCLUDES) $(GROONGA_CFLAGS) -I$(top_srcdir)/lib +ACLOCAL_AMFLAGS = $$ACLOCAL_ARGS + +include sources.am + +libraries = \ + $(top_builddir)/udf/libmrn_udf.la \ + $(top_builddir)/lib/libmrn_no_mysql.la \ + $(top_builddir)/lib/libmrn_need_mysql.la +if WITH_LIBMYSQLSERVICES_COMPAT +libraries += $(top_builddir)/lib/libmysqlservices.la +endif + +dynamic_plugin_ldflags = -module $(GROONGA_LIBS) $(MYSQL_LIBS) +dynamic_plugin_cxxflags = $(AM_CXXFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +dynamic_plugin_cflags = $(AM_CFLAGS) $(MYSQL_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN + +plugin_LTLIBRARIES = ha_mroonga.la +ha_mroonga_la_LDFLAGS = $(dynamic_plugin_ldflags) +ha_mroonga_la_CXXFLAGS = $(dynamic_plugin_cxxflags) +ha_mroonga_la_CFLAGS = $(dynamic_plugin_cflags) +ha_mroonga_la_SOURCES = $(sources) +ha_mroonga_la_LIBADD = $(libraries) + +SUBDIRS = \ + build \ + lib \ + udf \ + test \ + mysql-test \ + doc \ + tools \ + packages \ + data + +EXTRA_DIST = \ + AUTHORS \ + gpg_uid \ + plug.in \ + CMakeLists.txt + +installcheck-local: install + test/run-sql-test.sh + +tag: + cd $(top_srcdir) && \ + git tag v$(VERSION) -a -m 'Mroonga $(VERSION)!!!' + +update-latest-release: misc + @if test -z "$(OLD_RELEASE)"; then \ + echo "\$$(OLD_RELEASE) is missing"; \ + exit 1; \ + fi + @if test -z "$(OLD_RELEASE_DATE)"; then \ + echo "\$$(OLD_RELEASE_DATE) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_RELEASE_DATE)"; then \ + echo "\$$(NEW_RELEASE_DATE) is missing"; \ + exit 1; \ + fi + cd $(top_srcdir) && \ + misc/update-latest-release.rb \ + $(PACKAGE) $(OLD_RELEASE) $(OLD_RELEASE_DATE) \ + $(VERSION) $(NEW_RELEASE_DATE) \ + packages/rpm/fedora/mysql-mroonga.spec.in \ + packages/rpm/fedora/mariadb-mroonga.spec.in \ + packages/rpm/centos/mariadb-mroonga.spec.in \ + packages/rpm/centos/mysql55-mroonga.spec.in \ + packages/rpm/centos/mysql56-community-mroonga.spec.in \ + packages/debian/changelog \ + doc/source/install/*.rst \ + doc/locale/*/LC_MESSAGES/install.po \ + $(MROONGA_GITHUB_COM_PATH)/index.html \ + $(MROONGA_GITHUB_COM_PATH)/ja/index.html + +update-po: + @for lang in $(LOCALES); do \ + (cd $(top_srcdir)/doc/locale/$$lang/LC_MESSAGES && make update) \ + done + +update-document: + @if test -z "$(MROONGA_GITHUB_COM_PATH)"; then \ + echo "\$$(MROONGA_GITHUB_COM_PATH) is missing"; \ + echo "add --with-mroonga-github-com-path in configure"; \ + exit 1; \ + fi + rm -rf tmp-doc + mkdir tmp-doc + (cd doc && $(MAKE) clean-html) + (cd doc && $(MAKE) install docdir=$(abs_srcdir)/tmp-doc/install) + ruby $(srcdir)/tools/prepare-sphinx-html.rb tmp-doc/install tmp-doc/dist + rm -rf $(MROONGA_GITHUB_COM_PATH)/docs + mv tmp-doc/dist/en $(MROONGA_GITHUB_COM_PATH)/docs + for locale in `cd tmp-doc/dist; echo *`; do \ + dest_base_dir=$(MROONGA_GITHUB_COM_PATH)/$${locale}; \ + mkdir -p $${dest_base_dir}; \ + dest_dir=$${dest_base_dir}/docs; \ + rm -rf $${dest_dir}; \ + mv tmp-doc/dist/$${locale} $${dest_dir}; \ + done + +update-files: + cd $(srcdir)/doc && $(MAKE) update-files + +update-version: + @if test -z "$(NEW_VERSION_MAJOR)"; then \ + echo "\$$(NEW_VERSION_MAJOR) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_VERSION_MINOR)"; then \ + echo "\$$(NEW_VERSION_MINOR) is missing"; \ + exit 1; \ + fi + @if test -z "$(NEW_VERSION_MICRO)"; then \ + echo "\$$(NEW_VERSION_MICRO) is missing"; \ + exit 1; \ + fi + @echo -n $(NEW_VERSION_MAJOR) > $(srcdir)/version_major + @echo -n $(NEW_VERSION_MINOR) > $(srcdir)/version_minor + @echo -n $(NEW_VERSION_MICRO) > $(srcdir)/version_micro + @echo -n $(NEW_VERSION_MAJOR).$(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/version + @if test $(NEW_VERSION_MINOR) -eq 0 ; then \ + printf "0x%02x%02x" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \ + > $(srcdir)/version_in_hex; \ + printf "%d.%d" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MICRO) \ + > $(srcdir)/plugin_version; \ + else \ + printf "0x%02x%02x" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/version_in_hex; \ + printf "%d.%d" \ + $(NEW_VERSION_MAJOR) $(NEW_VERSION_MINOR)$(NEW_VERSION_MICRO) \ + > $(srcdir)/plugin_version; \ + fi + +upload-to-github: + ruby $(srcdir)/tools/upload-to-github.rb \ + $$USER $(PACKAGE)-$(VERSION).tar.gz + +echo-cutter: + echo $(CUTTER) + +misc: + @if test -z "$(CUTTER_SOURCE_PATH)"; then \ + echo "\$$(CUTTER_SOURCE_PATH) is missing"; \ + exit 1; \ + fi + ln -s "$(CUTTER_SOURCE_PATH)/misc" misc diff --git a/storage/mroonga/NEWS b/storage/mroonga/NEWS new file mode 100644 index 00000000000..9dfa8b8dcc5 --- /dev/null +++ b/storage/mroonga/NEWS @@ -0,0 +1 @@ +See doc/source/news.txt or http://mroonga.github.com/docs/news.html. diff --git a/storage/mroonga/README b/storage/mroonga/README new file mode 100644 index 00000000000..7c431018d86 --- /dev/null +++ b/storage/mroonga/README @@ -0,0 +1 @@ +See doc/locale/en/html/index.html or doc/locale/ja/html/index.html diff --git a/storage/mroonga/autogen.sh b/storage/mroonga/autogen.sh new file mode 100755 index 00000000000..7a1d38635d4 --- /dev/null +++ b/storage/mroonga/autogen.sh @@ -0,0 +1,116 @@ +#!/bin/sh + +warn() { + echo " WARNING: $@" 1>&2 +} + +# init + +LIBTOOLIZE=libtoolize +ACLOCAL=aclocal +AUTOCONF=autoconf +AUTOHEADER=autoheader +AUTOMAKE=automake + +case `uname -s` in +Darwin) + LIBTOOLIZE=glibtoolize + ;; +FreeBSD) + ACLOCAL_ARGS="$ACLOCAL_ARGS -I /usr/local/share/aclocal/" + ;; +esac + + +# libtoolize +echo "Searching libtoolize..." +if [ `which $LIBTOOLIZE` ] ; then + echo " FOUND: libtoolize -> $LIBTOOLIZE" +else + warn "Cannot Found libtoolize... input libtool command" + read LIBTOOLIZE + LIBTOOLIZE=`which $LIBTOOLIZE` + if [ `which $LIBTOOLIZE` ] ; then + echo " SET: libtoolize -> $LIBTOOLIZE" + else + warn "$LIBTOOLIZE: Command not found." + exit 1; + fi +fi + +# aclocal +echo "Searching aclocal..." +if [ `which $ACLOCAL` ] ; then + echo " FOUND: aclocal -> $ACLOCAL" +else + warn "Cannot Found aclocal... input aclocal command" + read ACLOCAL + ACLOCAL=`which $ACLOCAL` + if [ `which $ACLOCAL` ] ; then + echo " SET: aclocal -> $ACLOCAL" + else + warn "$ACLOCAL: Command not found." + exit 1; + fi +fi + +# automake +echo "Searching automake..." +if [ `which $AUTOMAKE` ] ; then + echo " FOUND: automake -> $AUTOMAKE" +else + warn "Cannot Found automake... input automake command" + read AUTOMAKE + ACLOCAL=`which $AUTOMAKE` + if [ `which $AUTOMAKE` ] ; then + echo " SET: automake -> $AUTOMAKE" + else + warn "$AUTOMAKE: Command not found." + exit 1; + fi +fi + +# autoheader +echo "Searching autoheader..." +if [ `which $AUTOHEADER` ] ; then + echo " FOUND: autoheader -> $AUTOHEADER" +else + warn "Cannot Found autoheader... input autoheader command" + read AUTOHEADER + ACLOCAL=`which $AUTOHEADER` + if [ `which $AUTOHEADER` ] ; then + echo " SET: autoheader -> $AUTOHEADER" + else + warn "$AUTOHEADER: Command not found." + exit 1; + fi +fi + +# autoconf +echo "Searching autoconf..." +if [ `which $AUTOCONF` ] ; then + echo " FOUND: autoconf -> $AUTOCONF" +else + warn "Cannot Found autoconf... input autoconf command" + read AUTOCONF + ACLOCAL=`which $AUTOCONF` + if [ `which $AUTOCONF` ] ; then + echo " SET: autoconf -> $AUTOCONF" + else + warn "$AUTOCONF: Command not found." + exit 1; + fi +fi + +set -e + +echo "Running libtoolize ..." +$LIBTOOLIZE --force --copy +echo "Running aclocal ..." +$ACLOCAL ${ACLOCAL_ARGS} +echo "Running autoheader..." +$AUTOHEADER +echo "Running automake ..." +$AUTOMAKE --add-missing --copy +echo "Running autoconf ..." +$AUTOCONF diff --git a/storage/mroonga/build/Makefile.am b/storage/mroonga/build/Makefile.am new file mode 100644 index 00000000000..506a11dc3b0 --- /dev/null +++ b/storage/mroonga/build/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = \ + cmake_modules diff --git a/storage/mroonga/build/cmake_modules/Makefile.am b/storage/mroonga/build/cmake_modules/Makefile.am new file mode 100644 index 00000000000..83fb0f0c1b4 --- /dev/null +++ b/storage/mroonga/build/cmake_modules/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = \ + ReadFileList.cmake diff --git a/storage/mroonga/build/cmake_modules/ReadFileList.cmake b/storage/mroonga/build/cmake_modules/ReadFileList.cmake new file mode 100644 index 00000000000..018587991d8 --- /dev/null +++ b/storage/mroonga/build/cmake_modules/ReadFileList.cmake @@ -0,0 +1,27 @@ +# Copyright(C) 2012 Brazil +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +macro(read_file_list file_name output_variable) + file(READ ${file_name} ${output_variable}) + # Remove variable declaration at the first line: + # "libgroonga_la_SOURCES = \" -> "" + string(REGEX REPLACE "^.*=[ \t]*\\\\" "" + ${output_variable} "${${output_variable}}") + # Remove white spaces: " com.c \\\n com.h \\\n" -> "com.c\\com.h" + string(REGEX REPLACE "[ \t\n]" "" ${output_variable} "${${output_variable}}") + # Convert string to list: "com.c\\com.h" -> "com.c;com.h" + # NOTE: List in CMake is ";" separated string. + string(REGEX REPLACE "\\\\" ";" ${output_variable} "${${output_variable}}") +endmacro() diff --git a/storage/mroonga/build/makefiles/LC_MESSAGES.am b/storage/mroonga/build/makefiles/LC_MESSAGES.am new file mode 100644 index 00000000000..acfc3da238e --- /dev/null +++ b/storage/mroonga/build/makefiles/LC_MESSAGES.am @@ -0,0 +1,5 @@ +BUILT_SOURCES = +EXTRA_DIST = +SUFFIXES = + +include $(top_srcdir)/build/makefiles/gettext.am diff --git a/storage/mroonga/build/makefiles/gettext.am b/storage/mroonga/build/makefiles/gettext.am new file mode 100644 index 00000000000..9706b485dd1 --- /dev/null +++ b/storage/mroonga/build/makefiles/gettext.am @@ -0,0 +1,73 @@ +include $(top_srcdir)/doc/files.am +include $(top_srcdir)/build/makefiles/sphinx-build.am + +EXTRA_DIST += \ + $(po_files) + +if DOCUMENT_AVAILABLE +EXTRA_DIST += \ + $(mo_files) +endif + +if DOCUMENT_BUILDABLE +BUILT_SOURCES += \ + pot-build-stamp \ + edit-po-build-stamp \ + $(mo_files) +endif + +SUFFIXES += .pot .po .mo .edit + +.PHONY: gettext update build + +.pot.edit: + if test -f $*.po; then \ + msgmerge \ + --quiet \ + --sort-by-file \ + --output-file=$@.tmp \ + $*.po \ + $<; \ + else \ + msginit \ + --input=$< \ + --output-file=$@.tmp \ + --locale=$(LOCALE) \ + --no-translator; \ + fi + (echo "# -*- po -*-"; \ + GREP_OPTIONS= grep -v '^# -\*- po -\*-' $@.tmp | \ + GREP_OPTIONS= grep -v '^"POT-Creation-Date:') > $@ + rm $@.tmp + +.edit.po: + msgcat --no-location --output $@ $< + +.po.mo: + msgfmt -o $@ $< + +if DOCUMENT_BUILDABLE +update: pot-build-stamp edit-po-build-stamp +build: update $(mo_files) +else +update: +build: +endif + +html: build +man: build +pdf: build + +gettext: + rm *.pot || true + $(SPHINX_BUILD_COMMAND) -d doctrees -b gettext $(ALLSPHINXOPTS) . + xgettext --language Python --output conf.pot \ + $(top_srcdir)/doc/source/conf.py + +pot-build-stamp: $(absolute_source_files) + $(MAKE) gettext + @touch $@ + +edit-po-build-stamp: $(absolute_source_files) + $(MAKE) $(edit_po_files) + @touch $@ diff --git a/storage/mroonga/build/makefiles/locale.am b/storage/mroonga/build/makefiles/locale.am new file mode 100644 index 00000000000..414c19a7e34 --- /dev/null +++ b/storage/mroonga/build/makefiles/locale.am @@ -0,0 +1,12 @@ +SUBDIRS = LC_MESSAGES + +BUILT_SOURCES = +EXTRA_DIST = + +include $(top_srcdir)/build/makefiles/sphinx.am + +init: + cd LC_MESSAGES && $(MAKE) $@ + +update-po: + cd LC_MESSAGES && $(MAKE) update diff --git a/storage/mroonga/build/makefiles/sphinx-build.am b/storage/mroonga/build/makefiles/sphinx-build.am new file mode 100644 index 00000000000..e237377ba80 --- /dev/null +++ b/storage/mroonga/build/makefiles/sphinx-build.am @@ -0,0 +1,19 @@ +# You can set these variables from the command line. +DOCTREES_BASE = doctrees + +SPHINXOPTS = +PAPER = + +# Internal variables. +SOURCE_DIR = $(abs_top_srcdir)/doc/source +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = $(PAPEROPT_$(PAPER)) -E $(SPHINXOPTS) $(SOURCE_DIR) + +SPHINX_DIR = $(abs_top_builddir)/doc/sphinx +SPHINX_BUILD_COMMAND = \ + DOCUMENT_VERSION="$(DOCUMENT_VERSION)" \ + DOCUMENT_VERSION_FULL="$(DOCUMENT_VERSION_FULL)" \ + LOCALE="$(LOCALE)" \ + PYTHONPATH="$(SPHINX_DIR):$$PYTHONPATH" \ + $(SPHINX_BUILD) diff --git a/storage/mroonga/build/makefiles/sphinx.am b/storage/mroonga/build/makefiles/sphinx.am new file mode 100644 index 00000000000..f84fb23b739 --- /dev/null +++ b/storage/mroonga/build/makefiles/sphinx.am @@ -0,0 +1,179 @@ +include $(top_srcdir)/doc/files.am +include $(top_srcdir)/build/makefiles/sphinx-build.am + +$(html_files): html-build-stamp +$(html_files_relative_from_locale_dir): html-build-stamp +$(man_files): man-build-stamp + +am__nobase_dist_doc_locale_DATA_DIST = +if DOCUMENT_AVAILABLE +doc_localedir = $(docdir)/$(LOCALE) +nobase_dist_doc_locale_DATA = \ + $(html_files_relative_from_locale_dir) +am__nobase_dist_doc_locale_DATA_DIST += \ + $(nobase_dist_doc_locale_DATA) +endif + +document_source_files = \ + $(absolute_source_files) \ + $(absolute_theme_files) \ + $(po_files_relative_from_locale_dir) \ + $(mo_files_relative_from_locale_dir) + +required_build_stamps = \ + html-build-stamp \ + man-build-stamp \ + mo-build-stamp + +if DOCUMENT_BUILDABLE +EXTRA_DIST += $(required_build_stamps) +endif + +man_files = \ + man/$(PACKAGE_NAME).1 + +generated_files = \ + $(DOCTREES_BASE) \ + man \ + man-build-stamp \ + html \ + html-build-stamp \ + pdf \ + pdf-build-stamp \ + dirhtml \ + dirhtml-build-stamp \ + pickle \ + pikcle-build-stamp \ + json \ + json-build-stamp \ + htmlhelp \ + htmlhelp-build-stamp \ + qthelp \ + qthelp-build-stamp \ + latex \ + latex-build-stamp \ + changes \ + changes-build-stamp \ + linkcheck \ + linkcheck-build-stamp \ + doctest + +$(mo_files_relative_from_locale_dir): mo-build-stamp + +mo-build-stamp: $(po_files_relative_from_locale_dir) + cd LC_MESSAGES && $(MAKE) build + @touch $@ + +if DOCUMENT_BUILDABLE +clean-local: $(clean_targets) clean-doctrees + +clean-doctrees: + rm -rf $(DOCTREES_BASE) + +maintainer-clean-local: + rm -rf -- $(generated_files) +endif + +.PHONY: help +.PHONY: man clean-man +.PHONY: html clean-html +.PHONY: pdf +.PHONY: dirhtml +.PHONY: pickle +.PHONY: json +.PHONY: htmlhelp +.PHONY: qthelp +.PHONY: latex +.PHONY: changes +.PHONY: linkcheck +.PHONY: doctest + +if DOCUMENT_BUILDABLE +help: + @echo "Please use \`make ' where is one of" + @echo " man to make man files" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " rdoc to make RDoc files" + @echo " textile to make Textile files" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +man: man-build-stamp +html: html-build-stamp +dirhtml: dirhtml-build-stamp +pickle: pickle-build-stamp +json: json-build-stamp +htmlhelp: htmlhelp-build-stamp +qthelp: qthelp-build-stamp +latex: latex-build-stamp +rdoc: rdoc-build-stamp +textile: textile-build-stamp +changes: changes-build-stamp +linkcheck: linkcheck-build-stamp +doctest: doctest-build-stamp + +clean_targets = \ + clean-man \ + clean-html \ + clean-dirhtml \ + clean-pickle \ + clean-json \ + clean-htmlhelp \ + clean-qthelp \ + clean-latex \ + clean-rdoc \ + clean-textile \ + clean-changes \ + clean-linkcheck \ + clean-doctest + +$(clean_targets): + target=`echo $@ | sed -e 's/^clean-//'`; \ + rm -rf $${target}-build-stamp $${target} + +build_stamps = \ + man-build-stamp \ + html-build-stamp \ + dirhtml-build-stamp \ + pickle-build-stamp \ + json-build-stamp \ + htmlhelp-build-stamp \ + qthelp-build-stamp \ + latex-build-stamp \ + rdoc-build-stamp \ + textile-build-stamp \ + changes-build-stamp \ + linkcheck-build-stamp \ + doctest-build-stamp + +$(build_stamps): $(document_source_files) + target=`echo $@ | sed -e 's/-build-stamp$$//'`; \ + $(SPHINX_BUILD_COMMAND) \ + -Dlanguage=$(LOCALE) \ + -d $(DOCTREES_BASE)/$${target} \ + -b $${target} \ + $(ALLSPHINXOPTS) \ + $${target} + @touch $@ + +qthelp: qthelp-message +qthelp-message: qthelp-build-stamp + @echo "Build finished; now you can run 'qcollectiongenerator' with the" \ + ".qhcp project file in qthelp/*, like this:" + @echo "# qcollectiongenerator qthelp/groonga.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile qthelp/groonga.qhc" + +latex: latex-message +latex-message: latex-build-stamp + @echo "Build finished; the LaTeX files are in latex/*." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." +endif diff --git a/storage/mroonga/config.sh.in b/storage/mroonga/config.sh.in new file mode 100644 index 00000000000..2b584c6916d --- /dev/null +++ b/storage/mroonga/config.sh.in @@ -0,0 +1,20 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +MYSQL_SOURCE_DIR="@MYSQL_SOURCE_DIR@" +MYSQL_BUILD_DIR="@MYSQL_BUILD_DIR@" +MYSQL_VERSION="@MYSQL_VERSION@" +MRN_BUNDLED="@MRN_BUNDLED@" diff --git a/storage/mroonga/configure.ac b/storage/mroonga/configure.ac new file mode 100644 index 00000000000..48312a44c8c --- /dev/null +++ b/storage/mroonga/configure.ac @@ -0,0 +1,493 @@ +AC_PREREQ(2.59) + +m4_define([mrn_version_major], m4_include(version_major)) +m4_define([mrn_version_minor], m4_include(version_minor)) +m4_define([mrn_version_micro], m4_include(version_micro)) +m4_define([mrn_version], m4_include(version)) +m4_define([mrn_version_in_hex], m4_include(version_in_hex)) +m4_define([mrn_plugin_version], m4_include(plugin_version)) + +AC_INIT([mroonga], [mrn_version], [groonga-talk@lists.sourceforge.net]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([tar-pax foreign subdir-objects]) + +MRN_VERSION=mrn_version +MRN_VERSION_MAJOR=mrn_version_major +MRN_VERSION_MINOR=mrn_version_minor +MRN_VERSION_MICRO=mrn_version_micro +MRN_VERSION_IN_HEX=mrn_version_in_hex +MRN_PLUGIN_VERSION=mrn_plugin_version +AC_SUBST([MRN_VERSION]) +AC_SUBST([MRN_VERSION_MAJOR]) +AC_SUBST([MRN_VERSION_MINOR]) +AC_SUBST([MRN_VERSION_MICRO]) +AC_SUBST([MRN_VERSION_IN_HEX]) +AC_SUBST([MRN_PLUGIN_VERSION]) + +MRN_PACKAGE_STRING="$PACKAGE_STRING" +AC_SUBST([MRN_PACKAGE_STRING]) + +MRN_BUNDLED=FALSE +AC_SUBST([MRN_BUNDLED]) + +AC_C_BIGENDIAN +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CPP +AC_PROG_LIBTOOL +m4_ifdef([LT_OUTPUT], [LT_OUTPUT]) + +AC_DEFUN([CHECK_CFLAG], [ + AC_MSG_CHECKING([if gcc supports $1]) + old_CFLAGS=$CFLAGS + flag=`echo '$1' | sed -e 's,^-Wno-,-W,'` + CFLAGS="$CFLAGS $flag -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [check_cflag=yes], + [check_cflag=no]) + CFLAGS="$old_CFLAGS" + if test "x$check_cflag" = "xyes"; then + CFLAGS="$CFLAGS $1" + fi + AC_MSG_RESULT([$check_cflag]) +]) + +AC_DEFUN([CHECK_CXXFLAG], [ + AC_MSG_CHECKING([if g++ supports $1]) + old_CXXFLAGS=$CXXFLAGS + flag=`echo '$1' | sed -e 's,^-Wno-,-W,'` + CXXFLAGS="$CXXFLAGS $flag -Werror" + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [check_cxxflag=yes], + [check_cxxflag=no]) + AC_LANG_POP([C++]) + CXXFLAGS="$old_CXXFLAGS" + if test "x$check_cxxflag" = "xyes"; then + CXXFLAGS="$CXXFLAGS $1" + fi + AC_MSG_RESULT([$check_cxxflag]) +]) + +AC_DEFUN([CHECK_BUILD_FLAG], [ + CHECK_CFLAG([$1]) + CHECK_CXXFLAG([$1]) +]) + +if test "$GCC" = "yes"; then + CHECK_BUILD_FLAG([-Wall]) + CHECK_BUILD_FLAG([-Wextra]) + CHECK_BUILD_FLAG([-Wno-unused-parameter]) + CHECK_BUILD_FLAG([-Wno-strict-aliasing]) + # REMOVEME: workaround for MySQL/MariaDB 5.5.22 :< + # They use deprecated MYSQL::generate_name style in class definition. + CHECK_BUILD_FLAG([-Wno-deprecated]) +fi + +AC_MSG_CHECKING(for the suffix of plugin shared libraries) +shrext_cmds=$(./libtool --config | grep '^shrext_cmds=') +eval $shrext_cmds +module=yes eval MRN_PLUGIN_SUFFIX="$shrext_cmds" +AC_MSG_RESULT($MRN_PLUGIN_SUFFIX) +if test -z "$MRN_PLUGIN_SUFFIX"; then + AC_MSG_ERROR([can't detect plugin suffix]) +fi +AC_SUBST(MRN_PLUGIN_SUFFIX) + +AC_ARG_WITH(libmysqlservices-compat, + [AS_HELP_STRING([--with-libmysqlservices-compat], + [Use libmysqlservices compatible library for missing libmysqlservices.a]) + ], + [with_libmysqlservices_compat=$withval], + [with_libmysqlservices_compat=no]) +AM_CONDITIONAL([WITH_LIBMYSQLSERVICES_COMPAT], [test "${with_libmysqlservices_compat}" != "no"]) + +AC_DEFUN([CONFIG_OPTION_MYSQL],[ + AC_MSG_CHECKING([mysql source]) + + ac_mysql_source_dir= + AC_ARG_WITH([mysql-source], + [AS_HELP_STRING([--with-mysql-source=PATH], [MySQL source directory PATH])], + [ + ac_mysql_source_dir="$withval" + if test -f "$ac_mysql_source_dir/sql/handler.h"; then + case "$ac_mysql_source_dir" in + /*) + : + ;; + *) + ac_mysql_source_dir="$ac_pwd/$ac_mysql_source_dir" + ;; + esac + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([invalid MySQL source directory]) + fi + ], + [AC_MSG_ERROR([--with-mysql-source=PATH is required])] + ) + MYSQL_SOURCE_DIR="$ac_mysql_source_dir" + AC_SUBST(MYSQL_SOURCE_DIR) + + ac_mysql_build_dir= + AC_ARG_WITH([mysql-build], + [AS_HELP_STRING([--with-mysql-build=PATH], [MySQL build directory PATH])], + [ac_mysql_build_dir="$withval"], + [ac_mysql_build_dir="$ac_mysql_source_dir"] + ) + case "$ac_mysql_build_dir" in + /*) + : + ;; + *) + ac_mysql_build_dir="$ac_pwd/$ac_mysql_build_dir" + ;; + esac + MYSQL_BUILD_DIR="$ac_mysql_build_dir" + AC_SUBST(MYSQL_BUILD_DIR) + + AC_MSG_CHECKING([mysql_config]) + AC_ARG_WITH([mysql-config], + [AS_HELP_STRING([--with-mysql-config=PATH], + [mysql_config PATH])], + [ac_mysql_config="$withval"], + [ac_mysql_config=]) + if test -z "$ac_mysql_config"; then + AC_PATH_PROG(ac_mysql_config, mysql_config, mysql-config-not-found) + fi + if test "$ac_mysql_config" = "mysql-config-not-found"; then + AC_MSG_ERROR([can't detect mysql_config. Please specify mysql_config path by --with-mysql-config=PATH.]) + fi + AC_MSG_RESULT([$ac_mysql_config]) + + plugindir="$($ac_mysql_config --plugindir)" + if test $? -ne 0; then + AC_MSG_ERROR([failed to run "$ac_mysql_config": $plugindir]) + fi + AC_SUBST(plugindir) + + MYSQL_CFLAGS="$MYSQL_CFLAGS $($ac_mysql_config --cflags)" + AC_SUBST(MYSQL_CFLAGS) + + MYSQL_INCLUDES="" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_build_dir/include" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/sql" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir/include" + if test -d "$ac_mysql_source_dir/pcre"; then + mysql_regex_include_dir="$ac_mysql_source_dir/pcre" + else + mysql_regex_include_dir="$ac_mysql_source_dir/regex" + fi + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$mysql_regex_include_dir" + MYSQL_INCLUDES="$MYSQL_INCLUDES -I$ac_mysql_source_dir" + MYSQL_INCLUDES="$MYSQL_INCLUDES $($ac_mysql_config --include)" + AC_SUBST(MYSQL_INCLUDES) + + MYSQL_VERSION="$($ac_mysql_config --version)" + AC_SUBST(MYSQL_VERSION) + + if test "${with_libmysqlservices_compat}" = "no"; then + MYSQL_MAJOR_MINOR_VERSION=["$(echo $MYSQL_VERSION | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*[a-z]*\)$/\1.\2/')"] + case "$MYSQL_MAJOR_MINOR_VERSION" in + 5.1) + MYSQL_LIBS="" + ;; + *) + AC_MSG_CHECKING([for libmysqlservices.a directory]) + pkglibdir="$($ac_mysql_config --variable=pkglibdir)" + mysql_build_libservices_dir="${MYSQL_BUILD_DIR}/libservices" + if test -f "${mysql_build_libservices_dir}/libmysqlservices.a"; then + mysql_services_lib_dir="${mysql_build_libservices_dir}" + else + if test -f "${pkglibdir}/libmysqlservices.a"; then + mysql_services_lib_dir="${pkglibdir}" + elif test -f "${pkglibdir}/mysql/libmysqlservices.a"; then + mysql_services_lib_dir="${pkglibdir}/mysql" + else + AC_MSG_ERROR([libmysqlservices.a is not found in <${pkglibdir}/> and <${pkglibdir}/mysql/>]) + fi + fi + AC_MSG_RESULT([$mysql_services_lib_dir]) + MYSQL_LIBS="$MYSQL_LIBS -L\"$mysql_services_lib_dir\" -lmysqlservices" + ;; + esac + AC_SUBST(MYSQL_LIBS) + fi +]) + +m4_define([mrn_required_groonga_version], m4_include(required_groonga_version)) +REQUIRED_GROONGA_VERSION=mrn_required_groonga_version +AC_SUBST(REQUIRED_GROONGA_VERSION) +AC_DEFUN([CONFIG_OPTION_GROONGA],[ + PKG_CHECK_MODULES(GROONGA, groonga >= ${REQUIRED_GROONGA_VERSION}) + _PKG_CONFIG(GROONGA_VERSION, variable=groonga_version, groonga) + GROONGA_VERSION=$pkg_cv_GROONGA_VERSION + AC_SUBST(GROONGA_VERSION) +]) + +m4_define([mrn_required_groonga_normalizer_mysql_version], + m4_include(required_groonga_normalizer_mysql_version)) +REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION=mrn_required_groonga_normalizer_mysql_version +AC_DEFUN([CONFIG_OPTION_GROONGA_NORMALIZER_MYSQL], [ + AC_MSG_CHECKING([for groonga-normalizer-mysql]) + PKG_CHECK_EXISTS([groonga-normalizer-mysql >= ${REQUIRED_GROONGA_NORMALIZER_MYSQL_VERSION}], + [WITH_GROONGA_NORMALIZER_MYSQL=yes], + [WITH_GROONGA_NORMALIZER_MYSQL=no]) + AC_MSG_RESULT($WITH_GROONGA_NORMALIZER_MYSQL) + if test "$WITH_GROONGA_NORMALIZER_MYSQL" = "yes"; then + AC_DEFINE([WITH_GROONGA_NORMALIZER_MYSQL], + [1], + [Use MySQL normalizer plugin for groonga]) + _PKG_CONFIG(plugin_name, variable=plugin_name, groonga-normalizer-mysql) + GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME=$pkg_cv_plugin_name + AC_DEFINE_UNQUOTED([GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME], + "${GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME}", + [Name of MySQL normalizer plugin for groonga]) + fi +]) + +AC_ARG_WITH(debug, + [dnl +AS_HELP_STRING([--with-debug], + [Add debug code]) +AS_HELP_STRING([--with-debug=full], + [Add debug code (adds memory checker, very slow)])dnl + ], + [with_debug=$withval], + [with_debug=no]) +if test "$with_debug" = "yes" +then + # Medium debug. + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS -O0 -g3" + CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS -O0 -g3" +elif test "$with_debug" = "full" +then + # Full debug. Very slow in some cases + AC_DEFINE([DBUG_ON], [1], [Use libdbug]) + CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS -O0 -g3" + CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS -O0 -g3" +else + # Optimized version. No debug + AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug]) + CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS" + CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS" +fi + +AC_ARG_WITH(valgrind, + [AS_HELP_STRING([--with-valgrind], [Use valgrind. [default=no]])], + [with_valgrind="$withval"], + [with_valgrind="no"]) +if test "$with_valgrind" != "no"; then + CFLAGS="-DHAVE_valgrind $CFLAGS" + CXXFLAGS="-DHAVE_valgrind $CXXFLAGS" +fi + +CONFIG_OPTION_MYSQL +CONFIG_OPTION_GROONGA +CONFIG_OPTION_GROONGA_NORMALIZER_MYSQL + +AC_ARG_WITH(default_parser, + [AS_HELP_STRING([--with-default-parser=PARSER], + [specify the default fulltext parser like + --with-default-parser=TokenMecab. + (default: TokenBigram)])], + [default_parser=$withval], + [default_parser=no]) +if test x"$default_parser" != x"no"; then + AC_DEFINE_UNQUOTED(MRN_PARSER_DEFAULT, + "$default_parser", + "specified default fulltext parser") + MRN_DEFAULT_PARSER=$default_parser +else + MRN_DEFAULT_PARSER=TokenBigram +fi +AC_SUBST(MRN_DEFAULT_PARSER) + +AC_ARG_ENABLE(fast_mutexes, + [AS_HELP_STRING([--disable-fast-mutexes], + [Force disable fast mutex. + [default: use mysql_config output]])], + [enable_fast_mutexes=$enableval], + [enable_fast_mutexes=auto]) +if test "$enable_fast_mutexes" = "no"; then + AC_DEFINE(FORCE_FAST_MUTEX_DISABLED, [1], + [Define to 1 if force fast mutexes disabled]) +elif test "$enable_fast_mutexes" = "yes"; then + AC_DEFINE(MY_PTHREAD_FASTMUTEX, [1], + [Define to 1 if fast mutexes enabled]) +fi + +AC_ARG_ENABLE(dtrace, + [AS_HELP_STRING([--enable-dtrace], + [Enable DTrace. [default: no]])], + [enable_dtrace=$enableval], + [enable_dtrace=no]) +if test "$enable_dtrace" = "no"; then + AC_DEFINE(DISABLE_DTRACE, [1], [Define to 1 if DTrace is disabled]) +fi + +# check Cutter with C++ support if available +REQUIRED_MINIMUM_CUTTER_VERSION=1.1.3 +m4_ifdef([AC_CHECK_CPPCUTTER], [ +AC_CHECK_CPPCUTTER(>= $REQUIRED_MINIMUM_CUTTER_VERSION) +], +[ac_cv_use_cutter="no"]) +AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"]) + +# For mroonga.github.com +AC_ARG_WITH(mroonga-github-com-path, + [AS_HELP_STRING([--with-mroonga-github-com-path=PATH], + [specify mroonga.github.com path to update mroonga.github.com.])], + [MROONGA_GITHUB_COM_PATH="$withval"], + [MROONGA_GITHUB_COM_PATH=""]) +AC_SUBST(MROONGA_GITHUB_COM_PATH) + +# For package +AC_ARG_WITH(rsync-path, + [AS_HELP_STRING([--with-rsync-path=PATH], + [specify rsync path to upload mroonga packages.])], + [RSYNC_PATH="$withval"], + [RSYNC_PATH="packages@packages.groonga.org:public"]) +AC_SUBST(RSYNC_PATH) + +AC_ARG_WITH(launchpad-uploader-pgp-key, + [AS_HELP_STRING([--with-launchpad-uploader-pgp-key=KEY], + [specify PGP key UID to upload Groonga packages to Launchpad.])], + [LAUNCHPAD_UPLOADER_PGP_KEY="$withval"], + [LAUNCHPAD_UPLOADER_PGP_KEY=""]) +AC_SUBST(LAUNCHPAD_UPLOADER_PGP_KEY) + +GPG_UID=m4_include(gpg_uid) +AC_SUBST(GPG_UID) + +# For update-version +AC_ARG_WITH(cutter-source-path, + [AS_HELP_STRING([--with-cutter-source-path=PATH], + [specify Cutter source path for mroonga's release manager.])], + [CUTTER_SOURCE_PATH="$withval"]) +case "$CUTTER_SOURCE_PATH" in + ""|/*) + : # do nothing + ;; + *) + CUTTER_SOURCE_PATH="\$(top_builddir)/${CUTTER_SOURCE_PATH}" + ;; +esac +AC_SUBST(CUTTER_SOURCE_PATH) + + +# Document +AC_MSG_CHECKING([whether enable document]) +AC_ARG_ENABLE(document, + [AS_HELP_STRING([--enable-document], + [enable document generation by Sphinx. [default=auto]])], + [enable_document="$enableval"], + [enable_document="auto"]) +AC_MSG_RESULT($enable_document) + +document_available=no +document_buildable=no +have_built_document=no +if test x"$enable_document" != x"no"; then + if test -f "$srcdir/doc/build-stamp"; then + document_available=yes + have_built_document=yes + fi + + if test x"$enable_document" = x"yes"; then + AC_PATH_PROG(SPHINX_BUILD, sphinx-build, []) + if test -n "$SPHINX_BUILD"; then + sphinx_build_version=`"$SPHINX_BUILD" --version` + if ! echo "$sphinx_build_version" | grep -q ' 1\.[[23]]'; then + AC_MSG_ERROR([ +sphinx-build is old: $sphinx_build_version +Sphinx 1.2 or later is required.]) + fi + document_available=yes + document_buildable=yes + else + AC_MSG_ERROR([ +No sphinx-build found. +Install it and try again. + +How to install sphinx-build: + +For Debian GNU/Linux based system like Ubuntu: + % sudo apt-get install -y python-pip + % sudo pip install sphinx + +For Red Hat based system like CentOS: + % sudo yum install -y python-pip + % sudo pip install sphinx]) + fi + AC_SUBST(SPHINX_BUILD) + fi +fi + +AM_CONDITIONAL([DOCUMENT_AVAILABLE], + [test "${document_available}" = "yes"]) +AC_MSG_CHECKING([whether document available]) +AC_MSG_RESULT($document_available) + +AM_CONDITIONAL([DOCUMENT_BUILDABLE], + [test "${document_buildable}" = "yes"]) +AC_MSG_CHECKING([whether document buildable]) +AC_MSG_RESULT($document_buildable) + +AM_CONDITIONAL([HAVE_BUILT_DOCUMENT], + [test "${have_built_document}" = "yes"]) +AC_MSG_CHECKING([whether having built document]) +AC_MSG_RESULT($have_built_document) + +DOCUMENT_VERSION=mrn_version +DOCUMENT_VERSION_FULL="$DOCUMENT_VERSION" +AC_SUBST(DOCUMENT_VERSION) +AC_SUBST(DOCUMENT_VERSION_FULL) + +CFLAGS="$CFLAGS" +CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti -felide-constructors" + +AC_CONFIG_FILES([ + Makefile + build/Makefile + build/cmake_modules/Makefile + lib/Makefile + udf/Makefile + test/Makefile + test/unit/Makefile + mysql-test/Makefile + packages/Makefile + packages/rpm/Makefile + packages/rpm/centos/Makefile + packages/rpm/fedora/Makefile + packages/yum/Makefile + packages/apt/Makefile + packages/source/Makefile + packages/ubuntu/Makefile + packages/windows/Makefile + tools/Makefile + doc/Makefile + doc/locale/Makefile + doc/locale/en/Makefile + doc/locale/en/LC_MESSAGES/Makefile + doc/locale/ja/Makefile + doc/locale/ja/LC_MESSAGES/Makefile + data/Makefile +]) +AC_OUTPUT([ + config.sh + mrn_version.h + mysql-test/mroonga/storage/information_schema/r/plugins.result + mysql-test/mroonga/storage/variable/r/version.result + packages/debian/control + packages/apt/env.sh + packages/rpm/centos/mysql55-mroonga.spec + packages/rpm/centos/mysql56-community-mroonga.spec + packages/rpm/centos/mariadb-mroonga.spec + packages/rpm/fedora/mysql-mroonga.spec + packages/rpm/fedora/mariadb-mroonga.spec + packages/yum/env.sh + data/install.sql +]) diff --git a/storage/mroonga/data/Makefile.am b/storage/mroonga/data/Makefile.am new file mode 100644 index 00000000000..c088c78c30f --- /dev/null +++ b/storage/mroonga/data/Makefile.am @@ -0,0 +1,4 @@ +sqldir = $(pkgdatadir) +dist_sql_DATA = \ + install.sql \ + uninstall.sql diff --git a/storage/mroonga/data/install.sql.in b/storage/mroonga/data/install.sql.in new file mode 100644 index 00000000000..b0c930c8144 --- /dev/null +++ b/storage/mroonga/data/install.sql.in @@ -0,0 +1,19 @@ +DELETE IGNORE FROM mysql.plugin WHERE dl = 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +INSTALL PLUGIN Mroonga SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS last_insert_grn_id; +CREATE FUNCTION last_insert_grn_id RETURNS INTEGER + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_snippet; +CREATE FUNCTION mroonga_snippet RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_command; +CREATE FUNCTION mroonga_command RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; + +DROP FUNCTION IF EXISTS mroonga_escape; +CREATE FUNCTION mroonga_escape RETURNS STRING + SONAME 'ha_mroonga@MRN_PLUGIN_SUFFIX@'; diff --git a/storage/mroonga/data/uninstall.sql b/storage/mroonga/data/uninstall.sql new file mode 100644 index 00000000000..b79e6c03d18 --- /dev/null +++ b/storage/mroonga/data/uninstall.sql @@ -0,0 +1,8 @@ +DROP FUNCTION IF EXISTS last_insert_grn_id; +DROP FUNCTION IF EXISTS mroonga_snippet; +DROP FUNCTION IF EXISTS mroonga_command; +DROP FUNCTION IF EXISTS mroonga_escape; + +UNINSTALL PLUGIN Mroonga; + +FLUSH TABLES; diff --git a/storage/mroonga/gpg_uid b/storage/mroonga/gpg_uid new file mode 100644 index 00000000000..7c1a800ba92 --- /dev/null +++ b/storage/mroonga/gpg_uid @@ -0,0 +1 @@ +45499429 diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp new file mode 100644 index 00000000000..8b9a08b59dc --- /dev/null +++ b/storage/mroonga/ha_mroonga.cpp @@ -0,0 +1,15465 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2014 Kouhei Sutou + Copyright(C) 2013 Kenji Maruyama + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_mysql.h" + +#ifdef USE_PRAGMA_IMPLEMENTATION +#pragma implementation +#endif + +#if MYSQL_VERSION_ID >= 50500 +# include +# include +# include +# include +# include +#endif + +#include + +#ifdef MRN_HAVE_SQL_OPTIMIZER_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifdef WIN32 +# include +# include +# define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \ + type *variable_name = (type *)_malloca(sizeof(type) * (variable_size)) +# define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) _freea(variable_name) +# define MRN_TABLE_SHARE_LOCK_SHARE_PROC "?key_TABLE_SHARE_LOCK_share@@3IA" +# define MRN_TABLE_SHARE_LOCK_HA_DATA_PROC "?key_TABLE_SHARE_LOCK_ha_data@@3IA" +# ifdef _WIN64 +# define MRN_BINLOG_FILTER_PROC "?binlog_filter@@3PEAVRpl_filter@@EA" +# define MRN_MY_TZ_UTC_PROC "?my_tz_UTC@@3PEAVTime_zone@@EA" +# else +# define MRN_BINLOG_FILTER_PROC "?binlog_filter@@3PAVRpl_filter@@A" +# define MRN_MY_TZ_UTC_PROC "?my_tz_UTC@@3PAVTime_zone@@A" +# endif +#else +# include +# include +# define MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(type, variable_name, variable_size) \ + type variable_name[variable_size] +# define MRN_FREE_VARIABLE_LENGTH_ARRAYS(variable_name) +#endif + +#include "mrn_err.h" +#include "mrn_table.hpp" +#include "ha_mroonga.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +# include +#endif + +// for debug +#define MRN_CLASS_NAME "ha_mroonga" + +#define MRN_SHORT_TEXT_SIZE (1 << 12) // 4Kbytes +#define MRN_TEXT_SIZE (1 << 16) // 64Kbytes +#define MRN_LONG_TEXT_SIZE (1 << 31) // 2Gbytes + +#ifdef MRN_HAVE_TDC_LOCK_TABLE_SHARE +# define mrn_open_mutex(share) &((share)->tdc.LOCK_table_share) +# define mrn_open_mutex_lock(share) do { \ + TABLE_SHARE *share_ = share; \ + if (share_ && share_->tmp_table == NO_TMP_TABLE) { \ + mysql_mutex_lock(mrn_open_mutex(share_)); \ + } \ +} while (0) +# define mrn_open_mutex_unlock(share) do { \ + TABLE_SHARE *share_ = share; \ + if (share_ && share_->tmp_table == NO_TMP_TABLE) { \ + mysql_mutex_unlock(mrn_open_mutex(share_)); \ + } \ +} while (0) +#else +# if MYSQL_VERSION_ID >= 50500 +# ifdef DBUG_OFF +# ifndef _WIN32 +extern mysql_mutex_t LOCK_open; +# endif +# endif +static mysql_mutex_t *mrn_LOCK_open; +# define mrn_open_mutex_lock(share) mysql_mutex_lock(mrn_LOCK_open) +# define mrn_open_mutex_unlock(share) mysql_mutex_unlock(mrn_LOCK_open) +# else +# ifndef _WIN32 +extern pthread_mutex_t LOCK_open; +# endif +static pthread_mutex_t *mrn_LOCK_open; +# define mrn_open_mutex_lock(share) +# define mrn_open_mutex_unlock(share) +# endif +#endif + +#if MYSQL_VERSION_ID >= 50600 +# define MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK +#endif + +#if MYSQL_VERSION_ID >= 50603 && !defined(MRN_MARIADB_P) +# define MRN_ORDER_IS_ASC(order) ((order)->direction == ORDER::ORDER_ASC) +#else +# define MRN_ORDER_IS_ASC(order) ((order)->asc) +#endif + +#define MRN_STRINGIFY(macro_or_string) MRN_STRINGIFY_ARG(macro_or_string) +#define MRN_STRINGIFY_ARG(contents) #contents + +#define MRN_PLUGIN_NAME mroonga +#define MRN_PLUGIN_NAME_STRING "Mroonga" +#define MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "Mroonga" + +#ifdef MRN_MARIADB_P +# define st_mysql_plugin st_maria_plugin +# define mrn_declare_plugin(NAME) maria_declare_plugin(NAME) +# define mrn_declare_plugin_end maria_declare_plugin_end +# define MRN_PLUGIN_LAST_VALUES MRN_VERSION, MariaDB_PLUGIN_MATURITY_STABLE +# define MRN_ABORT_ON_WARNING(thd) thd_kill_level(thd) +#else +# define mrn_declare_plugin(NAME) mysql_declare_plugin(NAME) +# define mrn_declare_plugin_end mysql_declare_plugin_end +# ifdef MRN_PLUGIN_HAVE_FLAGS +# define MRN_PLUGIN_LAST_VALUES NULL, 0 +# else +# define MRN_PLUGIN_LAST_VALUES NULL +# endif +# define MRN_ABORT_ON_WARNING(thd) thd->abort_on_warning +#endif + +#ifdef WIN32 +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE + PSI_mutex_key *mrn_table_share_lock_share; +# endif +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA + PSI_mutex_key *mrn_table_share_lock_ha_data; +# endif +#endif + +#if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P) +# define MRN_THD_GET_AUTOINC(thd, off, inc) thd_get_autoinc(thd, off, inc) +# define MRN_GET_ERR_MSG(code) my_get_err_msg(code) +#else +# define MRN_THD_GET_AUTOINC(thd, off, inc) \ + { \ + *(off) = thd->variables.auto_increment_offset; \ + *(inc) = thd->variables.auto_increment_increment; \ + } +# define MRN_GET_ERR_MSG(code) ER(code) +#endif + +Rpl_filter *mrn_binlog_filter; +Time_zone *mrn_my_tz_UTC; +#ifdef MRN_HAVE_TABLE_DEF_CACHE +HASH *mrn_table_def_cache; +#endif + +static const char *INDEX_COLUMN_NAME = "index"; +static const char *MRN_PLUGIN_AUTHOR = "The Mroonga project"; + +#ifdef __cplusplus +extern "C" { +#endif + +/* groonga's internal functions */ +int grn_atoi(const char *nptr, const char *end, const char **rest); +uint grn_atoui(const char *nptr, const char *end, const char **rest); + +/* global variables */ +static pthread_mutex_t mrn_log_mutex; +handlerton *mrn_hton_ptr; +HASH mrn_open_tables; +pthread_mutex_t mrn_open_tables_mutex; +HASH mrn_long_term_share; +pthread_mutex_t mrn_long_term_share_mutex; + +/* internal variables */ +static grn_ctx mrn_ctx; +static grn_obj *mrn_db; +static grn_ctx mrn_db_manager_ctx; +mrn::DatabaseManager *mrn_db_manager = NULL; + +#ifdef WIN32 +static inline double round(double x) +{ + return (floor(x + 0.5)); +} +#endif + +static void mrn_init_encoding_map() +{ + mrn::encoding::init(); +} + +static int mrn_change_encoding(grn_ctx *ctx, const CHARSET_INFO *charset) +{ + return mrn::encoding::set(ctx, charset); +} + +#if !defined(DBUG_OFF) && !defined(_lint) +static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type) +{ + const char *inspected = ""; + switch (lock_type) { + case TL_IGNORE: + inspected = "TL_IGNORE"; + break; + case TL_UNLOCK: + inspected = "TL_UNLOCK"; + break; + case TL_READ_DEFAULT: + inspected = "TL_READ_DEFAULT"; + break; + case TL_READ: + inspected = "TL_READ"; + break; + case TL_READ_WITH_SHARED_LOCKS: + inspected = "TL_READ_WITH_SHARED_LOCKS"; + break; + case TL_READ_HIGH_PRIORITY: + inspected = "TL_READ_HIGH_PRIORITY"; + break; + case TL_READ_NO_INSERT: + inspected = "TL_READ_NO_INSERT"; + break; + case TL_WRITE_ALLOW_WRITE: + inspected = "TL_WRITE_ALLOW_WRITE"; + break; +#ifdef MRN_HAVE_TL_WRITE_ALLOW_READ + case TL_WRITE_ALLOW_READ: + inspected = "TL_WRITE_ALLOW_READ"; + break; +#endif + case TL_WRITE_CONCURRENT_INSERT: + inspected = "TL_WRITE_CONCURRENT_INSERT"; + break; + case TL_WRITE_DELAYED: + inspected = "TL_WRITE_DELAYED"; + break; + case TL_WRITE_DEFAULT: + inspected = "TL_WRITE_DEFAULT"; + break; + case TL_WRITE_LOW_PRIORITY: + inspected = "TL_WRITE_LOW_PRIORITY"; + break; + case TL_WRITE: + inspected = "TL_WRITE"; + break; + case TL_WRITE_ONLY: + inspected = "TL_WRITE_ONLY"; + break; + } + return inspected; +} + +static const char *mrn_inspect_extra_function(enum ha_extra_function operation) +{ + const char *inspected = ""; + switch (operation) { + case HA_EXTRA_NORMAL: + inspected = "HA_EXTRA_NORMAL"; + break; + case HA_EXTRA_QUICK: + inspected = "HA_EXTRA_QUICK"; + break; + case HA_EXTRA_NOT_USED: + inspected = "HA_EXTRA_NOT_USED"; + break; + case HA_EXTRA_CACHE: + inspected = "HA_EXTRA_CACHE"; + break; + case HA_EXTRA_NO_CACHE: + inspected = "HA_EXTRA_NO_CACHE"; + break; + case HA_EXTRA_NO_READCHECK: + inspected = "HA_EXTRA_NO_READCHECK"; + break; + case HA_EXTRA_READCHECK: + inspected = "HA_EXTRA_READCHECK"; + break; + case HA_EXTRA_KEYREAD: + inspected = "HA_EXTRA_KEYREAD"; + break; + case HA_EXTRA_NO_KEYREAD: + inspected = "HA_EXTRA_NO_KEYREAD"; + break; + case HA_EXTRA_NO_USER_CHANGE: + inspected = "HA_EXTRA_NO_USER_CHANGE"; + break; + case HA_EXTRA_KEY_CACHE: + inspected = "HA_EXTRA_KEY_CACHE"; + break; + case HA_EXTRA_NO_KEY_CACHE: + inspected = "HA_EXTRA_NO_KEY_CACHE"; + break; + case HA_EXTRA_WAIT_LOCK: + inspected = "HA_EXTRA_WAIT_LOCK"; + break; + case HA_EXTRA_NO_WAIT_LOCK: + inspected = "HA_EXTRA_NO_WAIT_LOCK"; + break; + case HA_EXTRA_WRITE_CACHE: + inspected = "HA_EXTRA_WRITE_CACHE"; + break; + case HA_EXTRA_FLUSH_CACHE: + inspected = "HA_EXTRA_FLUSH_CACHE"; + break; + case HA_EXTRA_NO_KEYS: + inspected = "HA_EXTRA_NO_KEYS"; + break; + case HA_EXTRA_KEYREAD_CHANGE_POS: + inspected = "HA_EXTRA_KEYREAD_CHANGE_POS"; + break; + case HA_EXTRA_REMEMBER_POS: + inspected = "HA_EXTRA_REMEMBER_POS"; + break; + case HA_EXTRA_RESTORE_POS: + inspected = "HA_EXTRA_RESTORE_POS"; + break; + case HA_EXTRA_REINIT_CACHE: + inspected = "HA_EXTRA_REINIT_CACHE"; + break; + case HA_EXTRA_FORCE_REOPEN: + inspected = "HA_EXTRA_FORCE_REOPEN"; + break; + case HA_EXTRA_FLUSH: + inspected = "HA_EXTRA_FLUSH"; + break; + case HA_EXTRA_NO_ROWS: + inspected = "HA_EXTRA_NO_ROWS"; + break; + case HA_EXTRA_RESET_STATE: + inspected = "HA_EXTRA_RESET_STATE"; + break; + case HA_EXTRA_IGNORE_DUP_KEY: + inspected = "HA_EXTRA_IGNORE_DUP_KEY"; + break; + case HA_EXTRA_NO_IGNORE_DUP_KEY: + inspected = "HA_EXTRA_NO_IGNORE_DUP_KEY"; + break; + case HA_EXTRA_PREPARE_FOR_DROP: + inspected = "HA_EXTRA_PREPARE_FOR_DROP"; + break; + case HA_EXTRA_PREPARE_FOR_UPDATE: + inspected = "HA_EXTRA_PREPARE_FOR_UPDATE"; + break; + case HA_EXTRA_PRELOAD_BUFFER_SIZE: + inspected = "HA_EXTRA_PRELOAD_BUFFER_SIZE"; + break; + case HA_EXTRA_CHANGE_KEY_TO_UNIQUE: + inspected = "HA_EXTRA_CHANGE_KEY_TO_UNIQUE"; + break; + case HA_EXTRA_CHANGE_KEY_TO_DUP: + inspected = "HA_EXTRA_CHANGE_KEY_TO_DUP"; + break; + case HA_EXTRA_KEYREAD_PRESERVE_FIELDS: + inspected = "HA_EXTRA_KEYREAD_PRESERVE_FIELDS"; + break; + case HA_EXTRA_MMAP: + inspected = "HA_EXTRA_MMAP"; + break; + case HA_EXTRA_IGNORE_NO_KEY: + inspected = "HA_EXTRA_IGNORE_NO_KEY"; + break; + case HA_EXTRA_NO_IGNORE_NO_KEY: + inspected = "HA_EXTRA_NO_IGNORE_NO_KEY"; + break; + case HA_EXTRA_MARK_AS_LOG_TABLE: + inspected = "HA_EXTRA_MARK_AS_LOG_TABLE"; + break; + case HA_EXTRA_WRITE_CAN_REPLACE: + inspected = "HA_EXTRA_WRITE_CAN_REPLACE"; + break; + case HA_EXTRA_WRITE_CANNOT_REPLACE: + inspected = "HA_EXTRA_WRITE_CANNOT_REPLACE"; + break; + case HA_EXTRA_DELETE_CANNOT_BATCH: + inspected = "HA_EXTRA_DELETE_CANNOT_BATCH"; + break; + case HA_EXTRA_UPDATE_CANNOT_BATCH: + inspected = "HA_EXTRA_UPDATE_CANNOT_BATCH"; + break; + case HA_EXTRA_INSERT_WITH_UPDATE: + inspected = "HA_EXTRA_INSERT_WITH_UPDATE"; + break; + case HA_EXTRA_PREPARE_FOR_RENAME: + inspected = "HA_EXTRA_PREPARE_FOR_RENAME"; + break; +#ifdef MRN_HAVE_HA_EXTRA_ADD_CHILDREN_LIST + case HA_EXTRA_ADD_CHILDREN_LIST: + inspected = "HA_EXTRA_ADD_CHILDREN_LIST"; + break; +#endif + case HA_EXTRA_ATTACH_CHILDREN: + inspected = "HA_EXTRA_ATTACH_CHILDREN"; + break; +#ifdef MRN_HAVE_HA_EXTRA_IS_ATTACHED_CHILDREN + case HA_EXTRA_IS_ATTACHED_CHILDREN: + inspected = "HA_EXTRA_IS_ATTACHED_CHILDREN"; + break; +#endif + case HA_EXTRA_DETACH_CHILDREN: + inspected = "HA_EXTRA_DETACH_CHILDREN"; + break; +#ifdef MRN_HAVE_HA_EXTRA_EXPORT + case HA_EXTRA_EXPORT: + inspected = "HA_EXTRA_EXPORT"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_SECONDARY_SORT_ROWID + case HA_EXTRA_SECONDARY_SORT_ROWID: + inspected = "HA_EXTRA_SECONDARY_SORT_ROWID"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_DETACH_CHILD + case HA_EXTRA_DETACH_CHILD: + inspected = "HA_EXTRA_DETACH_CHILD"; + break; +#endif +#ifdef MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE + case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE: + inspected = "HA_EXTRA_PREPARE_FOR_FORCED_CLOSE"; + break; +#endif + } + return inspected; +} +#endif + +static uchar *mrn_open_tables_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + MRN_SHARE *share = reinterpret_cast(const_cast(record)); + *length = share->table_name_length; + DBUG_RETURN(reinterpret_cast(share->table_name)); +} + +static uchar *mrn_long_term_share_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + MRN_LONG_TERM_SHARE *long_term_share = + reinterpret_cast(const_cast(record)); + *length = long_term_share->table_name_length; + DBUG_RETURN(reinterpret_cast(long_term_share->table_name)); +} + +/* status */ +static long mrn_count_skip = 0; +static long mrn_fast_order_limit = 0; + +/* logging */ +static char *mrn_log_file_path = NULL; +static FILE *mrn_log_file = NULL; +static bool mrn_log_file_opened = false; +static grn_log_level mrn_log_level_default = GRN_LOG_DEFAULT_LEVEL; +static ulong mrn_log_level = mrn_log_level_default; + +char *mrn_default_parser = NULL; +char *mrn_default_wrapper_engine = NULL; +static int mrn_lock_timeout = grn_get_lock_timeout(); +static char *mrn_libgroonga_version = const_cast(grn_get_version()); +static char *mrn_version = const_cast(MRN_VERSION); +static char *mrn_vector_column_delimiter = NULL; + +typedef enum { + MRN_ACTION_ON_ERROR_ERROR, + MRN_ACTION_ON_ERROR_ERROR_AND_LOG, + MRN_ACTION_ON_ERROR_IGNORE, + MRN_ACTION_ON_ERROR_IGNORE_AND_LOG, +} mrn_action_on_error; + +static const char *mrn_action_on_error_names[] = { + "ERROR", + "ERROR_AND_LOG", + "IGNORE", + "IGNORE_AND_LOG", + NullS, +}; + +static mrn_action_on_error mrn_action_on_fulltext_query_error_default = + MRN_ACTION_ON_ERROR_ERROR_AND_LOG; + +static void mrn_logger_log(grn_ctx *ctx, grn_log_level level, + const char *timestamp, const char *title, + const char *message, const char *location, + void *user_data) +{ + const char level_marks[] = " EACewnid-"; + if (mrn_log_file_opened) { + mrn::Lock lock(&mrn_log_mutex); + fprintf(mrn_log_file, + "%s|%c|%08x|%s\n", + timestamp, + level_marks[level], + static_cast((ulong)(pthread_self())), + message); + fflush(mrn_log_file); + } +} + +static grn_logger mrn_logger = { + mrn_log_level_default, + GRN_LOG_TIME|GRN_LOG_MESSAGE, + NULL, + mrn_logger_log, + NULL, + NULL +}; + +/* global hashes and mutexes */ +HASH mrn_allocated_thds; +pthread_mutex_t mrn_allocated_thds_mutex; +static uchar *mrn_allocated_thds_get_key(const uchar *record, + size_t *length, + my_bool not_used __attribute__ ((unused))) +{ + MRN_DBUG_ENTER_FUNCTION(); + *length = sizeof(THD *); + DBUG_RETURN(const_cast(record)); +} + +/* system functions */ + +static struct st_mysql_storage_engine storage_engine_structure = +{ MYSQL_HANDLERTON_INTERFACE_VERSION }; + +static struct st_mysql_show_var mrn_status_variables[] = +{ + {MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_count_skip", + (char *)&mrn_count_skip, SHOW_LONG}, + {MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_fast_order_limit", + (char *)&mrn_fast_order_limit, SHOW_LONG}, + {NullS, NullS, SHOW_LONG} +}; + +static const char *mrn_log_level_type_names[] = { "NONE", "EMERG", "ALERT", + "CRIT", "ERROR", "WARNING", + "NOTICE", "INFO", "DEBUG", + "DUMP", NullS }; +static TYPELIB mrn_log_level_typelib = +{ + array_elements(mrn_log_level_type_names)-1, + "mrn_log_level_typelib", + mrn_log_level_type_names, + NULL +}; + +static void mrn_log_level_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulong new_value = *static_cast(save); + ulong old_value = mrn_log_level; + mrn_log_level = new_value; + mrn_logger.max_level = static_cast(mrn_log_level); + grn_logger_set(&mrn_ctx, &mrn_logger); + grn_ctx *ctx = grn_ctx_open(0); + mrn_change_encoding(ctx, system_charset_info); + GRN_LOG(ctx, GRN_LOG_NOTICE, "log level changed from '%s' to '%s'", + mrn_log_level_type_names[old_value], + mrn_log_level_type_names[new_value]); + grn_ctx_fin(ctx); + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_ENUM(log_level, mrn_log_level, + PLUGIN_VAR_RQCMDARG, + "logging level", + NULL, + mrn_log_level_update, + static_cast(mrn_log_level), + &mrn_log_level_typelib); + +static void mrn_log_file_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + + grn_ctx ctx; + grn_ctx_init(&ctx, 0); + mrn_change_encoding(&ctx, system_charset_info); + + const char *new_log_file_name; + new_log_file_name = *old_value_ptr; + + if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(&ctx, GRN_LOG_NOTICE, + "log file isn't changed " + "because the requested path isn't different: <%s>", + new_value); + } else { + GRN_LOG(&ctx, GRN_LOG_NOTICE, + "log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + + int log_file_open_errno = 0; + { + mrn::Lock lock(&mrn_log_mutex); + FILE *new_log_file; + new_log_file = fopen(new_value, "a"); + if (new_log_file) { + if (mrn_log_file_opened) { + fclose(mrn_log_file); + } + mrn_log_file = new_log_file; + mrn_log_file_opened = true; + } else { + log_file_open_errno = errno; + } + } + + if (log_file_open_errno == 0) { + GRN_LOG(&ctx, GRN_LOG_NOTICE, + "log file is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + new_log_file_name = new_value; + } else { + if (mrn_log_file) { + GRN_LOG(&ctx, GRN_LOG_ERROR, + "log file isn't changed " + "because the requested path can't be opened: <%s>: <%s>", + new_value, strerror(log_file_open_errno)); + } else { + GRN_LOG(&ctx, GRN_LOG_ERROR, + "log file can't be opened: <%s>: <%s>", + new_value, strerror(log_file_open_errno)); + } + } + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + char *old_log_file_name = *old_value_ptr; + *old_value_ptr = my_strdup(new_log_file_name, MYF(MY_WME)); + my_free(old_log_file_name, MYF(0)); +#else + *old_value_ptr = my_strdup(new_log_file_name, MYF(MY_WME)); +#endif + + grn_ctx_fin(&ctx); + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(log_file, mrn_log_file_path, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "log file for " MRN_PLUGIN_NAME_STRING, + NULL, + mrn_log_file_update, + MRN_LOG_FILE_PATH); + +static void mrn_default_parser_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + grn_ctx ctx; + + grn_ctx_init(&ctx, 0); + mrn_change_encoding(&ctx, system_charset_info); + if (strcmp(*old_value_ptr, new_value) == 0) { + GRN_LOG(&ctx, GRN_LOG_NOTICE, + "default parser isn't changed " + "because the requested default parser isn't different: <%s>", + new_value); + } else { + GRN_LOG(&ctx, GRN_LOG_NOTICE, + "default fulltext parser is changed: <%s> -> <%s>", + *old_value_ptr, new_value); + } + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(*old_value_ptr, MYF(0)); + *old_value_ptr = my_strdup(new_value, MYF(MY_WME)); +#else + *old_value_ptr = (char *)new_value; +#endif + + grn_ctx_fin(&ctx); + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(default_parser, mrn_default_parser, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "default fulltext parser", + NULL, + mrn_default_parser_update, + MRN_PARSER_DEFAULT); + +static MYSQL_THDVAR_BOOL( + dry_write, /* name */ + PLUGIN_VAR_OPCMDARG, /* options */ + "If dry_write is true, any write operations are ignored.", /* comment */ + NULL, /* check */ + NULL, /* update */ + false /* default */ +); + +static MYSQL_THDVAR_BOOL( + enable_optimization, /* name */ + PLUGIN_VAR_OPCMDARG, /* options */ + "If enable_optimization is true, some optimizations will be applied.", /* comment */ + NULL, /* check */ + NULL, /* update */ + true /* default */ +); + +static MYSQL_THDVAR_LONGLONG(match_escalation_threshold, + PLUGIN_VAR_RQCMDARG, + "The threshold to determin whether search method is escalated", + NULL, + NULL, + grn_get_default_match_escalation_threshold(), + -1, + LONGLONG_MAX, + 0); + +static void mrn_vector_column_delimiter_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; + +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + my_free(*old_value_ptr, MYF(0)); + *old_value_ptr = my_strdup(new_value, MYF(MY_WME)); +#else + *old_value_ptr = (char *)new_value; +#endif + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(vector_column_delimiter, mrn_vector_column_delimiter, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "The vector column delimiter", + NULL, + &mrn_vector_column_delimiter_update, + " "); + +static void mrn_database_path_prefix_update(THD *thd, + struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const char *new_value = *((const char **)save); + char **old_value_ptr = (char **)var_ptr; +#ifdef MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR + if (*old_value_ptr) + my_free(*old_value_ptr, MYF(0)); + if (new_value) + *old_value_ptr = my_strdup(new_value, MYF(MY_WME)); + else + *old_value_ptr = NULL; +#else + *old_value_ptr = (char *)new_value; +#endif + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_STR(database_path_prefix, + mrn::PathMapper::default_path_prefix, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "The database path prefix", + NULL, + &mrn_database_path_prefix_update, + NULL); + +static MYSQL_SYSVAR_STR(default_wrapper_engine, mrn_default_wrapper_engine, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "The default engine for wrapper mode", + NULL, + NULL, + NULL); + +static TYPELIB mrn_action_on_error_typelib = +{ + array_elements(mrn_action_on_error_names) - 1, + "mrn_action_on_error_typelib", + mrn_action_on_error_names, + NULL +}; + +static MYSQL_THDVAR_ENUM(action_on_fulltext_query_error, + PLUGIN_VAR_RQCMDARG, + "action on fulltext query error", + NULL, + NULL, + mrn_action_on_fulltext_query_error_default, + &mrn_action_on_error_typelib); + +static void mrn_lock_timeout_update(THD *thd, struct st_mysql_sys_var *var, + void *var_ptr, const void *save) +{ + MRN_DBUG_ENTER_FUNCTION(); + const int new_value = *static_cast(save); + int *old_value_ptr = static_cast(var_ptr); + + *old_value_ptr = new_value; + grn_set_lock_timeout(new_value); + + DBUG_VOID_RETURN; +} + +static MYSQL_SYSVAR_INT(lock_timeout, + mrn_lock_timeout, + PLUGIN_VAR_RQCMDARG, + "lock timeout used in Groonga", + NULL, + mrn_lock_timeout_update, + grn_get_lock_timeout(), + -1, + INT_MAX, + 1); + +static MYSQL_SYSVAR_STR(libgroonga_version, mrn_libgroonga_version, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, + "The version of libgroonga", + NULL, + NULL, + grn_get_version()); + +static MYSQL_SYSVAR_STR(version, mrn_version, + PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY, + "The version of mroonga", + NULL, + NULL, + MRN_VERSION); + +static struct st_mysql_sys_var *mrn_system_variables[] = +{ + MYSQL_SYSVAR(log_level), + MYSQL_SYSVAR(log_file), + MYSQL_SYSVAR(default_parser), + MYSQL_SYSVAR(dry_write), + MYSQL_SYSVAR(enable_optimization), + MYSQL_SYSVAR(match_escalation_threshold), + MYSQL_SYSVAR(database_path_prefix), + MYSQL_SYSVAR(default_wrapper_engine), + MYSQL_SYSVAR(action_on_fulltext_query_error), + MYSQL_SYSVAR(lock_timeout), + MYSQL_SYSVAR(libgroonga_version), + MYSQL_SYSVAR(version), + MYSQL_SYSVAR(vector_column_delimiter), + NULL +}; + +/* mroonga information schema */ +static struct st_mysql_information_schema i_s_info = +{ + MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION +}; + +static ST_FIELD_INFO i_s_mrn_stats_fields_info[] = +{ + { + "VERSION", + 40, + MYSQL_TYPE_STRING, + 0, + 0, + "", + SKIP_OPEN_TABLE + }, + { + "rows_written", + MY_INT32_NUM_DECIMAL_DIGITS, + MYSQL_TYPE_LONG, + 0, + 0, + "Rows written to groonga", + SKIP_OPEN_TABLE + }, + { + "rows_read", + MY_INT32_NUM_DECIMAL_DIGITS, + MYSQL_TYPE_LONG, + 0, + 0, + "Rows read from groonga", + SKIP_OPEN_TABLE + } +}; + +static int i_s_mrn_stats_deinit(void* p) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0); +} + +static int i_s_mrn_stats_fill( + THD* thd, TABLE_LIST* tables, Item* cond) +{ + TABLE* table = (TABLE *) tables->table; + int status = 0; + MRN_DBUG_ENTER_FUNCTION(); + table->field[0]->store(grn_get_version(), strlen(grn_get_version()), + system_charset_info); + table->field[0]->set_notnull(); + table->field[1]->store(1); /* TODO */ + table->field[2]->store(2); /* TODO */ + if (schema_table_store_record(thd, table)) { + status = 1; + } + DBUG_RETURN(status); +} + +static int i_s_mrn_stats_init(void* p) +{ + MRN_DBUG_ENTER_FUNCTION(); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + schema->fields_info = i_s_mrn_stats_fields_info; + schema->fill_table = i_s_mrn_stats_fill; + DBUG_RETURN(0); +} + +struct st_mysql_plugin i_s_mrn_stats = +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &i_s_info, + MRN_STATUS_VARIABLE_NAME_PREFIX_STRING "_stats", + MRN_PLUGIN_AUTHOR, + "Statistics for " MRN_PLUGIN_NAME_STRING, + PLUGIN_LICENSE_GPL, + i_s_mrn_stats_init, + i_s_mrn_stats_deinit, + MRN_VERSION_IN_HEX, + NULL, + NULL, + MRN_PLUGIN_LAST_VALUES +}; +/* End of mroonga information schema implementations */ + +static handler *mrn_handler_create(handlerton *hton, TABLE_SHARE *share, MEM_ROOT *root) +{ + MRN_DBUG_ENTER_FUNCTION(); + handler *new_handler = new (root) ha_mroonga(hton, share); + DBUG_RETURN(new_handler); +} + +static void mrn_drop_database(handlerton *hton, char *path) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_db_manager->drop(path); + DBUG_VOID_RETURN; +} + +static int mrn_close_connection(handlerton *hton, THD *thd) +{ + MRN_DBUG_ENTER_FUNCTION(); + void *p = *thd_ha_data(thd, mrn_hton_ptr); + if (p) { + mrn_clear_alter_share(thd); + free(p); + *thd_ha_data(thd, mrn_hton_ptr) = (void *) NULL; + { + mrn::Lock lock(&mrn_allocated_thds_mutex); + my_hash_delete(&mrn_allocated_thds, (uchar*) thd); + } + } + DBUG_RETURN(0); +} + +static bool mrn_flush_logs(handlerton *hton) +{ + MRN_DBUG_ENTER_FUNCTION(); + bool result = 0; + if (mrn_log_file_opened) { + mrn::Lock lock(&mrn_log_mutex); + fclose(mrn_log_file); + mrn_log_file = fopen(mrn_log_file_path, "a"); + } + DBUG_RETURN(result); +} + +static grn_builtin_type mrn_grn_type_from_field(grn_ctx *ctx, Field *field, + bool for_index_key) +{ + grn_builtin_type type = GRN_DB_VOID; + enum_field_types mysql_field_type = field->real_type(); + switch (mysql_field_type) { + case MYSQL_TYPE_DECIMAL: // DECIMAL; <= 65bytes + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_TINY: // TINYINT; 1byte + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT8; // 1byte + } else { + type = GRN_DB_INT8; // 1byte + } + break; + case MYSQL_TYPE_SHORT: // SMALLINT; 2bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT16; // 2bytes + } else { + type = GRN_DB_INT16; // 2bytes + } + break; + case MYSQL_TYPE_LONG: // INT; 4bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT32; // 4bytes + } else { + type = GRN_DB_INT32; // 4bytes + } + break; + case MYSQL_TYPE_FLOAT: // FLOAT; 4 or 8bytes + case MYSQL_TYPE_DOUBLE: // DOUBLE; 8bytes + type = GRN_DB_FLOAT; // 8bytes + break; + case MYSQL_TYPE_NULL: // NULL; 1byte + type = GRN_DB_INT8; // 1byte + break; + case MYSQL_TYPE_TIMESTAMP: // TIMESTAMP; 4bytes + type = GRN_DB_TIME; // 8bytes + break; + case MYSQL_TYPE_LONGLONG: // BIGINT; 8bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT64; // 8bytes + } else { + type = GRN_DB_INT64; // 8bytes + } + break; + case MYSQL_TYPE_INT24: // MEDIUMINT; 3bytes + if (static_cast(field)->unsigned_flag) { + type = GRN_DB_UINT32; // 4bytes + } else { + type = GRN_DB_INT32; // 4bytes + } + break; + case MYSQL_TYPE_DATE: // DATE; 4bytes + case MYSQL_TYPE_TIME: // TIME; 3bytes + case MYSQL_TYPE_DATETIME: // DATETIME; 8bytes + case MYSQL_TYPE_YEAR: // YEAR; 1byte + case MYSQL_TYPE_NEWDATE: // DATE; 3bytes + type = GRN_DB_TIME; // 8bytes + break; + case MYSQL_TYPE_VARCHAR: // VARCHAR; <= 64KB * 4 + 2bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + if (field->field_length <= MRN_SHORT_TEXT_SIZE) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else if (field->field_length <= MRN_TEXT_SIZE) { + type = GRN_DB_TEXT; // 64Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + } + break; + case MYSQL_TYPE_BIT: // BIT; <= 8bytes + type = GRN_DB_INT64; // 8bytes + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: // TIMESTAMP; 4bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: // DATETIME; 8bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: // TIME(FSP); 3 + (FSP + 1) / 2 bytes + // 0 <= FSP <= 6; 3-6bytes + type = GRN_DB_TIME; // 8bytes + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: // DECIMAL; <= 9bytes + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_ENUM: // ENUM; <= 2bytes + if (field->pack_length() == 1) { + type = GRN_DB_UINT8; // 1bytes + } else { + type = GRN_DB_UINT16; // 2bytes + } + break; + case MYSQL_TYPE_SET: // SET; <= 8bytes + switch (field->pack_length()) { + case 1: + type = GRN_DB_UINT8; // 1byte + break; + case 2: + type = GRN_DB_UINT16; // 2bytes + break; + case 3: + case 4: + type = GRN_DB_UINT32; // 3bytes + break; + case 8: + default: + type = GRN_DB_UINT64; // 8bytes + break; + } + break; + case MYSQL_TYPE_TINY_BLOB: // TINYBLOB; <= 256bytes + 1byte + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_MEDIUM_BLOB: // MEDIUMBLOB; <= 16Mbytes + 3bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_LONG_BLOB: // LONGBLOB; <= 4Gbytes + 4bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_BLOB: // BLOB; <= 64Kbytes + 2bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + break; + case MYSQL_TYPE_VAR_STRING: // VARCHAR; <= 255byte * 4 + 1bytes + if (for_index_key) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else { + if (field->field_length <= MRN_SHORT_TEXT_SIZE) { + type = GRN_DB_SHORT_TEXT; // 4Kbytes + } else if (field->field_length <= MRN_TEXT_SIZE) { + type = GRN_DB_TEXT; // 64Kbytes + } else { + type = GRN_DB_LONG_TEXT; // 2Gbytes + } + } + break; + case MYSQL_TYPE_STRING: // CHAR; < 1Kbytes =~ (255 * 4)bytes + // 4 is the maximum size of a character + type = GRN_DB_SHORT_TEXT; // 4Kbytes + break; + case MYSQL_TYPE_GEOMETRY: // case-by-case + type = GRN_DB_WGS84_GEO_POINT; // 8bytes + break; + } + return type; +} + +#ifdef HAVE_SPATIAL +static int mrn_set_geometry(grn_ctx *ctx, grn_obj *buf, + const char *wkb, uint wkb_size) +{ + int error = 0; + Geometry_buffer buffer; + Geometry *geometry; + + geometry = Geometry::construct(&buffer, wkb, wkb_size); + if (!geometry) { + return ER_CANT_CREATE_GEOMETRY_OBJECT; + } + switch (geometry->get_class_info()->m_type_id) { + case Geometry::wkb_point: + { + Gis_point *point = (Gis_point *)geometry; + double latitude = 0.0, longitude = 0.0; +#ifdef MRN_HAVE_POINT_XY + point_xy xy(0.0, 0.0); + point->get_xy(&xy); + longitude = xy.x; + latitude = xy.y; +#else + point->get_xy(&longitude, &latitude); +#endif + grn_obj_reinit(ctx, buf, GRN_DB_WGS84_GEO_POINT, 0); + GRN_GEO_POINT_SET(ctx, buf, + GRN_GEO_DEGREE2MSEC(latitude), + GRN_GEO_DEGREE2MSEC(longitude)); + break; + } + default: + my_printf_error(ER_MRN_GEOMETRY_NOT_SUPPORT_NUM, + ER_MRN_GEOMETRY_NOT_SUPPORT_STR, MYF(0)); + error = ER_MRN_GEOMETRY_NOT_SUPPORT_NUM; + break; + } + delete geometry; + + return error; +} +#endif + +static uint mrn_alter_table_flags(uint flags) +{ + uint alter_flags = 0; +#ifdef HA_INPLACE_ADD_INDEX_NO_READ_WRITE + bool is_inplace_index_change; +# ifdef MRN_HAVE_ALTER_INFO + is_inplace_index_change = (((flags & Alter_info::ALTER_ADD_INDEX) && + (flags & Alter_info::ALTER_DROP_INDEX)) || + (flags & Alter_info::ALTER_CHANGE_COLUMN)); +# else + is_inplace_index_change = (((flags & ALTER_ADD_INDEX) && + (flags & ALTER_DROP_INDEX)) || + (flags & ALTER_CHANGE_COLUMN)); +# endif + if (!is_inplace_index_change) { + alter_flags |= + HA_INPLACE_ADD_INDEX_NO_READ_WRITE | + HA_INPLACE_DROP_INDEX_NO_READ_WRITE | + HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE | + HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE | + HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE | + HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE | + HA_INPLACE_ADD_INDEX_NO_WRITE | + HA_INPLACE_DROP_INDEX_NO_WRITE | + HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE | + HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE | + HA_INPLACE_ADD_PK_INDEX_NO_WRITE | + HA_INPLACE_DROP_PK_INDEX_NO_WRITE; + } +#endif + return alter_flags; +} + +static int mrn_init(void *p) +{ + // init handlerton + grn_ctx *ctx = NULL; + handlerton *hton; + hton = (handlerton *)p; + hton->state = SHOW_OPTION_YES; + hton->create = mrn_handler_create; + hton->flags = HTON_NO_PARTITION; + hton->drop_database = mrn_drop_database; + hton->close_connection = mrn_close_connection; + hton->flush_logs = mrn_flush_logs; + hton->alter_table_flags = mrn_alter_table_flags; + mrn_hton_ptr = hton; + +#ifdef _WIN32 + HMODULE current_module = GetModuleHandle(NULL); + mrn_binlog_filter = + *((Rpl_filter **)GetProcAddress(current_module, MRN_BINLOG_FILTER_PROC)); + mrn_my_tz_UTC = + *((Time_zone **)GetProcAddress(current_module, MRN_MY_TZ_UTC_PROC)); +# ifdef MRN_HAVE_TABLE_DEF_CACHE + mrn_table_def_cache = (HASH *)GetProcAddress(current_module, + "?table_def_cache@@3Ust_hash@@A"); +# endif +# ifndef MRN_HAVE_TDC_LOCK_TABLE_SHARE + mrn_LOCK_open = +# if MYSQL_VERSION_ID >= 50500 + (mysql_mutex_t *)GetProcAddress(current_module, + "?LOCK_open@@3Ust_mysql_mutex@@A"); +# else + (pthread_mutex_t *)GetProcAddress(current_module, + "?LOCK_open@@3U_RTL_CRITICAL_SECTION@@A"); +# endif +# endif +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE + mrn_table_share_lock_share = + (PSI_mutex_key *)GetProcAddress(current_module, MRN_TABLE_SHARE_LOCK_SHARE_PROC); +# endif +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA + mrn_table_share_lock_ha_data = + (PSI_mutex_key *)GetProcAddress(current_module, MRN_TABLE_SHARE_LOCK_HA_DATA_PROC); +# endif +#else + mrn_binlog_filter = binlog_filter; + mrn_my_tz_UTC = my_tz_UTC; +# ifdef MRN_HAVE_TABLE_DEF_CACHE + mrn_table_def_cache = &table_def_cache; +# endif +# ifndef MRN_HAVE_TDC_LOCK_TABLE_SHARE + mrn_LOCK_open = &LOCK_open; +# endif +#endif + + // init groonga + if (grn_init() != GRN_SUCCESS) { + goto err_grn_init; + } + + grn_set_lock_timeout(mrn_lock_timeout); + + mrn_init_encoding_map(); + + grn_ctx_init(&mrn_ctx, 0); + ctx = &mrn_ctx; + if (mrn_change_encoding(ctx, system_charset_info)) + goto err_mrn_change_encoding; + + if (pthread_mutex_init(&mrn_log_mutex, NULL) != 0) { + goto err_log_mutex_init; + } + + mrn_logger.max_level = static_cast(mrn_log_level); + grn_logger_set(ctx, &mrn_logger); + if (!(mrn_log_file = fopen(mrn_log_file_path, "a"))) { + goto err_log_file_open; + } + mrn_log_file_opened = true; + GRN_LOG(ctx, GRN_LOG_NOTICE, "%s started.", MRN_PACKAGE_STRING); + GRN_LOG(ctx, GRN_LOG_NOTICE, "log level is '%s'", + mrn_log_level_type_names[mrn_log_level]); + + // init meta-info database + if (!(mrn_db = grn_db_create(ctx, NULL, NULL))) { + GRN_LOG(ctx, GRN_LOG_ERROR, "cannot create system database, exiting"); + goto err_db_create; + } + grn_ctx_use(ctx, mrn_db); + + grn_ctx_init(&mrn_db_manager_ctx, 0); + grn_logger_set(&mrn_db_manager_ctx, &mrn_logger); + mrn_db_manager = new mrn::DatabaseManager(&mrn_db_manager_ctx); + if (!mrn_db_manager->init()) { + goto err_db_manager_init; + } + if ((pthread_mutex_init(&mrn_allocated_thds_mutex, NULL) != 0)) { + goto err_allocated_thds_mutex_init; + } + if (my_hash_init(&mrn_allocated_thds, system_charset_info, 32, 0, 0, + mrn_allocated_thds_get_key, 0, 0)) { + goto error_allocated_thds_hash_init; + } + if ((pthread_mutex_init(&mrn_open_tables_mutex, NULL) != 0)) { + goto err_allocated_open_tables_mutex_init; + } + if (my_hash_init(&mrn_open_tables, system_charset_info, 32, 0, 0, + mrn_open_tables_get_key, 0, 0)) { + goto error_allocated_open_tables_hash_init; + } + if ((pthread_mutex_init(&mrn_long_term_share_mutex, NULL) != 0)) { + goto error_allocated_long_term_share_mutex_init; + } + if (my_hash_init(&mrn_long_term_share, system_charset_info, 32, 0, 0, + mrn_long_term_share_get_key, 0, 0)) { + goto error_allocated_long_term_share_hash_init; + } + +#ifdef MRN_USE_MYSQL_DATA_HOME + mrn::PathMapper::default_mysql_data_home_path = mysql_data_home; +#endif + + return 0; + +error_allocated_long_term_share_hash_init: + pthread_mutex_destroy(&mrn_long_term_share_mutex); +error_allocated_long_term_share_mutex_init: + my_hash_free(&mrn_open_tables); +error_allocated_open_tables_hash_init: + pthread_mutex_destroy(&mrn_open_tables_mutex); +err_allocated_open_tables_mutex_init: + my_hash_free(&mrn_allocated_thds); +error_allocated_thds_hash_init: + pthread_mutex_destroy(&mrn_allocated_thds_mutex); +err_allocated_thds_mutex_init: +err_db_manager_init: + delete mrn_db_manager; + grn_ctx_fin(&mrn_db_manager_ctx); + grn_obj_unlink(ctx, mrn_db); +err_db_create: + if (mrn_log_file_opened) { + fclose(mrn_log_file); + mrn_log_file_opened = false; + } +err_log_file_open: + pthread_mutex_destroy(&mrn_log_mutex); +err_log_mutex_init: +err_mrn_change_encoding: + grn_ctx_fin(ctx); + grn_fin(); +err_grn_init: + return -1; +} + +static int mrn_deinit(void *p) +{ + THD *thd = current_thd, *tmp_thd; + grn_ctx *ctx = &mrn_ctx; + MRN_LONG_TERM_SHARE *long_term_share; + + GRN_LOG(ctx, GRN_LOG_NOTICE, "%s deinit", MRN_PACKAGE_STRING); + + if (thd && thd_sql_command(thd) == SQLCOM_UNINSTALL_PLUGIN) { + mrn::Lock lock(&mrn_allocated_thds_mutex); + while ((tmp_thd = (THD *) my_hash_element(&mrn_allocated_thds, 0))) + { + mrn_clear_alter_share(tmp_thd); + void *slot_ptr = mrn_get_slot_data(tmp_thd, false); + if (slot_ptr) free(slot_ptr); + *thd_ha_data(tmp_thd, mrn_hton_ptr) = (void *) NULL; + my_hash_delete(&mrn_allocated_thds, (uchar *) tmp_thd); + } + } + + { + mrn::Lock lock(&mrn_open_tables_mutex); + while ((long_term_share = (MRN_LONG_TERM_SHARE *) + my_hash_element(&mrn_long_term_share, 0))) + { + mrn_free_long_term_share(long_term_share); + } + } + + my_hash_free(&mrn_long_term_share); + pthread_mutex_destroy(&mrn_long_term_share_mutex); + my_hash_free(&mrn_open_tables); + pthread_mutex_destroy(&mrn_open_tables_mutex); + my_hash_free(&mrn_allocated_thds); + pthread_mutex_destroy(&mrn_allocated_thds_mutex); + delete mrn_db_manager; + grn_ctx_fin(&mrn_db_manager_ctx); + + grn_obj_unlink(ctx, mrn_db); + grn_ctx_fin(ctx); + grn_fin(); + + if (mrn_log_file_opened) { + fclose(mrn_log_file); + mrn_log_file_opened = false; + } + pthread_mutex_destroy(&mrn_log_mutex); + + return 0; +} + +mrn_declare_plugin(MRN_PLUGIN_NAME) +{ + MYSQL_STORAGE_ENGINE_PLUGIN, + &storage_engine_structure, + MRN_PLUGIN_NAME_STRING, + MRN_PLUGIN_AUTHOR, + "CJK-ready fulltext search, column store", + PLUGIN_LICENSE_GPL, + mrn_init, + mrn_deinit, + MRN_VERSION_IN_HEX, + mrn_status_variables, + mrn_system_variables, + MRN_PLUGIN_LAST_VALUES +}, +i_s_mrn_stats +mrn_declare_plugin_end; + +static void mrn_generic_ft_clear(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + if (!info->ctx) { + DBUG_VOID_RETURN; + } + + if (info->cursor) { + grn_obj_unlink(info->ctx, info->cursor); + } + if (info->id_accessor) { + grn_obj_unlink(info->ctx, info->id_accessor); + } + if (info->key_accessor) { + grn_obj_unlink(info->ctx, info->key_accessor); + } + grn_obj_unlink(info->ctx, info->result); + grn_obj_unlink(info->ctx, info->score_column); + grn_obj_unlink(info->ctx, &(info->key)); + grn_obj_unlink(info->ctx, &(info->score)); + + info->ctx = NULL; + + DBUG_VOID_RETURN; +} + +static void mrn_generic_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + mrn_generic_ft_clear(handler); + delete info; + DBUG_VOID_RETURN; +} + +static int mrn_wrapper_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_wrapper_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + float score = 0.0; + grn_id record_id; + + mrn_change_encoding(info->ctx, NULL); + key_copy((uchar *)(GRN_TEXT_VALUE(&(info->key))), record, + info->primary_key_info, info->primary_key_info->key_length); + record_id = grn_table_get(info->ctx, + info->table, + GRN_TEXT_VALUE(&(info->key)), + GRN_TEXT_LEN(&(info->key))); + + if (record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &record_id, sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = (float)GRN_INT32_VALUE(&(info->score)); + } + } + + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_wrapper_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_generic_ft_close_search(handler); + DBUG_VOID_RETURN; +} + +static float mrn_wrapper_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + float score = 0.0; + grn_id record_id; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + record_id = grn_table_get(info->ctx, + info->table, + GRN_TEXT_VALUE(&(mroonga->key_buffer)), + GRN_TEXT_LEN(&(mroonga->key_buffer))); + + if (record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &record_id, sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = (float)GRN_INT32_VALUE(&(info->score)); + } + } + + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_wrapper_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_wrapper_ft_vft = { + mrn_wrapper_ft_read_next, + mrn_wrapper_ft_find_relevance, + mrn_wrapper_ft_close_search, + mrn_wrapper_ft_get_relevance, + mrn_wrapper_ft_reinit_search +}; + +static int mrn_storage_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_storage_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + + float score = 0.0; + if (mroonga->record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &(mroonga->record_id), sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = (float)GRN_INT32_VALUE(&(info->score)); + } + } + DBUG_PRINT("info", ("mroonga: record_id=%d score=%g", + mroonga->record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_storage_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn_generic_ft_close_search(handler); + DBUG_VOID_RETURN; +} + +static float mrn_storage_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + ha_mroonga *mroonga = info->mroonga; + mrn_change_encoding(info->ctx, NULL); + + float score = 0.0; + if (mroonga->record_id != GRN_ID_NIL) { + grn_id result_record_id; + result_record_id = grn_table_get(info->ctx, info->result, + &(mroonga->record_id), sizeof(grn_id)); + if (result_record_id != GRN_ID_NIL) { + GRN_BULK_REWIND(&(info->score)); + grn_obj_get_value(info->ctx, info->score_column, + result_record_id, &(info->score)); + score = (float)GRN_INT32_VALUE(&(info->score)); + } + } + DBUG_PRINT("info", + ("mroonga: record_id=%d score=%g", mroonga->record_id, score)); + + DBUG_RETURN(score); +} + +static void mrn_storage_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_storage_ft_vft = { + mrn_storage_ft_read_next, + mrn_storage_ft_find_relevance, + mrn_storage_ft_close_search, + mrn_storage_ft_get_relevance, + mrn_storage_ft_reinit_search +}; + +static int mrn_no_such_key_ft_read_next(FT_INFO *handler, char *record) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(HA_ERR_END_OF_FILE); +} + +static float mrn_no_such_key_ft_find_relevance(FT_INFO *handler, uchar *record, + uint length) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0.0); +} + +static void mrn_no_such_key_ft_close_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = (st_mrn_ft_info *)handler; + delete info; + DBUG_VOID_RETURN; +} + +static float mrn_no_such_key_ft_get_relevance(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_RETURN(0.0); +} + +static void mrn_no_such_key_ft_reinit_search(FT_INFO *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + DBUG_VOID_RETURN; +} + +static _ft_vft mrn_no_such_key_ft_vft = { + mrn_no_such_key_ft_read_next, + mrn_no_such_key_ft_find_relevance, + mrn_no_such_key_ft_close_search, + mrn_no_such_key_ft_get_relevance, + mrn_no_such_key_ft_reinit_search +}; + +#ifdef HA_CAN_FULLTEXT_EXT +static uint mrn_generic_ft_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + // This value is not used in MySQL 5.6.7-rc. So it is + // meaningless. It may be used in the future... + uint version = 1; + DBUG_RETURN(version); +} + +static ulonglong mrn_generic_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + // TODO: Should we support FTS_ORDERED_RESULT? + // TODO: Shuold we support FTS_DOCID_IN_RESULT? + ulonglong flags = 0; + DBUG_RETURN(flags); +} + +// This function is used if we enable FTS_DOCID_IN_RESULT flag and the +// table has "FTS_DOC_ID" (defined as FTS_DOC_ID_COL_NAME macro) +// special name column. Should we support "FTS_DOC_ID" special name +// column? +// See also sql/sql_optimizer.cc:JOIN::optimize_fts_query(). +static ulonglong mrn_generic_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = GRN_ID_NIL; + DBUG_RETURN(id); +} + +static ulonglong mrn_generic_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_ft_info *info = reinterpret_cast(handler); + ulonglong n_records = grn_table_size(info->ctx, info->result); + DBUG_RETURN(n_records); +} + +static uint mrn_wrapper_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_wrapper_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_wrapper_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = mrn_generic_ft_ext_get_docid(handler); + DBUG_RETURN(id); +} + +static ulonglong mrn_wrapper_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = mrn_generic_ft_ext_count_matches(handler); + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_wrapper_ft_vft_ext = { + mrn_wrapper_ft_ext_get_version, + mrn_wrapper_ft_ext_get_flags, + mrn_wrapper_ft_ext_get_docid, + mrn_wrapper_ft_ext_count_matches +}; + +static uint mrn_storage_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_storage_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_storage_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = mrn_generic_ft_ext_get_docid(handler); + DBUG_RETURN(id); +} + +static ulonglong mrn_storage_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = mrn_generic_ft_ext_count_matches(handler); + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_storage_ft_vft_ext = { + mrn_storage_ft_ext_get_version, + mrn_storage_ft_ext_get_flags, + mrn_storage_ft_ext_get_docid, + mrn_storage_ft_ext_count_matches +}; + +static uint mrn_no_such_key_ft_ext_get_version() +{ + MRN_DBUG_ENTER_FUNCTION(); + uint version = mrn_generic_ft_get_version(); + DBUG_RETURN(version); +} + +static ulonglong mrn_no_such_key_ft_ext_get_flags() +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong flags = mrn_generic_ft_ext_get_flags(); + DBUG_RETURN(flags); +} + +static ulonglong mrn_no_such_key_ft_ext_get_docid(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong id = GRN_ID_NIL; + DBUG_RETURN(id); +} + +static ulonglong mrn_no_such_key_ft_ext_count_matches(FT_INFO_EXT *handler) +{ + MRN_DBUG_ENTER_FUNCTION(); + ulonglong n_records = 0; + DBUG_RETURN(n_records); +} + +static _ft_vft_ext mrn_no_such_key_ft_vft_ext = { + mrn_no_such_key_ft_ext_get_version, + mrn_no_such_key_ft_ext_get_flags, + mrn_no_such_key_ft_ext_get_docid, + mrn_no_such_key_ft_ext_count_matches +}; +#endif + +/* handler implementation */ +ha_mroonga::ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg) + :handler(hton, share_arg), + wrap_handler(NULL), + is_clone(false), + parent_for_clone(NULL), + mem_root_for_clone(NULL), + record_id(GRN_ID_NIL), + key_id(NULL), + del_key_id(NULL), + + wrap_ft_init_count(0), + share(NULL), + wrap_key_info(NULL), + base_key_info(NULL), + + analyzed_for_create(false), + wrap_handler_for_create(NULL), +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + hnd_add_index(NULL), +#endif +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + alter_key_info_buffer(NULL), +#else + wrap_alter_key_info(NULL), +#endif + mrn_lock_type(F_UNLCK), + + ctx_entity_(), + ctx(&ctx_entity_), + grn_table(NULL), + grn_columns(NULL), + grn_column_ranges(NULL), + grn_index_tables(NULL), + grn_index_columns(NULL), + grn_table_is_referenced(false), + + grn_source_column_geo(NULL), + cursor_geo(NULL), + cursor(NULL), + index_table_cursor(NULL), + empty_value_records(NULL), + empty_value_records_cursor(NULL), + + sorted_result(NULL), + matched_record_keys(NULL), + blob_buffers(NULL), + + dup_key(0), + + count_skip(false), + fast_order_limit(false), + fast_order_limit_with_index(false), + + ignoring_duplicated_key(false), + inserting_with_update(false), + fulltext_searching(false), + ignoring_no_key_columns(false), + replacing_(false), + written_by_row_based_binlog(0), + current_ft_item(NULL) +{ + MRN_DBUG_ENTER_METHOD(); + grn_ctx_init(ctx, 0); + mrn_change_encoding(ctx, system_charset_info); + grn_ctx_use(ctx, mrn_db); + GRN_WGS84_GEO_POINT_INIT(&top_left_point, 0); + GRN_WGS84_GEO_POINT_INIT(&bottom_right_point, 0); + GRN_WGS84_GEO_POINT_INIT(&source_point, 0); + GRN_TEXT_INIT(&key_buffer, 0); + GRN_TEXT_INIT(&encoded_key_buffer, 0); + GRN_VOID_INIT(&old_value_buffer); + GRN_VOID_INIT(&new_value_buffer); + DBUG_VOID_RETURN; +} + +ha_mroonga::~ha_mroonga() +{ + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create) { + if (wrap_handler_for_create) { + delete wrap_handler_for_create; + } + if (share_for_create.wrapper_mode) { + plugin_unlock(NULL, share_for_create.plugin); + } + mrn_free_share_alloc(&share_for_create); + free_root(&mem_root_for_create, MYF(0)); + } + if (blob_buffers) + { + delete [] blob_buffers; + } + grn_obj_unlink(ctx, &top_left_point); + grn_obj_unlink(ctx, &bottom_right_point); + grn_obj_unlink(ctx, &source_point); + grn_obj_unlink(ctx, &key_buffer); + grn_obj_unlink(ctx, &encoded_key_buffer); + grn_obj_unlink(ctx, &old_value_buffer); + grn_obj_unlink(ctx, &new_value_buffer); + grn_ctx_fin(ctx); + DBUG_VOID_RETURN; +} + +const char *ha_mroonga::table_type() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(MRN_PLUGIN_NAME_STRING); +} + +const char *ha_mroonga::index_type(uint key_nr) +{ + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->s->key_info[key_nr]; + if (key_info.algorithm == HA_KEY_ALG_FULLTEXT) { + DBUG_RETURN("FULLTEXT"); + } else if (key_info.algorithm == HA_KEY_ALG_HASH) { + DBUG_RETURN("HASH"); + } else { + DBUG_RETURN("BTREE"); + } +} + +static const char *ha_mroonga_exts[] = { + NullS +}; +const char **ha_mroonga::bas_ext() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(ha_mroonga_exts); +} + +uint ha_mroonga::wrapper_max_supported_record_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_record_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_record_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_record_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_record_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_record_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_record_length(); + } else { + res = storage_max_supported_record_length(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_keys() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_keys(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_keys(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_keys() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_keys() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_keys(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_keys(); + } else { + res = storage_max_supported_keys(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_key_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_key_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_key_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_key_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_key_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_key_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_key_length(); + } else { + res = storage_max_supported_key_length(); + } + + DBUG_RETURN(res); +} + +uint ha_mroonga::wrapper_max_supported_key_part_length() const +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrap_handler_for_create->max_supported_key_part_length(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->max_supported_key_part_length(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_max_supported_key_part_length() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_MAX_REC_LENGTH); +} + +uint ha_mroonga::max_supported_key_part_length() const +{ + MRN_DBUG_ENTER_METHOD(); + + uint res; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + res = wrapper_max_supported_key_part_length(); + } else if (wrap_handler && share && share->wrapper_mode) { + res = wrapper_max_supported_key_part_length(); + } else { + res = storage_max_supported_key_part_length(); + } + + DBUG_RETURN(res); +} + +ulonglong ha_mroonga::wrapper_table_flags() const +{ + ulonglong table_flags; + MRN_DBUG_ENTER_METHOD(); + if (analyzed_for_create && share_for_create.wrapper_mode) { + table_flags = wrap_handler_for_create->ha_table_flags(); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + table_flags = wrap_handler->ha_table_flags(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + table_flags |= HA_CAN_FULLTEXT | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | + HA_CAN_RTREEKEYS | HA_REC_NOT_IN_SEQ; +#ifdef HA_CAN_REPAIR + table_flags |= HA_CAN_REPAIR; +#endif +#ifdef HA_CAN_FULLTEXT_EXT + table_flags |= HA_CAN_FULLTEXT_EXT; +#endif + DBUG_RETURN(table_flags); +} + +ulonglong ha_mroonga::storage_table_flags() const +{ + MRN_DBUG_ENTER_METHOD(); + ulonglong flags = + HA_NO_TRANSACTIONS | + HA_PARTIAL_COLUMN_READ | + HA_REC_NOT_IN_SEQ | + HA_NULL_IN_KEY | + HA_CAN_INDEX_BLOBS | + HA_STATS_RECORDS_IS_EXACT | + HA_CAN_FULLTEXT | + HA_BINLOG_FLAGS | + HA_CAN_BIT_FIELD | + HA_DUPLICATE_POS | + HA_CAN_GEOMETRY | + HA_CAN_RTREEKEYS; + //HA_HAS_RECORDS; +#ifdef HA_MUST_USE_TABLE_CONDITION_PUSHDOWN + flags |= HA_MUST_USE_TABLE_CONDITION_PUSHDOWN; +#endif +#ifdef HA_CAN_REPAIR + flags |= HA_CAN_REPAIR; +#endif +#ifdef HA_CAN_FULLTEXT_EXT + flags |= HA_CAN_FULLTEXT_EXT; +#endif + DBUG_RETURN(flags); +} + +ulonglong ha_mroonga::table_flags() const +{ + MRN_DBUG_ENTER_METHOD(); + + ulonglong flags; + if (!share && !analyzed_for_create && + ( + thd_sql_command(ha_thd()) == SQLCOM_CREATE_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX || + thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE + ) + ) { + create_share_for_create(); + } + if (analyzed_for_create && share_for_create.wrapper_mode) { + flags = wrapper_table_flags(); + } else if (wrap_handler && share && share->wrapper_mode) { + flags = wrapper_table_flags(); + } else { + flags = storage_table_flags(); + } + + DBUG_RETURN(flags); +} + +ulong ha_mroonga::wrapper_index_flags(uint idx, uint part, bool all_parts) const +{ + ulong index_flags; + KEY key = table_share->key_info[idx]; + MRN_DBUG_ENTER_METHOD(); + if (key.algorithm == HA_KEY_ALG_BTREE || key.algorithm == HA_KEY_ALG_UNDEF) { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + index_flags = wrap_handler->index_flags(idx, part, all_parts); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } else { + index_flags = HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR; + } + DBUG_RETURN(index_flags); +} + +ulong ha_mroonga::storage_index_flags(uint idx, uint part, bool all_parts) const +{ + MRN_DBUG_ENTER_METHOD(); + ulong flags; + KEY key = table_share->key_info[idx]; + if (key.algorithm == HA_KEY_ALG_BTREE || key.algorithm == HA_KEY_ALG_UNDEF) { + flags = HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE; + bool need_normalize_p = false; + Field *field = &key.key_part[part].field[0]; + if (field && should_normalize(field)) { + need_normalize_p = true; + } + if (!need_normalize_p) { + flags |= HA_KEYREAD_ONLY; + } + if (KEY_N_KEY_PARTS(&key) > 1 || !need_normalize_p) { + flags |= HA_READ_ORDER; + } + } else { + flags = HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR; + } + DBUG_RETURN(flags); +} + +ulong ha_mroonga::index_flags(uint idx, uint part, bool all_parts) const +{ + MRN_DBUG_ENTER_METHOD(); + + KEY key = table_share->key_info[idx]; + if (key.algorithm == HA_KEY_ALG_FULLTEXT) { + DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); + } + if (mrn_is_geo_key(&key)) { + DBUG_RETURN(HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR); + } + + int error = 0; + if (wrap_handler && share && share->wrapper_mode) + { + error = wrapper_index_flags(idx, part, all_parts); + } else { + error = storage_index_flags(idx, part, all_parts); + } + DBUG_RETURN(error); +} + +int ha_mroonga::create_share_for_create() const +{ + int error; + THD *thd = ha_thd(); + LEX *lex = thd->lex; + HA_CREATE_INFO *create_info = &lex->create_info; + TABLE_LIST *table_list = lex->select_lex.table_list.first; + MRN_DBUG_ENTER_METHOD(); + wrap_handler_for_create = NULL; + memset(&table_for_create, 0, sizeof(TABLE)); + memset(&share_for_create, 0, sizeof(MRN_SHARE)); + memset(&table_share_for_create, 0, sizeof(TABLE_SHARE)); + if (table_share) { + table_share_for_create.comment = table_share->comment; + table_share_for_create.connect_string = table_share->connect_string; + } else { +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + if (thd_sql_command(ha_thd()) != SQLCOM_CREATE_INDEX) { +#endif + table_share_for_create.comment = create_info->comment; + table_share_for_create.connect_string = create_info->connect_string; +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + } +#endif + if (thd_sql_command(ha_thd()) == SQLCOM_ALTER_TABLE || + thd_sql_command(ha_thd()) == SQLCOM_CREATE_INDEX) { + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); + if (slot_data && slot_data->alter_create_info) { + create_info = slot_data->alter_create_info; + if (slot_data->alter_connect_string) { + table_share_for_create.connect_string.str = + slot_data->alter_connect_string; + table_share_for_create.connect_string.length = + strlen(slot_data->alter_connect_string); + } else { + table_share_for_create.connect_string.str = NULL; + table_share_for_create.connect_string.length = 0; + } + if (slot_data->alter_comment) { + table_share_for_create.comment.str = + slot_data->alter_comment; + table_share_for_create.comment.length = + strlen(slot_data->alter_comment); + } else { + table_share_for_create.comment.str = NULL; + table_share_for_create.comment.length = 0; + } + } + } + } + init_alloc_root(&mem_root_for_create, 1024, 0, MYF(0)); + analyzed_for_create = true; + if (table_list) { + share_for_create.table_name = table_list->table_name; + share_for_create.table_name_length = table_list->table_name_length; + } + share_for_create.table_share = &table_share_for_create; + table_for_create.s = &table_share_for_create; +#ifdef WITH_PARTITION_STORAGE_ENGINE + table_for_create.part_info = NULL; +#endif + if ((error = mrn_parse_table_param(&share_for_create, &table_for_create))) + goto error; + + if (share_for_create.wrapper_mode) + { + wrap_handler_for_create = + share_for_create.hton->create(share_for_create.hton, NULL, + &mem_root_for_create); + if (!wrap_handler_for_create) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + wrap_handler_for_create->init(); + } + DBUG_RETURN(0); + +error: + if (share_for_create.wrapper_mode) { + plugin_unlock(NULL, share_for_create.plugin); + } + mrn_free_share_alloc(&share_for_create); + free_root(&mem_root_for_create, MYF(0)); + analyzed_for_create = false; + thd->clear_error(); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share) +{ + int error = 0; + handler *hnd; + MRN_DBUG_ENTER_METHOD(); + + if (table_share->primary_key == MAX_KEY) + { + my_message(ER_REQUIRES_PRIMARY_KEY, + MRN_GET_ERR_MSG(ER_REQUIRES_PRIMARY_KEY), MYF(0)); + DBUG_RETURN(ER_REQUIRES_PRIMARY_KEY); + } + + mrn::PathMapper mapper(name); + error = wrapper_create_index(name, table, info, tmp_share, + mapper.table_name()); + if (error) + DBUG_RETURN(error); + + wrap_key_info = mrn_create_key_info_for_table(tmp_share, table, &error); + if (error) + DBUG_RETURN(error); + base_key_info = table->key_info; + + share = tmp_share; + MRN_SET_WRAP_SHARE_KEY(tmp_share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (!(hnd = + tmp_share->hton->create(tmp_share->hton, table->s, + current_thd->mem_root))) + { + MRN_SET_BASE_SHARE_KEY(tmp_share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + share = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + hnd->init(); + error = hnd->ha_create(name, table, info); + MRN_SET_BASE_SHARE_KEY(tmp_share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + share = NULL; + delete hnd; + + if (error) { + wrapper_delete_index(name, tmp_share, mapper.table_name()); + } + + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_fulltext_validate(KEY *key_info) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + uint i; + for (i = 0; i < KEY_N_KEY_PARTS(key_info); i++) { + Field *field = key_info->key_part[i].field; + + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, true); + if (gtype != GRN_DB_SHORT_TEXT) + { + error = ER_CANT_CREATE_TABLE; + GRN_LOG(ctx, GRN_LOG_ERROR, + "key type must be text: <%d> " + "(TODO: We should show type name not type ID.)", + field->type()); + my_message(ER_CANT_CREATE_TABLE, + "key type must be text. (TODO: We should show type name.)", + MYF(0)); + DBUG_RETURN(error); + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_fulltext(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + error = wrapper_create_index_fulltext_validate(key_info); + if (error) { + DBUG_RETURN(error); + } + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj_flags index_table_flags = + GRN_OBJ_TABLE_PAT_KEY | + GRN_OBJ_PERSISTENT; + grn_obj *index_table; + + grn_obj_flags index_column_flags = + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_POSITION | GRN_OBJ_PERSISTENT; + if (KEY_N_KEY_PARTS(key_info) > 1) { + index_column_flags |= GRN_OBJ_WITH_SECTION; + } + + mrn::SmartGrnObj lexicon_key_type(ctx, GRN_DB_SHORT_TEXT); + error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); + if (error) { + DBUG_RETURN(error); + } + mrn::IndexTableName index_table_name(grn_table_name, key_info->name); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, + lexicon_key_type.get(), + 0); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + mrn_change_encoding(ctx, system_charset_info); + index_tables[i] = index_table; + + grn_obj *tokenizer = find_tokenizer(tmp_share->key_parser[i], + tmp_share->key_parser_length[i]); + if (tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, index_table, info_type, tokenizer); + grn_obj_unlink(ctx, tokenizer); + } + + { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters(key_info, &token_filters)) { + grn_obj_set_info(ctx, index_table, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + + if (should_normalize(&key_info->key_part->field[0])) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj *normalizer = find_normalizer(key_info); + if (normalizer) { + grn_obj_set_info(ctx, index_table, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + } + + grn_obj *index_column = grn_column_create(ctx, index_table, + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME), + NULL, + index_column_flags, + grn_table); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (index_columns) { + index_columns[i] = index_column; + } else { + grn_obj_unlink(ctx, index_column); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index_geo(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + mrn::IndexTableName index_table_name(grn_table_name, key_info->name); + + grn_obj_flags index_table_flags = + GRN_OBJ_TABLE_PAT_KEY | + GRN_OBJ_PERSISTENT; + grn_obj *index_table; + + grn_obj_flags index_column_flags = + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + + grn_obj *lexicon_key_type = grn_ctx_at(ctx, GRN_DB_WGS84_GEO_POINT); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, lexicon_key_type, 0); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + grn_obj_unlink(ctx, lexicon_key_type); + DBUG_RETURN(error); + } + grn_obj_unlink(ctx, lexicon_key_type); + index_tables[i] = index_table; + + grn_obj *index_column = grn_column_create(ctx, index_table, + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME), + NULL, + index_column_flags, + grn_table); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (index_columns) { + index_columns[i] = index_column; + } else { + grn_obj_unlink(ctx, index_column); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_create_index(const char *name, TABLE *table, + HA_CREATE_INFO *info, + MRN_SHARE *tmp_share, + const char *grn_table_name) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj *grn_index_table; + char *grn_table_path = NULL; // we don't specify path + grn_obj *pkey_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + grn_obj *pkey_value_type = NULL; // we don't use this + grn_obj_flags grn_table_flags = GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_HASH_KEY; + + grn_index_table = grn_table_create(ctx, grn_table_name, strlen(grn_table_name), + grn_table_path, grn_table_flags, + pkey_type, pkey_value_type); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (grn_table) { + grn_obj_unlink(ctx, grn_table); + } + grn_table = grn_index_table; + + uint i; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + if (!tmp_share->disable_keys) { + for (i = 0; i < n_keys; i++) { + index_tables[i] = NULL; + + KEY key_info = table->s->key_info[i]; + if (key_info.algorithm == HA_KEY_ALG_FULLTEXT) { + error = wrapper_create_index_fulltext(grn_table_name, + i, &key_info, + index_tables, NULL, tmp_share); + } else if (mrn_is_geo_key(&key_info)) { + error = wrapper_create_index_geo(grn_table_name, + i, &key_info, + index_tables, NULL, tmp_share); + } + } + } + + if (error) { + for (uint j = 0; j < i; j++) { + if (index_tables[j]) { + grn_obj_remove(ctx, index_tables[j]); + } + } + grn_obj_remove(ctx, grn_table); + grn_table = NULL; + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share) +{ + int error; + MRN_LONG_TERM_SHARE *long_term_share = tmp_share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + + if (info->auto_increment_value) { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = info->auto_increment_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + } + + error = storage_create_validate_pseudo_column(table); + if (error) + DBUG_RETURN(error); + + error = storage_create_validate_index(table); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_obj_flags table_flags = GRN_OBJ_PERSISTENT; + + /* primary key must be handled before creating table */ + grn_obj *pkey_type; + uint pkey_nr = table->s->primary_key; + if (pkey_nr != MAX_INDEXES) { + KEY key_info = table->s->key_info[pkey_nr]; + bool is_id; + + int key_parts = KEY_N_KEY_PARTS(&key_info); + if (key_parts == 1) { + Field *pkey_field = key_info.key_part[0].field; + const char *column_name = pkey_field->field_name; + is_id = (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0); + + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, pkey_field, false); + pkey_type = grn_ctx_at(ctx, gtype); + } else { + is_id = false; + pkey_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + } + + // default algorithm is BTREE ==> PAT + if (!is_id && key_info.algorithm == HA_KEY_ALG_HASH) { + table_flags |= GRN_OBJ_TABLE_HASH_KEY; + } else if (!is_id) { + table_flags |= GRN_OBJ_TABLE_PAT_KEY; + } else { + // for _id + table_flags |= GRN_OBJ_TABLE_NO_KEY; + pkey_type = NULL; + } + + } else { + // primary key doesn't exists + table_flags |= GRN_OBJ_TABLE_NO_KEY; + pkey_type = NULL; + } + + /* create table */ + grn_obj *table_obj; + mrn::PathMapper mapper(name); + + char *table_path = NULL; // we don't specify path + grn_obj *pkey_value_type = NULL; // we don't use this + + table_obj = grn_table_create(ctx, + mapper.table_name(), strlen(mapper.table_name()), + table_path, + table_flags, pkey_type, pkey_value_type); + if (ctx->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + if (table_flags == (GRN_OBJ_PERSISTENT | GRN_OBJ_TABLE_PAT_KEY)) { + KEY key_info = table->s->key_info[pkey_nr]; + int key_parts = KEY_N_KEY_PARTS(&key_info); + if (key_parts == 1) { + grn_obj *normalizer = NULL; + if (tmp_share->normalizer) { + normalizer = grn_ctx_get(ctx, + tmp_share->normalizer, + tmp_share->normalizer_length); + } else { + Field *field = &(key_info.key_part->field[0]); + if (should_normalize(field)) { + normalizer = find_normalizer(&key_info); + } + } + if (normalizer) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj_set_info(ctx, table_obj, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + if (tmp_share->default_tokenizer) { + grn_obj *default_tokenizer = + grn_ctx_get(ctx, + tmp_share->default_tokenizer, + tmp_share->default_tokenizer_length); + if (default_tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, table_obj, info_type, default_tokenizer); + grn_obj_unlink(ctx, default_tokenizer); + } + } + if (tmp_share->token_filters) { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters_fill(&token_filters, + tmp_share->token_filters, + tmp_share->token_filters_length)) { + grn_obj_set_info(ctx, table_obj, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + } + } + + /* create columns */ + uint n_columns = table->s->fields; + for (uint i = 0; i < n_columns; i++) { + grn_obj *col_type; + Field *field = table->s->field[i]; + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + +#ifdef MRN_SUPPORT_FOREIGN_KEYS + if (storage_create_foreign_key(table, mapper.table_name(), field, table_obj, + error)) { + continue; + } + if (error) { + grn_obj_remove(ctx, table_obj); + DBUG_RETURN(error); + } +#endif + + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + if (tmp_share->col_flags[i]) { + // TODO: parse flags + if (strcmp(tmp_share->col_flags[i], "COLUMN_VECTOR") == 0) { + col_flags |= GRN_OBJ_COLUMN_VECTOR; + } else { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + } else { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, false); + if (tmp_share->col_type[i]) { + col_type = grn_ctx_get(ctx, tmp_share->col_type[i], -1); + } else { + col_type = grn_ctx_at(ctx, gtype); + } + char *col_path = NULL; // we don't specify path + + grn_column_create(ctx, table_obj, column_name, column_name_size, + col_path, col_flags, col_type); + if (ctx->rc) { + grn_obj_remove(ctx, table_obj); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + + error = storage_create_indexes(table, mapper.table_name(), table_obj, + tmp_share); + if (error) { + grn_obj_remove(ctx, table_obj); + table_obj = NULL; + } + + if (table_obj) { + grn_obj_unlink(ctx, table_obj); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_validate_pseudo_column(TABLE *table) +{ + int error = 0; + uint i, n_columns; + + MRN_DBUG_ENTER_METHOD(); + n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->s->field[i]; + const char *column_name = field->field_name; + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + switch (field->type()) { + case MYSQL_TYPE_TINY : + case MYSQL_TYPE_SHORT : + case MYSQL_TYPE_INT24 : + case MYSQL_TYPE_LONG : + case MYSQL_TYPE_LONGLONG : + break; + default: + GRN_LOG(ctx, GRN_LOG_ERROR, "_id must be numeric data type"); + error = ER_CANT_CREATE_TABLE; + my_message(error, "_id must be numeric data type", MYF(0)); + DBUG_RETURN(error); + } + } + } + + DBUG_RETURN(error); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +bool ha_mroonga::storage_create_foreign_key(TABLE *table, + const char *grn_table_name, + Field *field, + grn_obj *table_obj, int &error) +{ + MRN_DBUG_ENTER_METHOD(); + LEX *lex = ha_thd()->lex; + Alter_info *alter_info = &lex->alter_info; + List_iterator key_iterator(alter_info->key_list); + Key *key; + char ref_db_buff[NAME_LEN + 1], ref_table_buff[NAME_LEN + 1]; + while ((key = key_iterator++)) + { + if (key->type != Key::FOREIGN_KEY) + { + continue; + } + if (key->columns.elements > 1) + { + error = ER_CANT_CREATE_TABLE; + my_message(error, "mroonga can't use FOREIGN_KEY with multiple columns", + MYF(0)); + DBUG_RETURN(false); + } + List_iterator key_part_col_iterator(key->columns); + Key_part_spec *key_part_col = key_part_col_iterator++; + LEX_STRING field_name = key_part_col->field_name; + DBUG_PRINT("info", ("mroonga: field_name=%s", field_name.str)); + DBUG_PRINT("info", ("mroonga: field->field_name=%s", field->field_name)); + if (strcmp(field->field_name, field_name.str)) + { + continue; + } + Foreign_key *fk = (Foreign_key *) key; + List_iterator key_part_ref_col_iterator(fk->ref_columns); + Key_part_spec *key_part_ref_col = key_part_ref_col_iterator++; + LEX_STRING ref_field_name = key_part_ref_col->field_name; + DBUG_PRINT("info", ("mroonga: ref_field_name=%s", ref_field_name.str)); + LEX_STRING ref_db_name = fk->ref_db; + DBUG_PRINT("info", ("mroonga: ref_db_name=%s", ref_db_name.str)); + if (ref_db_name.str && lower_case_table_names) { + strmake(ref_db_buff, ref_db_name.str, sizeof(ref_db_buff) - 1); + my_casedn_str(system_charset_info, ref_db_buff); + ref_db_name.str = ref_db_buff; + DBUG_PRINT("info", ("mroonga: casedn ref_db_name=%s", ref_db_name.str)); + } + LEX_STRING ref_table_name = fk->ref_table; + DBUG_PRINT("info", ("mroonga: ref_table_name=%s", ref_table_name.str)); + if (ref_table_name.str && lower_case_table_names) { + strmake(ref_table_buff, ref_table_name.str, sizeof(ref_table_buff) - 1); + my_casedn_str(system_charset_info, ref_table_buff); + ref_table_name.str = ref_table_buff; + DBUG_PRINT("info", ("mroonga: casedn ref_table_name=%s", ref_table_name.str)); + } + if (ref_db_name.str && strcmp(table->s->db.str, ref_db_name.str)) + { + error = ER_CANT_CREATE_TABLE; + my_message(error, + "mroonga can't use FOREIGN_KEY during different database tables", + MYF(0)); + DBUG_RETURN(false); + } + + grn_obj *column, *column_ref = NULL, *grn_table_ref = NULL; + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table->s->db.str, ref_table_name.str, "", 0); + + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(false); + mrn::PathMapper mapper(ref_path); + grn_table_ref = grn_ctx_get(ctx, mapper.table_name(), + strlen(mapper.table_name())); + if (!grn_table_ref) { + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "refference table [%s.%s] is not mroonga table", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(mapper.db_name(), + strlen(mapper.db_name()), + mapper.mysql_table_name(), + strlen(mapper.mysql_table_name()), + mapper.mysql_table_name(), TL_WRITE); +#else + table_list.init_one_table(mapper.db_name(), + mapper.mysql_table_name(), + TL_WRITE); +#endif + mrn_open_mutex_lock(table->s); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table->s); + if (!tmp_ref_table_share) { + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "refference table [%s.%s] is not found", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + if (ref_pkey_nr == MAX_KEY) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, "refference table [%s.%s] has no primary key", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + uint ref_key_parts = KEY_N_KEY_PARTS(ref_key_info); + if (ref_key_parts > 1) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, + "refference table [%s.%s] primary key is multiple column", + table->s->db.str, ref_table_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + Field *ref_field = &ref_key_info->key_part->field[0]; + if (strcmp(ref_field->field_name, ref_field_name.str)) { + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + char err_msg[MRN_BUFFER_SIZE]; + sprintf(err_msg, + "refference column [%s.%s.%s] is not used for primary key", + table->s->db.str, ref_table_name.str, ref_field_name.str); + my_message(error, err_msg, MYF(0)); + DBUG_RETURN(false); + } + mrn_open_mutex_lock(table->s); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table->s); + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + column = grn_column_create(ctx, table_obj, field->field_name, + strlen(field->field_name), + NULL, col_flags, grn_table_ref); + if (ctx->rc) { + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(false); + } + + mrn::IndexColumnName index_column_name(grn_table_name, field->field_name); + grn_obj_flags ref_col_flags = GRN_OBJ_COLUMN_INDEX | GRN_OBJ_PERSISTENT; + column_ref = grn_column_create(ctx, grn_table_ref, + index_column_name.c_str(), + index_column_name.length(), + NULL, ref_col_flags, table_obj); + if (ctx->rc) { + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(false); + } + + grn_obj source_ids; + grn_id source_id = grn_obj_id(ctx, column); + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + if (error) { + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column_ref); + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + DBUG_RETURN(false); + } + grn_obj_set_info(ctx, column_ref, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column_ref); + grn_obj_unlink(ctx, column); + grn_obj_unlink(ctx, grn_table_ref); + error = 0; + DBUG_RETURN(true); + } + error = 0; + DBUG_RETURN(false); +} +#endif + +int ha_mroonga::storage_create_validate_index(TABLE *table) +{ + int error = 0; + uint i; + + MRN_DBUG_ENTER_METHOD(); + /* checking if index is used for virtual columns */ + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->s->key_info[i]; + // must be single column key + int key_parts = KEY_N_KEY_PARTS(&key_info); + if (key_parts != 1) { + continue; + } + Field *field = key_info.key_part[0].field; + const char *column_name = field->field_name; + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + if (key_info.algorithm == HA_KEY_ALG_HASH) { + continue; // hash index is ok + } + GRN_LOG(ctx, GRN_LOG_ERROR, "only hash index can be defined for _id"); + error = ER_CANT_CREATE_TABLE; + my_message(error, "only hash index can be defined for _id", MYF(0)); + DBUG_RETURN(error); + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_index_table(TABLE *table, + const char *grn_table_name, + grn_obj *grn_table, + MRN_SHARE *tmp_share, + KEY *key_info, + grn_obj **index_tables, + uint i) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj *index_type; + grn_obj *index_table; + grn_obj_flags index_table_flags = GRN_OBJ_PERSISTENT; + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + + if (tmp_share->index_table && tmp_share->index_table[i]) { + index_table = grn_ctx_get(ctx, + tmp_share->index_table[i], + tmp_share->index_table_length[i]); + // TODO: add error check + index_tables[i] = index_table; + DBUG_RETURN(error); + } + + if (is_multiple_column_index) { + index_type = grn_ctx_at(ctx, GRN_DB_SHORT_TEXT); + } else { + Field *field = key_info->key_part[0].field; + grn_builtin_type groonga_type = mrn_grn_type_from_field(ctx, field, true); + index_type = grn_ctx_at(ctx, groonga_type); + } + // TODO: Add NULL check for index_type + + int key_alg = key_info->algorithm; + if (key_info->flags & HA_FULLTEXT) { + index_table_flags |= GRN_OBJ_TABLE_PAT_KEY; + error = mrn_change_encoding(ctx, key_info->key_part->field->charset()); + if (error) { + grn_obj_remove(ctx, grn_table); + DBUG_RETURN(error); + } + } else if (key_alg == HA_KEY_ALG_HASH) { + index_table_flags |= GRN_OBJ_TABLE_HASH_KEY; + } else { + index_table_flags |= GRN_OBJ_TABLE_PAT_KEY; + } + + { + mrn::IndexTableName index_table_name(grn_table_name, key_info->name); + index_table = grn_table_create(ctx, + index_table_name.c_str(), + index_table_name.length(), + NULL, + index_table_flags, + index_type, + NULL); + } + if (ctx->rc) { + grn_obj_unlink(ctx, index_type); + grn_obj_remove(ctx, grn_table); + error = ER_CANT_CREATE_TABLE; + my_message(ER_CANT_CREATE_TABLE, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + if (key_info->flags & HA_FULLTEXT) { + grn_obj *tokenizer = find_tokenizer(tmp_share->key_parser[i], + tmp_share->key_parser_length[i]); + if (tokenizer) { + grn_info_type info_type = GRN_INFO_DEFAULT_TOKENIZER; + grn_obj_set_info(ctx, index_table, info_type, tokenizer); + grn_obj_unlink(ctx, tokenizer); + } + + { + grn_obj token_filters; + GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, 0); + if (find_token_filters(key_info, &token_filters)) { + grn_obj_set_info(ctx, index_table, + GRN_INFO_TOKEN_FILTERS, &token_filters); + } + grn_obj_unlink(ctx, &token_filters); + } + } + + { + grn_obj *normalizer = NULL; + Field *field = &(key_info->key_part->field[0]); + if (key_info->flags & HA_FULLTEXT) { + if (should_normalize(field)) { + normalizer = find_normalizer(key_info); + } + } else if (key_alg != HA_KEY_ALG_HASH) { + if (!is_multiple_column_index && should_normalize(field)) { + normalizer = find_normalizer(key_info); + } + } + if (normalizer) { + grn_info_type info_type = GRN_INFO_NORMALIZER; + grn_obj_set_info(ctx, index_table, info_type, normalizer); + grn_obj_unlink(ctx, normalizer); + } + } + + index_tables[i] = index_table; + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_index(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + grn_obj **index_columns, uint i) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj *index_table, *index_column; + const char *column_name = NULL; + int column_name_size = 0; + + bool is_multiple_column_index = KEY_N_KEY_PARTS(key_info) > 1; + if (!is_multiple_column_index) { + Field *field = key_info->key_part[0].field; + column_name = field->field_name; + column_name_size = strlen(column_name); + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + // skipping _id virtual column + DBUG_RETURN(0); + } + } + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = storage_create_index_table(table, grn_table_name, + grn_table, tmp_share, + key_info, index_tables, i); + if (error) + DBUG_RETURN(error); + + grn_obj_flags index_column_flags = + GRN_OBJ_COLUMN_INDEX | GRN_OBJ_WITH_POSITION | GRN_OBJ_PERSISTENT; + if (is_multiple_column_index) { + index_column_flags |= GRN_OBJ_WITH_SECTION; + } + + index_table = index_tables[i]; + const char *index_column_name; + if (tmp_share->index_table && tmp_share->index_table[i]) { + index_column_name = key_info->name; + } else { + index_column_name = INDEX_COLUMN_NAME; + } + index_column = grn_column_create(ctx, + index_table, + index_column_name, + strlen(index_column_name), + NULL, + index_column_flags, + grn_table); + + if (ctx->rc) { + grn_obj_remove(ctx, index_table); + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, system_charset_info); + if (is_multiple_column_index) { + if (key_info->flags & HA_FULLTEXT) { + grn_obj source_ids; + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + + int j, n_key_parts = KEY_N_KEY_PARTS(key_info); + for (j = 0; j < n_key_parts; j++) { + Field *field = key_info->key_part[j].field; + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + grn_obj *source_column = grn_obj_column(ctx, grn_table, + column_name, column_name_size); + grn_id source_id = grn_obj_id(ctx, source_column); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + grn_obj_unlink(ctx, source_column); + } + mrn_change_encoding(ctx, key_info->key_part->field->charset()); + grn_obj_set_info(ctx, index_column, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + } + } else { + grn_obj *column; + column = grn_obj_column(ctx, grn_table, column_name, column_name_size); + if (column) { + grn_obj source_ids; + grn_id source_id = grn_obj_id(ctx, column); + GRN_UINT32_INIT(&source_ids, GRN_OBJ_VECTOR); + GRN_UINT32_PUT(ctx, &source_ids, source_id); + mrn_change_encoding(ctx, key_info->key_part->field->charset()); + grn_obj_set_info(ctx, index_column, GRN_INFO_SOURCE, &source_ids); + grn_obj_unlink(ctx, &source_ids); + grn_obj_unlink(ctx, column); + } + } + mrn_change_encoding(ctx, system_charset_info); + + if (index_columns) { + index_columns[i] = index_column; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_create_indexes(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + uint n_keys = table->s->keys; + uint i; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + for (i = 0; i < n_keys; i++) { + index_tables[i] = NULL; + if (i == table->s->primary_key) { + continue; // pkey is already handled + } + KEY *key_info = &table->s->key_info[i]; + if (tmp_share->disable_keys && !(key_info->flags & HA_NOSAME)) { + continue; // key is disabled + } + if ((error = storage_create_index(table, grn_table_name, grn_table, + tmp_share, key_info, + index_tables, NULL, i))) { + break; + } + } + if (error) { + while (true) { + if (index_tables[i]) { + grn_obj_remove(ctx, index_tables[i]); + } + if (!i) + break; + i--; + } + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + DBUG_RETURN(error); +} + +int ha_mroonga::ensure_database_open(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + grn_obj *db; + error = mrn_db_manager->open(name, &db); + if (error) + DBUG_RETURN(error); + + grn_ctx_use(ctx, db); + + DBUG_RETURN(error); +} + +int ha_mroonga::ensure_database_remove(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + mrn_db_manager->close(name); + + mrn::PathMapper mapper(name); + remove_related_files(mapper.db_path()); + + DBUG_RETURN(error); +} + + +int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info) +{ + int error = 0; + MRN_SHARE *tmp_share; + MRN_DBUG_ENTER_METHOD(); + /* checking data type of virtual columns */ + + if (!(tmp_share = mrn_get_share(name, table, &error))) + DBUG_RETURN(error); + + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), false); + if (slot_data && slot_data->disable_keys_create_info == info) { + tmp_share->disable_keys = true; + } + + if (tmp_share->wrapper_mode) + { + error = wrapper_create(name, table, info, tmp_share); + } else { + error = storage_create(name, table, info, tmp_share); + } + + if (error) { + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + } + mrn_free_share(tmp_share); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + if (thd_sql_command(ha_thd()) == SQLCOM_REPAIR) { + error = ensure_database_remove(name); + if (error) + DBUG_RETURN(error); + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + grn_table = NULL; + grn_index_tables = NULL; + grn_index_columns = NULL; + } else { + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = open_table(name); + if (error) + DBUG_RETURN(error); + + error = wrapper_open_indexes(name); + if (error) { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + } + + init_alloc_root(&mem_root, 1024, 0, MYF(0)); + wrap_key_info = mrn_create_key_info_for_table(share, table, &error); + if (error) + DBUG_RETURN(error); + base_key_info = table->key_info; + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (!is_clone) + { + if (!(wrap_handler = + share->hton->create(share->hton, table->s, &mem_root))) + { + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + wrap_handler->init(); +#ifdef MRN_HANDLER_HAVE_SET_HA_SHARE_REF + wrap_handler->set_ha_share_ref(&table->s->ha_share); +#endif + error = wrap_handler->ha_open(table, name, mode, test_if_locked); + } else { +#ifdef MRN_HANDLER_CLONE_NEED_NAME + if (!(wrap_handler = parent_for_clone->wrap_handler->clone(name, + mem_root_for_clone))) +#else + if (!(wrap_handler = parent_for_clone->wrap_handler->clone( + mem_root_for_clone))) +#endif + { + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + ref_length = wrap_handler->ref_length; + key_used_on_scan = wrap_handler->key_used_on_scan; + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + init(); + wrapper_overwrite_index_bits(); + wrapper_set_keys_in_use(); + + pk_keypart_map = make_prev_keypart_map( + KEY_N_KEY_PARTS(&(table->key_info[table_share->primary_key]))); + + if (error) + { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + // TODO: free indexes. + + delete wrap_handler; + wrap_handler = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_open_indexes(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + uint n_keys = table->s->keys; + uint n_primary_keys = table->s->primary_key; + if (n_keys > 0) { + // TODO: reduce allocate memories. We only need just + // for HA_KEY_ALG_FULLTEXT keys. + grn_index_tables = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + grn_index_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + } else { + grn_index_tables = grn_index_columns = NULL; + } + + mrn::PathMapper mapper(name); + uint i = 0; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->s->key_info[i]; + + grn_index_tables[i] = NULL; + grn_index_columns[i] = NULL; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + if (i == n_primary_keys) { + continue; + } + + mrn::IndexTableName index_table_name(mapper.table_name(), key_info.name); + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (ctx->rc) { + DBUG_PRINT("info", + ("mroonga: sql_command=%u", thd_sql_command(ha_thd()))); + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + + grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + if (!grn_index_columns[i]) { + /* just for backward compatibility before 1.0. */ + Field *field = key_info.key_part[0].field; + grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], + field->field_name, + strlen(field->field_name)); + } + + if (ctx->rc) { + DBUG_PRINT("info", + ("mroonga: sql_command=%u", thd_sql_command(ha_thd()))); + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + grn_obj_unlink(ctx, grn_index_tables[i]); + goto error; + } + } + + grn_bulk_space(ctx, &key_buffer, table->key_info->key_length); + +error: + if (error) { + while (i-- > 0) { + grn_obj *index_column = grn_index_columns[i]; + if (index_column) { + grn_obj_unlink(ctx, index_column); + } + grn_obj *index_table = grn_index_tables[i]; + if (index_table) { + grn_obj_unlink(ctx, index_table); + } + } + free(grn_index_columns); + free(grn_index_tables); + grn_index_columns = NULL; + grn_index_tables = NULL; + } + + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_overwrite_index_bits() +{ + uint i, j; + longlong table_option = table_flags(); + MRN_DBUG_ENTER_METHOD(); + table_share->keys_for_keyread.clear_all(); + for (i = 0; i < table_share->fields; i++) + { + Field *field = table_share->field[i]; + field->part_of_key.clear_all(); + field->part_of_key_not_clustered.clear_all(); + field->part_of_sortkey.clear_all(); + } + for (i = 0; i < table_share->keys; i++) { + KEY *key_info = &table->s->key_info[i]; + KEY_PART_INFO *key_part = key_info->key_part; + for (j = 0 ; j < KEY_N_KEY_PARTS(key_info); key_part++, j++) + { + Field *field = key_part->field; + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + { + if (index_flags(i, j, 0) & HA_KEYREAD_ONLY) + { + table_share->keys_for_keyread.set_bit(i); + field->part_of_key.set_bit(i); + field->part_of_key_not_clustered.set_bit(i); + } + if (index_flags(i, j, 1) & HA_READ_ORDER) + field->part_of_sortkey.set_bit(i); + } + if (i == table_share->primary_key && + (table_option & HA_PRIMARY_KEY_IN_READ_INDEX)) + { + if (field->key_length() == key_part->length && + !(field->flags & BLOB_FLAG)) + field->part_of_key = table_share->keys_in_use; + if (field->part_of_sortkey.is_set(i)) + field->part_of_sortkey = table_share->keys_in_use; + } + } + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::storage_open(const char *name, int mode, uint test_if_locked) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = open_table(name); + if (error) + DBUG_RETURN(error); + + error = storage_open_columns(); + if (error) { + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + + error = storage_open_indexes(name); + if (error) { + // TODO: free grn_columns and set NULL; + grn_obj_unlink(ctx, grn_table); + grn_table = NULL; + DBUG_RETURN(error); + } + + storage_set_keys_in_use(); + + ref_length = sizeof(grn_id); + DBUG_RETURN(0); +} + +void ha_mroonga::update_grn_table_is_referenced() +{ + MRN_DBUG_ENTER_METHOD(); + + grn_table_is_referenced = false; + + grn_table_cursor *cursor; + int flags = GRN_CURSOR_BY_ID | GRN_CURSOR_ASCENDING;; + cursor = grn_table_cursor_open(ctx, grn_ctx_db(ctx), + NULL, 0, + NULL, 0, + 0, -1, flags); + if (cursor) { + grn_id id; + grn_id grn_table_id; + + grn_table_id = grn_obj_id(ctx, grn_table); + while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) { + grn_obj *object; + grn_id range = GRN_ID_NIL; + + object = grn_ctx_at(ctx, id); + if (!object) { + ctx->rc = GRN_SUCCESS; + continue; + } + + switch (object->header.type) { + case GRN_COLUMN_FIX_SIZE: + case GRN_COLUMN_VAR_SIZE: + range = grn_obj_get_range(ctx, object); + break; + default: + break; + } + grn_obj_unlink(ctx, object); + + if (range == grn_table_id) { + grn_table_is_referenced = true; + break; + } + } + + grn_table_cursor_close(ctx, cursor); + } + + DBUG_VOID_RETURN; +} + +int ha_mroonga::open_table(const char *name) +{ + int error; + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + mrn::PathMapper mapper(name); + grn_table = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (!grn_table) { + error = ER_CANT_OPEN_FILE; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "mroonga: failed to open table: <%s>", + mapper.table_name()); + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + + update_grn_table_is_referenced(); + + DBUG_RETURN(0); +} + +int ha_mroonga::storage_open_columns(void) +{ + int error; + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + int n_columns = table->s->fields; + grn_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_columns); + grn_column_ranges = (grn_obj **)malloc(sizeof(grn_obj *) * n_columns); + if (table_share->blob_fields) + { + if (blob_buffers) + { + delete [] blob_buffers; + } + if (!(blob_buffers = new String[n_columns])) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + } + + int i; + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + if (table_share->blob_fields) + { + blob_buffers[i].set_charset(field->charset()); + } + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + grn_columns[i] = NULL; + grn_column_ranges[i] = NULL; + continue; + } + + grn_columns[i] = grn_obj_column(ctx, grn_table, + column_name, column_name_size); + grn_id range_id = grn_obj_get_range(ctx, grn_columns[i]); + grn_column_ranges[i] = grn_ctx_at(ctx, range_id); + if (ctx->rc) { + // TODO: free grn_columns and set NULL; + int error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + + DBUG_RETURN(0); +} + +int ha_mroonga::storage_open_indexes(const char *name) +{ + int error; + + MRN_DBUG_ENTER_METHOD(); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + uint n_keys = table->s->keys; + uint pkey_nr = table->s->primary_key; + if (n_keys > 0) { + grn_index_tables = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + grn_index_columns = (grn_obj **)malloc(sizeof(grn_obj *) * n_keys); + key_id = (grn_id *)malloc(sizeof(grn_id) * n_keys); + del_key_id = (grn_id *)malloc(sizeof(grn_id) * n_keys); + } else { + grn_index_tables = grn_index_columns = NULL; + key_id = NULL; + del_key_id = NULL; + } + + mrn::PathMapper mapper(name); + uint i, j; + for (i = 0; i < n_keys; i++) { + if (i == pkey_nr) { + grn_index_tables[i] = grn_index_columns[i] = NULL; + continue; + } + + KEY key_info = table->s->key_info[i]; + if (KEY_N_KEY_PARTS(&key_info) > 1) { + KEY_PART_INFO *key_part = key_info.key_part; + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + bitmap_set_bit(&multiple_column_key_bitmap, + key_part[j].field->field_index); + } + } + + MRN_SHARE *tmp_share; + tmp_share = mrn_get_share(name, table, &error); + if (tmp_share->index_table[i]) { + grn_index_tables[i] = grn_ctx_get(ctx, + tmp_share->index_table[i], + tmp_share->index_table_length[i]); + if (ctx->rc == GRN_SUCCESS) { + grn_index_columns[i] = grn_obj_column(ctx, + grn_index_tables[i], + key_info.name, + strlen(key_info.name)); + } + } else { + mrn::IndexTableName index_table_name(mapper.table_name(), key_info.name); + grn_index_tables[i] = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (ctx->rc == GRN_SUCCESS) { + grn_index_columns[i] = grn_obj_column(ctx, + grn_index_tables[i], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + if (!grn_index_columns[i]) { + /* just for backward compatibility before 1.0. */ + Field *field = key_info.key_part[0].field; + grn_index_columns[i] = grn_obj_column(ctx, grn_index_tables[i], + field->field_name, + strlen(field->field_name)); + } + } + } + mrn_free_share(tmp_share); + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error; + } + } + +error: + if (error) { + if (i) { + while (true) { + grn_obj *index_column = grn_index_columns[i]; + if (index_column) { + grn_obj_unlink(ctx, index_column); + } + grn_obj *index_table = grn_index_tables[i]; + if (index_table) { + grn_obj_unlink(ctx, index_table); + } + if (!i) + break; + i--; + } + } + free(key_id); + free(del_key_id); + free(grn_index_columns); + free(grn_index_tables); + key_id = NULL; + del_key_id = NULL; + grn_index_columns = NULL; + grn_index_tables = NULL; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::open(const char *name, int mode, uint test_if_locked) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + if (!(share = mrn_get_share(name, table, &error))) + DBUG_RETURN(error); + thr_lock_data_init(&share->lock,&thr_lock_data,NULL); + + if (bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields, false)) + { + mrn_free_share(share); + share = NULL; + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + + if (share->wrapper_mode) + { + error = wrapper_open(name, mode, test_if_locked); + } else { + error = storage_open(name, mode, test_if_locked); + } + + if (error) + { + bitmap_free(&multiple_column_key_bitmap); + mrn_free_share(share); + share = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_close() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_HA_CLOSE + error = wrap_handler->ha_close(); +#else + error = wrap_handler->close(); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + delete wrap_handler; + wrap_handler = NULL; + if (wrap_key_info) + { + my_free(wrap_key_info, MYF(0)); + wrap_key_info = NULL; + } + base_key_info = NULL; + free_root(&mem_root, MYF(0)); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_close() +{ + MRN_DBUG_ENTER_METHOD(); + grn_obj_unlink(ctx, grn_table); + // TODO: unlink elements + free(grn_columns); + // TODO: unlink elements + free(grn_column_ranges); + DBUG_RETURN(0); +} + +int ha_mroonga::close() +{ + int error = 0; + THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + + clear_indexes(); + + if (share->wrapper_mode) + { + error = wrapper_close(); + } else { + error = storage_close(); + } + + if (is_temporary_table_name(share->table_name)) { + TABLE_LIST table_list; + TABLE_SHARE *tmp_table_share; + int tmp_error; + /* no need to decode */ + mrn::PathMapper mapper(share->table_name); +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(mapper.db_name(), strlen(mapper.db_name()), + mapper.mysql_table_name(), + strlen(mapper.mysql_table_name()), + mapper.mysql_table_name(), + TL_WRITE); +#else + table_list.init_one_table(mapper.db_name(), mapper.mysql_table_name(), + TL_WRITE); +#endif + mrn_open_mutex_lock(NULL); + tmp_table_share = + mrn_create_tmp_table_share(&table_list, share->table_name, &tmp_error); + mrn_open_mutex_unlock(NULL); + if (!tmp_table_share) { + error = tmp_error; + } else if ((tmp_error = alter_share_add(share->table_name, + tmp_table_share))) { + error = tmp_error; + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + } + } + bitmap_free(&multiple_column_key_bitmap); + mrn_free_share(share); + share = NULL; + is_clone = false; + if ( + thd && + thd_sql_command(thd) == SQLCOM_FLUSH + ) { + /* flush tables */ + mrn::Lock lock(&mrn_open_tables_mutex); + if (!mrn_open_tables.records) + { + int tmp_error = mrn_db_manager->clear(); + if (tmp_error) + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_table(const char *name, MRN_SHARE *tmp_share, + const char *table_name) +{ + int error = 0; + handler *hnd; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(tmp_share, tmp_share->table_share); + if (!(hnd = + tmp_share->hton->create(tmp_share->hton, tmp_share->table_share, + current_thd->mem_root))) + { + MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + hnd->init(); + MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share); + + if ((error = hnd->ha_delete_table(name))) + { + delete hnd; + DBUG_RETURN(error); + } + + error = wrapper_delete_index(name, tmp_share, table_name); + + delete hnd; + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_index(const char *name, MRN_SHARE *tmp_share, + const char *table_name) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + error = drop_index(tmp_share, i); + if (error) { + DBUG_RETURN(error); + } + } + + grn_obj *table = grn_ctx_get(ctx, table_name, strlen(table_name)); + if (!ctx->rc) { + grn_obj_remove(ctx, table); + } + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_table(const char *name, MRN_SHARE *tmp_share, + const char *table_name) +{ + int error = 0; + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + MRN_DBUG_ENTER_METHOD(); + + error = ensure_database_open(name); + if (error) + DBUG_RETURN(error); + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + error = drop_index(tmp_share, i); + if (error) { + DBUG_RETURN(error); + } + } + + grn_obj *table_obj = grn_ctx_get(ctx, table_name, strlen(table_name)); + if (!ctx->rc) { + grn_obj_remove(ctx, table_obj); + } + if (ctx->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + DBUG_RETURN(error); +} + +int ha_mroonga::delete_table(const char *name) +{ + int error = 0; + THD *thd = ha_thd(); + TABLE_LIST table_list; + TABLE_SHARE *tmp_table_share = NULL; + TABLE tmp_table; + MRN_SHARE *tmp_share; + st_mrn_alter_share *alter_share, *tmp_alter_share; + MRN_DBUG_ENTER_METHOD(); + mrn::PathMapper mapper(name); + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, false); + if (slot_data && slot_data->first_alter_share) + { + tmp_alter_share = NULL; + alter_share = slot_data->first_alter_share; + while (alter_share) + { + if (!strcmp(alter_share->path, name)) + { + /* found */ + tmp_table_share = alter_share->alter_share; + if (tmp_alter_share) + tmp_alter_share->next = alter_share->next; + else + slot_data->first_alter_share = alter_share->next; + free(alter_share); + break; + } + tmp_alter_share = alter_share; + alter_share = alter_share->next; + } + } + if (!tmp_table_share) + { + mrn::PathMapper mapper(name); +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(mapper.db_name(), strlen(mapper.db_name()), + mapper.mysql_table_name(), + strlen(mapper.mysql_table_name()), + mapper.mysql_table_name(), + TL_WRITE); +#else + table_list.init_one_table(mapper.db_name(), mapper.mysql_table_name(), + TL_WRITE); +#endif + mrn_open_mutex_lock(NULL); + tmp_table_share = mrn_create_tmp_table_share(&table_list, name, &error); + mrn_open_mutex_unlock(NULL); + if (!tmp_table_share) { + DBUG_RETURN(error); + } + } + tmp_table.s = tmp_table_share; +#ifdef WITH_PARTITION_STORAGE_ENGINE + tmp_table.part_info = NULL; +#endif + if (!(tmp_share = mrn_get_share(name, &tmp_table, &error))) + { + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + DBUG_RETURN(error); + } + + if (tmp_share->wrapper_mode) + { + error = wrapper_delete_table(name, tmp_share, mapper.table_name()); + } else { + error = storage_delete_table(name, tmp_share, mapper.table_name()); + } + + if (!error) { + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + } + mrn_free_share(tmp_share); + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + if (is_temporary_table_name(name)) { + mrn_db_manager->drop(name); + } + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_set_keys_in_use() +{ + uint i, j; + MRN_DBUG_ENTER_METHOD(); + mrn::AutoIncrementValueLock lock_(table_share); + table_share->keys_in_use.set_prefix(table_share->keys); + share->disable_keys = false; + for (i = 0; i < table_share->keys; i++) { + j = share->wrap_key_nr[i]; + if (j < MAX_KEY) { + if (!share->wrap_table_share->keys_in_use.is_set(j)) { + /* copy bitmap */ + table_share->keys_in_use.clear_bit(i); + share->disable_keys = true; + } + } else { + if (!grn_index_tables || !grn_index_tables[i]) { + /* disabled */ + table_share->keys_in_use.clear_bit(i); + share->disable_keys = true; + } + } + } + table_share->keys_for_keyread.set_prefix(table_share->keys); + table_share->keys_for_keyread.intersect(table_share->keys_in_use); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_set_keys_in_use() +{ + uint i; + MRN_DBUG_ENTER_METHOD(); + mrn::AutoIncrementValueLock lock_(table_share); + table_share->keys_in_use.set_prefix(table_share->keys); + share->disable_keys = false; + for (i = 0; i < table_share->keys; i++) { + if (i == table_share->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + /* disabled */ + table_share->keys_in_use.clear_bit(i); + DBUG_PRINT("info", ("mroonga: key %u disabled", i)); + share->disable_keys = true; + } + } + table_share->keys_for_keyread.set_prefix(table_share->keys); + table_share->keys_for_keyread.intersect(table_share->keys_in_use); + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_info(uint flag) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->info(flag); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (flag & HA_STATUS_ERRKEY) { + errkey = wrap_handler->errkey; + memcpy(dup_ref, wrap_handler->dup_ref, wrap_handler->ref_length); + } + if (flag & HA_STATUS_TIME) { + stats.update_time = wrap_handler->stats.update_time; + } + if (flag & HA_STATUS_CONST) { + stats.max_data_file_length = wrap_handler->stats.max_data_file_length; + stats.create_time = wrap_handler->stats.create_time; + stats.block_size = wrap_handler->stats.block_size; + wrapper_set_keys_in_use(); + } + if (flag & HA_STATUS_VARIABLE) { + stats.data_file_length = wrap_handler->stats.data_file_length; + stats.index_file_length = wrap_handler->stats.index_file_length; + stats.records = wrap_handler->stats.records; + stats.mean_rec_length = wrap_handler->stats.mean_rec_length; + stats.check_time = wrap_handler->stats.check_time; + } + if (flag & HA_STATUS_AUTO) { + stats.auto_increment_value = wrap_handler->stats.auto_increment_value; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_info(uint flag) +{ + MRN_DBUG_ENTER_METHOD(); + mrn_change_encoding(ctx, NULL); + + if (flag & (HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK)) { + errkey = dup_key; + } + + if ((flag & HA_STATUS_AUTO) && table->found_next_number_field) { + THD *thd = ha_thd(); + ulonglong nb_reserved_values; + bool next_number_field_is_null = !table->next_number_field; + mrn::ExternalLock mrn_external_lock(ha_thd(), this, + mrn_lock_type == F_UNLCK ? + F_RDLCK : F_UNLCK); + if (mrn_external_lock.error()) { + DBUG_RETURN(mrn_external_lock.error()); + } + if (next_number_field_is_null) { + table->next_number_field = table->found_next_number_field; + } + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + unsigned long auto_increment_offset, auto_increment_increment; + MRN_THD_GET_AUTOINC(thd, &auto_increment_offset, + &auto_increment_increment); + storage_get_auto_increment(auto_increment_offset, + auto_increment_increment, 1, + &stats.auto_increment_value, + &nb_reserved_values); + } + if (next_number_field_is_null) { + table->next_number_field = NULL; + } + } + + if (flag & HA_STATUS_CONST) { + storage_set_keys_in_use(); + } + + if (flag & HA_STATUS_VARIABLE) { + storage_info_variable(); + } + + DBUG_RETURN(0); +} + +void ha_mroonga::storage_info_variable() +{ + MRN_DBUG_ENTER_METHOD(); + + storage_info_variable_records(); + storage_info_variable_data_file_length(); + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_info_variable_records() +{ + MRN_DBUG_ENTER_METHOD(); + + stats.records = grn_table_size(ctx, grn_table); + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_info_variable_data_file_length() +{ + MRN_DBUG_ENTER_METHOD(); + + stats.data_file_length = 0; + stats.data_file_length += file_size(grn_obj_path(ctx, grn_table)); + grn_hash *columns = grn_hash_create(ctx, NULL, sizeof(grn_id), 0, + GRN_OBJ_TABLE_HASH_KEY); + grn_table_columns(ctx, grn_table, NULL, 0, (grn_obj *)columns); + /* grn_id id __attribute__((unused)); */ + grn_id *column_id; + GRN_HASH_EACH(ctx, columns, id, &column_id, NULL, NULL, { + grn_obj *column = grn_ctx_at(ctx, *column_id); + stats.data_file_length += file_size(grn_obj_path(ctx, column)); + grn_obj_unlink(ctx, column); + }); + grn_hash_close(ctx, columns); + + DBUG_VOID_RETURN; +} + +int ha_mroonga::info(uint flag) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_info(flag); + } else { + error = storage_info(flag); + } + DBUG_RETURN(error); +} + +uint ha_mroonga::wrapper_lock_count() const +{ + uint lock_count; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + lock_count = wrap_handler->lock_count(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(lock_count); +} + +uint ha_mroonga::storage_lock_count() const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(1); +} + +uint ha_mroonga::lock_count() const +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_lock_count(); + } else { + error = storage_lock_count(); + } + DBUG_RETURN(error); +} + +THR_LOCK_DATA **ha_mroonga::wrapper_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + to = wrap_handler->store_lock(thd, to, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(to); +} + +THR_LOCK_DATA **ha_mroonga::storage_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + if (lock_type != TL_IGNORE && thr_lock_data.type == TL_UNLOCK) { + if (!thd_in_lock_tables(thd)) { + if (lock_type == TL_READ_NO_INSERT) { + lock_type = TL_READ; + } else if (lock_type >= TL_WRITE_CONCURRENT_INSERT && + lock_type <= TL_WRITE && !thd_tablespace_op(thd)) { + lock_type = TL_WRITE_ALLOW_WRITE; + } + } + + thr_lock_data.type = lock_type; + } + *to++ = &thr_lock_data; + DBUG_RETURN(to); +} + +THR_LOCK_DATA **ha_mroonga::store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: lock_type=%s", + mrn_inspect_thr_lock_type(lock_type))); + if (share->wrapper_mode) + to = wrapper_store_lock(thd, to, lock_type); + else + to = storage_store_lock(thd, to, lock_type); + DBUG_RETURN(to); +} + +int ha_mroonga::wrapper_external_lock(THD *thd, int lock_type) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_external_lock(thd, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_external_lock(THD *thd, int lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::external_lock(THD *thd, int lock_type) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn_lock_type = lock_type; + if (share->wrapper_mode) + { + error = wrapper_external_lock(thd, lock_type); + } else { + error = storage_external_lock(thd, lock_type); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_init(bool scan) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_rnd_init(scan); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_init(bool scan) +{ + MRN_DBUG_ENTER_METHOD(); + mrn_change_encoding(ctx, NULL); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, 0, -1, 0); + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_init(bool scan) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_init(scan); + } else { + error = storage_rnd_init(scan); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_end() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_rnd_end(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_end() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_end() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_end(); + } else { + error = storage_rnd_end(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_next(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_RND_NEXT + error = wrap_handler->ha_rnd_next(buf); +#else + error = wrap_handler->rnd_next(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::rnd_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_next(buf); + } else { + error = storage_rnd_next(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rnd_pos(uchar *buf, uchar *pos) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_HA_RND_POS + error = wrap_handler->ha_rnd_pos(buf, pos); +#else + error = wrap_handler->rnd_pos(buf, pos); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_rnd_pos(uchar *buf, uchar *pos) +{ + MRN_DBUG_ENTER_METHOD(); + record_id = *((grn_id*) pos); + storage_store_fields(buf, record_id); + DBUG_RETURN(0); +} + +int ha_mroonga::rnd_pos(uchar *buf, uchar *pos) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_rnd_pos(buf, pos); + } else { + error = storage_rnd_pos(buf, pos); + } + DBUG_RETURN(error); +} + +void ha_mroonga::wrapper_position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->ref = ref; + wrap_handler->position(record); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + memcpy(ref, &record_id, sizeof(grn_id)); + DBUG_VOID_RETURN; +} + +void ha_mroonga::position(const uchar *record) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + wrapper_position(record); + else + storage_position(record); + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_extra(enum ha_extra_function operation) +{ + MRN_DBUG_ENTER_METHOD(); + switch (operation) { + case HA_EXTRA_IGNORE_DUP_KEY: + ignoring_duplicated_key = true; + break; + case HA_EXTRA_NO_IGNORE_DUP_KEY: + ignoring_duplicated_key = false; + break; + case HA_EXTRA_WRITE_CAN_REPLACE: + replacing_ = true; + break; + case HA_EXTRA_WRITE_CANNOT_REPLACE: + replacing_ = false; + break; + case HA_EXTRA_INSERT_WITH_UPDATE: + inserting_with_update = true; + break; + case HA_EXTRA_KEYREAD: + ignoring_no_key_columns = true; + break; + case HA_EXTRA_NO_KEYREAD: + ignoring_no_key_columns = false; + break; + default: + break; + } + DBUG_RETURN(0); +} + +int ha_mroonga::wrapper_extra(enum ha_extra_function operation) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->extra(operation); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_extra(enum ha_extra_function operation) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::extra(enum ha_extra_function operation) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", + ("mroonga: this=%p; extra-operation=%s", + this, mrn_inspect_extra_function(operation))); + if (share->wrapper_mode) { + if ((error = wrapper_extra(operation))) + DBUG_RETURN(error); + } else { + if ((error = storage_extra(operation))) + DBUG_RETURN(error); + } + error = generic_extra(operation); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_extra_opt(enum ha_extra_function operation, + ulong cache_size) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->extra_opt(operation, cache_size); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_extra_opt(enum ha_extra_function operation, + ulong cache_size) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::extra_opt(enum ha_extra_function operation, ulong cache_size) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + if ((error = wrapper_extra_opt(operation, cache_size))) + DBUG_RETURN(error); + } else { + if ((error = storage_extra_opt(operation, cache_size))) + DBUG_RETURN(error); + } + error = generic_extra(operation); + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_target_index(KEY *key_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool target_index = + (key_info->algorithm == HA_KEY_ALG_FULLTEXT) || mrn_is_geo_key(key_info); + DBUG_PRINT("info", ("mroonga: %s", target_index ? "true" : "false")); + DBUG_RETURN(target_index); +} + +bool ha_mroonga::wrapper_have_target_index() +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_target_index = false; + + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (wrapper_is_target_index(&key_info)) { + have_target_index = true; + break; + } + } + + DBUG_PRINT("info", ("mroonga: %s", have_target_index ? "true" : "false")); + DBUG_RETURN(have_target_index); +} + +int ha_mroonga::wrapper_write_row(uchar *buf) +{ + int error = 0; + THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_write_row(buf); + insert_id_for_cur_row = wrap_handler->insert_id_for_cur_row; + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_write_row_index(buf); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_write_row_index(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + GRN_BULK_REWIND(&key_buffer); + grn_bulk_space(ctx, &key_buffer, table->key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + buf, + &(table->key_info[table_share->primary_key]), + table->key_info[table_share->primary_key].key_length); + + int added; + grn_id record_id; + record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + GRN_TEXT_LEN(&key_buffer), + &added); + if (record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: failed to add a new record into groonga")); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to add a new record into groonga: key=<%.*s>", + (int)GRN_TEXT_LEN(&key_buffer), + GRN_TEXT_VALUE(&key_buffer)); + error = ER_ERROR_ON_WRITE; + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, error, + error_message); + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + + if (field->is_null()) + continue; + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + goto err; + error = generic_store_bulk(field, &new_value_buffer); + if (error) { + my_message(error, + "mroonga: wrapper: " + "failed to get new value for updating index.", + MYF(0)); + goto err; + } + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, j + 1, + NULL, &new_value_buffer); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + THD *thd = ha_thd(); + int i; + uint j; + int n_columns = table->s->fields; + + if (table->next_number_field && buf == table->record[0]) + { + if ((error = update_auto_increment())) + DBUG_RETURN(error); + } + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + const char *column_name = field->field_name; + + if (field->is_null()) continue; + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED), + MRN_COLUMN_NAME_ID, + MRN_GET_CURRENT_ROW_FOR_WARNING(thd)); + if (MRN_ABORT_ON_WARNING(thd)) { + DBUG_RETURN(ER_DATA_TOO_LONG); + } + } + } + + char *pkey; + int pkey_size; + uint pkey_nr; + pkey_nr = table->s->primary_key; + GRN_BULK_REWIND(&key_buffer); + if (pkey_nr == MAX_INDEXES) { + pkey = NULL; + pkey_size = 0; + } else { + KEY key_info = table->key_info[pkey_nr]; + if (KEY_N_KEY_PARTS(&key_info) == 1) { + Field *pkey_field = key_info.key_part[0].field; + error = mrn_change_encoding(ctx, pkey_field->charset()); + if (error) { + DBUG_RETURN(error); + } + generic_store_bulk(pkey_field, &key_buffer); + pkey = GRN_TEXT_VALUE(&key_buffer); + pkey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, buf, &key_info, key_info.key_length); + grn_bulk_space(ctx, &key_buffer, key_info.key_length); + pkey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(&key_info, + key, key_info.key_length, + (uchar *)pkey, (uint *)&pkey_size); + } + } + + int added; + record_id = grn_table_add(ctx, grn_table, pkey, pkey_size, &added); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if (!added) { + // duplicated error + error = HA_ERR_FOUND_DUPP_KEY; + memcpy(dup_ref, &record_id, sizeof(grn_id)); + dup_key = pkey_nr; + if (!ignoring_duplicated_key) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "duplicated id on insert: update primary key: <%.*s>", + pkey_size, pkey); + } + DBUG_RETURN(error); + } + + if ((error = storage_write_row_unique_indexes(buf))) + { + goto err; + } + + grn_obj colbuf; + GRN_VOID_INIT(&colbuf); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + const char *column_name = field->field_name; + + if (field->is_null()) + continue; + +#ifdef HAVE_SPATIAL + bool is_null_geometry_value = + field->real_type() == MYSQL_TYPE_GEOMETRY && + static_cast(field)->get_length() == 0; + if (is_null_geometry_value) { + continue; + } +#endif + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + + error = mrn_change_encoding(ctx, field->charset()); + if (error) { + grn_obj_unlink(ctx, &colbuf); + goto err; + } + error = generic_store_bulk(field, &colbuf); + if (error) { + grn_obj_unlink(ctx, &colbuf); + goto err; + } + if (added && is_grn_zero_column_value(grn_columns[i], &colbuf)) { + // WORKAROUND: groonga can't index newly added '0' value for + // fix size column. So we add non-'0' value first then add + // real '0' value again. It will be removed when groonga + // supports 'null' value. + char *bytes = GRN_BULK_HEAD(&colbuf); + bytes[0] = '\1'; + grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); + bytes[0] = '\0'; + } + grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); + if (ctx->rc) { + grn_obj_unlink(ctx, &colbuf); + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + error = ER_ERROR_ON_WRITE; + goto err; + } + } + grn_obj_unlink(ctx, &colbuf); + + error = storage_write_row_multiple_column_indexes(buf, record_id); + if (error) { + goto err; + } + + // for UDF last_insert_grn_id() + st_mrn_slot_data *slot_data; + slot_data = mrn_get_slot_data(thd, true); + if (slot_data == NULL) { + error = HA_ERR_OUT_OF_MEM; + goto err; + } + slot_data->last_insert_record_id = record_id; + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + if (table->found_next_number_field && + !table->s->next_number_keypart) { + Field_num *field = (Field_num *) table->found_next_number_field; + if (field->unsigned_flag || field->val_int() > 0) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + ulonglong nr = (ulonglong) field->val_int(); + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + if (long_term_share->auto_inc_value <= nr) { + long_term_share->auto_inc_value = nr + 1; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + } + } + } + DBUG_RETURN(0); + +err: + for (j = 0; j < table->s->keys; j++) { + if (j == pkey_nr) { + continue; + } + KEY *key_info = &table->key_info[j]; + if (key_info->flags & HA_NOSAME) { + grn_table_delete_by_id(ctx, grn_index_tables[j], key_id[j]); + } + } + grn_table_delete_by_id(ctx, grn_table, record_id); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_multiple_column_index(uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_column) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + mrn_change_encoding(ctx, NULL); + GRN_BULK_REWIND(&key_buffer); + grn_bulk_space(ctx, &key_buffer, key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + buf, + key_info, + key_info->key_length); + GRN_BULK_REWIND(&encoded_key_buffer); + grn_bulk_space(ctx, &encoded_key_buffer, key_info->key_length); + uint encoded_key_length; + storage_encode_multiple_column_key(key_info, + (uchar *)(GRN_TEXT_VALUE(&key_buffer)), + key_info->key_length, + (uchar *)(GRN_TEXT_VALUE(&encoded_key_buffer)), + &encoded_key_length); + DBUG_PRINT("info", ("mroonga: key_length=%u", key_info->key_length)); + DBUG_PRINT("info", ("mroonga: encoded_key_length=%u", encoded_key_length)); + DBUG_ASSERT(key_info->key_length >= encoded_key_length); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, NULL, + &encoded_key_buffer); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_multiple_column_indexes(uchar *buf, + grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY key_info = table->key_info[i]; + + if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + continue; + } + + if ((error = storage_write_row_multiple_column_index(buf, + record_id, + &key_info, + index_column))) + { + goto err; + } + } + +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_write_row_unique_index(uchar *buf, + KEY *key_info, + grn_obj *index_table, + grn_id *key_id) +{ + char *ukey = NULL; + int error, ukey_size = 0; + MRN_DBUG_ENTER_METHOD(); + GRN_BULK_REWIND(&key_buffer); + if (KEY_N_KEY_PARTS(key_info) == 1) { + Field *ukey_field = key_info->key_part[0].field; + error = mrn_change_encoding(ctx, ukey_field->charset()); + if (error) { + DBUG_RETURN(error); + } + generic_store_bulk(ukey_field, &key_buffer); + ukey = GRN_TEXT_VALUE(&key_buffer); + ukey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, buf, key_info, key_info->key_length); + grn_bulk_space(ctx, &key_buffer, key_info->key_length); + ukey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(key_info, + key, key_info->key_length, + (uchar *)(ukey), (uint *)&ukey_size); + } + + int added; + *key_id = grn_table_add(ctx, index_table, ukey, ukey_size, &added); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if (!added) { + // duplicated error + error = HA_ERR_FOUND_DUPP_KEY; + memcpy(dup_ref, key_id, sizeof(grn_id)); + if (!ignoring_duplicated_key) { + GRN_LOG(ctx, GRN_LOG_ERROR, + "duplicated id on insert: update unique index: <%.*s>", + ukey_size, ukey); + } + DBUG_RETURN(error); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_write_row_unique_indexes(uchar *buf) +{ + int error = 0; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + continue; + } + + if ((error = storage_write_row_unique_index(buf, key_info, + index_table, &key_id[i]))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + dup_key = i; + } + goto err; + } + } + DBUG_RETURN(0); + +err: + if (i) { + mrn_change_encoding(ctx, NULL); + do { + i--; + KEY *key_info = &table->key_info[i]; + if (key_info->flags & HA_NOSAME) { + grn_table_delete_by_id(ctx, grn_index_tables[i], key_id[i]); + } + } while (i); + } + DBUG_RETURN(error); +} + +int ha_mroonga::write_row(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_write_row(buf); + } else { + error = storage_write_row(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_get_record_id(uchar *data, grn_id *record_id, + const char *context) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + grn_obj key; + GRN_TEXT_INIT(&key, 0); + + mrn_change_encoding(ctx, NULL); + grn_bulk_space(ctx, &key, table->key_info->key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), + data, + &(table->key_info[table_share->primary_key]), + table->key_info[table_share->primary_key].key_length); + + *record_id = grn_table_get(ctx, grn_table, + GRN_TEXT_VALUE(&key), GRN_TEXT_LEN(&key)); + if (*record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: %s", context)); + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "%s: key=<%.*s>", + context, (int)GRN_TEXT_LEN(&key), GRN_TEXT_VALUE(&key)); + error = ER_ERROR_ON_WRITE; + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, error, + error_message); + } + grn_obj_unlink(ctx, &key); + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_update_row(const uchar *old_data, uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + THD *thd = ha_thd(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_update_row(old_data, new_data); + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_update_row_index(old_data, new_data); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_update_row_index(const uchar *old_data, uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + KEY key_info = table->key_info[table_share->primary_key]; + GRN_BULK_REWIND(&key_buffer); + key_copy((uchar *)(GRN_TEXT_VALUE(&key_buffer)), + new_data, + &key_info, key_info.key_length); + int added; + grn_id new_record_id; + new_record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + table->key_info->key_length, + &added); + if (new_record_id == GRN_ID_NIL) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to get new record ID for updating from groonga: key=<%.*s>", + (int)GRN_TEXT_LEN(&key_buffer), GRN_TEXT_VALUE(&key_buffer)); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + DBUG_RETURN(error); + } + + grn_id old_record_id; + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]); + for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + field->move_field_offset(ptr_diff); + } + error = wrapper_get_record_id((uchar *)old_data, &old_record_id, + "failed to get old record ID " + "for updating from groonga"); + for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + field->move_field_offset(-ptr_diff); + } + if (error) { + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + + generic_store_bulk(field, &new_value_buffer); + + field->move_field_offset(ptr_diff); + generic_store_bulk(field, &old_value_buffer); + field->move_field_offset(-ptr_diff); + + grn_rc rc; + if (old_record_id == new_record_id) { + if (added) { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, NULL); + if (!rc) { + rc = grn_column_index_update(ctx, index_column, new_record_id, j + 1, + NULL, &new_value_buffer); + } + } else { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, &new_value_buffer); + } + } else { + rc = grn_column_index_update(ctx, index_column, old_record_id, j + 1, + &old_value_buffer, NULL); + if (!rc) { + rc = grn_column_index_update(ctx, index_column, new_record_id, j + 1, + NULL, &new_value_buffer); + } + if (!rc) { + rc = grn_table_delete_by_id(ctx, grn_table, old_record_id); + } + } + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row(const uchar *old_data, uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + grn_obj colbuf; + int i; + uint j; + int n_columns = table->s->fields; + THD *thd = ha_thd(); + + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + const char *column_name = field->field_name; + + if (bitmap_is_set(table->write_set, field->field_index)) { + if (field->is_null()) continue; + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, MRN_GET_ERR_MSG(WARN_DATA_TRUNCATED), + MRN_COLUMN_NAME_ID, + MRN_GET_CURRENT_ROW_FOR_WARNING(thd)); + if (MRN_ABORT_ON_WARNING(thd)) { + DBUG_RETURN(ER_DATA_TOO_LONG); + } + } + } + } + + KEY *pkey_info = NULL; + storage_store_fields_for_prep_update(old_data, new_data, record_id); + { + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + if ((error = storage_prepare_delete_row_unique_indexes(old_data, + record_id))) { + DBUG_RETURN(error); + } + if ((error = storage_update_row_unique_indexes(new_data))) + { + DBUG_RETURN(error); + } + } + + if (table->s->primary_key != MAX_INDEXES) { + pkey_info = &(table->key_info[table->s->primary_key]); + } + GRN_VOID_INIT(&colbuf); + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + const char *column_name = field->field_name; + if (bitmap_is_set(table->write_set, field->field_index)) { + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + DBUG_PRINT("info", ("mroonga: update column %d(%d)",i,field->field_index)); + + if (field->is_null()) continue; + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + goto err; + + bool on_duplicate_key_update = + (inserting_with_update && ignoring_duplicated_key); + if (!on_duplicate_key_update && pkey_info) { + bool have_pkey = false; + for (j = 0; j < KEY_N_KEY_PARTS(pkey_info); j++) { + Field *pkey_field = pkey_info->key_part[j].field; + if (strcmp(pkey_field->field_name, column_name) == 0) { + if (!replacing_) { + char message[MRN_BUFFER_SIZE]; + snprintf(message, MRN_BUFFER_SIZE, + "data truncated for primary key column: <%s>", + column_name); + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, message); + } + have_pkey = true; + } + } + if (have_pkey) { + continue; + } + } + + generic_store_bulk(field, &colbuf); + grn_obj_set_value(ctx, grn_columns[i], record_id, &colbuf, GRN_OBJ_SET); + if (ctx->rc) { + grn_obj_unlink(ctx, &colbuf); + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + error = ER_ERROR_ON_WRITE; + goto err; + } + } + } + grn_obj_unlink(ctx, &colbuf); + + if ((error = storage_update_row_index(old_data, new_data))) + { + goto err; + } + + if ((error = storage_delete_row_unique_indexes())) + { + DBUG_RETURN(error); + } + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + if (table->found_next_number_field && + !table->s->next_number_keypart && + new_data == table->record[0]) { + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + Field_num *field = (Field_num *) table->found_next_number_field; + if (field->unsigned_flag || field->val_int() > 0) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + ulonglong nr = (ulonglong) field->val_int(); + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + { + mrn::Lock lock(&long_term_share->auto_inc_mutex); + if (long_term_share->auto_inc_value <= nr) { + long_term_share->auto_inc_value = nr + 1; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + } + } + } + DBUG_RETURN(0); + +err: + for (j = 0; j < table->s->keys; j++) { + if (j == table->s->primary_key) { + continue; + } + KEY *key_info = &table->key_info[j]; + if ((key_info->flags & HA_NOSAME) && key_id[j] != GRN_ID_NIL) { + grn_table_delete_by_id(ctx, grn_index_tables[j], key_id[j]); + } + } + + if (!error && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = 0; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = false; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row_index(const uchar *old_data, uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + grn_obj old_key, old_encoded_key, new_key, new_encoded_key; + GRN_TEXT_INIT(&old_key, 0); + GRN_TEXT_INIT(&old_encoded_key, 0); + GRN_TEXT_INIT(&new_key, 0); + GRN_TEXT_INIT(&new_encoded_key, 0); + + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(old_data, table->record[0]); + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + mrn_change_encoding(ctx, NULL); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY key_info = table->key_info[i]; + + if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + GRN_BULK_REWIND(&old_key); + grn_bulk_space(ctx, &old_key, key_info.key_length); + for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + field->move_field_offset(ptr_diff); + } + key_copy((uchar *)(GRN_TEXT_VALUE(&old_key)), + (uchar *)old_data, + &key_info, + key_info.key_length); + for (uint j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + field->move_field_offset(-ptr_diff); + } + GRN_BULK_REWIND(&old_encoded_key); + grn_bulk_space(ctx, &old_encoded_key, key_info.key_length); + uint old_encoded_key_length; + storage_encode_multiple_column_key(&key_info, + (uchar *)(GRN_TEXT_VALUE(&old_key)), + key_info.key_length, + (uchar *)(GRN_TEXT_VALUE(&old_encoded_key)), + &old_encoded_key_length); + + GRN_BULK_REWIND(&new_key); + grn_bulk_space(ctx, &new_key, key_info.key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&new_key)), + (uchar *)new_data, + &key_info, + key_info.key_length); + GRN_BULK_REWIND(&new_encoded_key); + grn_bulk_space(ctx, &new_encoded_key, key_info.key_length); + uint new_encoded_key_length; + storage_encode_multiple_column_key(&key_info, + (uchar *)(GRN_TEXT_VALUE(&new_key)), + key_info.key_length, + (uchar *)(GRN_TEXT_VALUE(&new_encoded_key)), + &new_encoded_key_length); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, + &old_encoded_key, &new_encoded_key); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + grn_obj_unlink(ctx, &old_key); + grn_obj_unlink(ctx, &old_encoded_key); + grn_obj_unlink(ctx, &new_key); + grn_obj_unlink(ctx, &new_encoded_key); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_update_row_unique_indexes(uchar *new_data) +{ + int error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + + if ( + KEY_N_KEY_PARTS(key_info) == 1 && + !bitmap_is_set(table->write_set, + key_info->key_part[0].field->field_index) + ) { + /* no change */ + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + + if ((error = storage_write_row_unique_index(new_data, key_info, + index_table, &key_id[i]))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + if (key_id[i] == del_key_id[i]) { + /* no change */ + key_id[i] = GRN_ID_NIL; + del_key_id[i] = GRN_ID_NIL; + continue; + } + dup_key = i; + DBUG_PRINT("info", ("mroonga: different key ID: %d record ID: %d,%d", + i, key_id[i], del_key_id[i])); + } + goto err; + } + } + DBUG_RETURN(0); + +err: + if (i) { + mrn_change_encoding(ctx, NULL); + do { + i--; + KEY *key_info = &table->key_info[i]; + if ((key_info->flags & HA_NOSAME) && key_id[i] != GRN_ID_NIL) { + grn_table_delete_by_id(ctx, grn_index_tables[i], key_id[i]); + } + } while (i); + } + DBUG_RETURN(error); +} + +int ha_mroonga::update_row(const uchar *old_data, uchar *new_data) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_update_row(old_data, new_data); + } else { + error = storage_update_row(old_data, new_data); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + THD *thd= ha_thd(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + tmp_disable_binlog(thd); + error = wrap_handler->ha_delete_row(buf); + reenable_binlog(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_delete_row_index(buf); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_row_index(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + mrn_change_encoding(ctx, NULL); + grn_id record_id; + error = wrapper_get_record_id((uchar *)buf, &record_id, + "failed to get record ID " + "for deleting from groonga"); + if (error) { + DBUG_RETURN(0); + } + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + + if (field->is_null()) + continue; + + generic_store_bulk(field, &old_value_buffer); + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, j + 1, + &old_value_buffer, NULL); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } + } +err: + grn_table_delete_by_id(ctx, grn_table, record_id); + if (ctx->rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(0); + } + + storage_store_fields_for_prep_update(buf, NULL, record_id); + if ((error = storage_prepare_delete_row_unique_indexes(buf, record_id))) { + DBUG_RETURN(error); + } + mrn_change_encoding(ctx, NULL); + grn_table_delete_by_id(ctx, grn_table, record_id); + if (ctx->rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + if ( + (error = storage_delete_row_index(buf)) || + (error = storage_delete_row_unique_indexes()) + ) { + DBUG_RETURN(error); + } + + grn_db_touch(ctx, grn_ctx_db(ctx)); + + DBUG_RETURN(0); +} + +int ha_mroonga::storage_delete_row_index(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + grn_obj key, encoded_key; + GRN_TEXT_INIT(&key, 0); + GRN_TEXT_INIT(&encoded_key, 0); + + mrn::DebugColumnAccess debug_column_access(table, table->read_set); + uint i; + uint n_keys = table->s->keys; + mrn_change_encoding(ctx, NULL); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY key_info = table->key_info[i]; + + if (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) { + continue; + } + + grn_obj *index_column = grn_index_columns[i]; + if (!index_column) { + /* disable keys */ + continue; + } + + GRN_BULK_REWIND(&key); + grn_bulk_space(ctx, &key, key_info.key_length); + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), + (uchar *)buf, + &key_info, + key_info.key_length); + GRN_BULK_REWIND(&encoded_key); + grn_bulk_space(ctx, &encoded_key, key_info.key_length); + uint encoded_key_length; + storage_encode_multiple_column_key(&key_info, + (uchar *)(GRN_TEXT_VALUE(&key)), + key_info.key_length, + (uchar *)(GRN_TEXT_VALUE(&encoded_key)), + &encoded_key_length); + + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, 1, + &encoded_key, NULL); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + grn_obj_unlink(ctx, &encoded_key); + grn_obj_unlink(ctx, &key); + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_row_unique_index(grn_obj *index_table, + grn_id del_key_id) +{ + MRN_DBUG_ENTER_METHOD(); + grn_rc rc = grn_table_delete_by_id(ctx, index_table, del_key_id); + if (rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_delete_row_unique_indexes() +{ + int error = 0, tmp_error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if ((!(key_info->flags & HA_NOSAME)) || del_key_id[i] == GRN_ID_NIL) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if ((tmp_error = storage_delete_row_unique_index(index_table, + del_key_id[i]))) + { + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_prepare_delete_row_unique_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *del_key_id) +{ + const void *ukey = NULL; + uint32 ukey_size = 0; + MRN_DBUG_ENTER_METHOD(); + if (KEY_N_KEY_PARTS(key_info) == 1) { + GRN_BULK_REWIND(&key_buffer); + grn_obj_get_value(ctx, index_column, record_id, &key_buffer); + ukey = GRN_TEXT_VALUE(&key_buffer); + ukey_size = GRN_TEXT_LEN(&key_buffer); + } else { + mrn_change_encoding(ctx, NULL); + uchar key[MRN_MAX_KEY_SIZE]; + key_copy(key, (uchar *) buf, key_info, key_info->key_length); + grn_bulk_space(ctx, &key_buffer, key_info->key_length); + ukey = GRN_TEXT_VALUE(&key_buffer); + storage_encode_multiple_column_key(key_info, + key, key_info->key_length, + (uchar *)ukey, (uint *)&ukey_size); + } + *del_key_id = grn_table_get(ctx, index_table, ukey, ukey_size); + DBUG_RETURN(0); +} + +int ha_mroonga::storage_prepare_delete_row_unique_indexes(const uchar *buf, + grn_id record_id) +{ + int error = 0, tmp_error; + uint i; + uint n_keys = table->s->keys; + MRN_DBUG_ENTER_METHOD(); + + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY *key_info = &table->key_info[i]; + if (!(key_info->flags & HA_NOSAME)) { + continue; + } + + grn_obj *index_table = grn_index_tables[i]; + if (!index_table) { + del_key_id[i] = GRN_ID_NIL; + continue; + } + + grn_obj *index_column; + if (KEY_N_KEY_PARTS(key_info) == 1) { + Field *field = key_info->key_part[0].field; + mrn_change_encoding(ctx, field->charset()); + index_column = grn_columns[field->field_index]; + } else { + mrn_change_encoding(ctx, NULL); + index_column = grn_index_columns[i]; + } + if ((tmp_error = storage_prepare_delete_row_unique_index(buf, record_id, + key_info, + index_table, + index_column, + &del_key_id[i]))) + { + error = tmp_error; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::delete_row(const uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_delete_row(buf); + } else { + error = storage_delete_row(buf); + } + DBUG_RETURN(error); +} + +uint ha_mroonga::wrapper_max_supported_key_parts() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(MAX_REF_PARTS); +} + +uint ha_mroonga::storage_max_supported_key_parts() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(1); +} + +uint ha_mroonga::max_supported_key_parts() +{ + MRN_DBUG_ENTER_METHOD(); + uint parts; + if (share->wrapper_mode) + { + parts = wrapper_max_supported_key_parts(); + } else { + parts = storage_max_supported_key_parts(); + } + DBUG_RETURN(parts); +} + +ha_rows ha_mroonga::wrapper_records_in_range(uint key_nr, key_range *range_min, + key_range *range_max) +{ + ha_rows row_count; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->s->key_info[key_nr]; + if (mrn_is_geo_key(&key_info)) { + row_count = generic_records_in_range_geo(key_nr, range_min, range_max); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + row_count = wrap_handler->records_in_range(key_nr, range_min, range_max); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::storage_records_in_range(uint key_nr, key_range *range_min, + key_range *range_max) +{ + MRN_DBUG_ENTER_METHOD(); + int flags = 0; + uint size_min = 0, size_max = 0; + ha_rows row_count = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + uchar key_max_entity[MRN_MAX_KEY_SIZE]; + KEY key_info = table->s->key_info[key_nr]; + bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1; + + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + if (range_min && range_max && + range_min->length == range_max->length && + memcmp(range_min->key, range_max->key, range_min->length) == 0) { + flags |= GRN_CURSOR_PREFIX; + key_min = key_min_entity; + storage_encode_multiple_column_key(&key_info, + range_min->key, range_min->length, + key_min, &size_min); + } else { + key_min = key_min_entity; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(&key_info, + range_min, range_max, + key_min, &size_min, + key_max, &size_max); + } + } else if (mrn_is_geo_key(&key_info)) { + mrn_change_encoding(ctx, key_info.key_part->field->charset()); + row_count = generic_records_in_range_geo(key_nr, range_min, range_max); + DBUG_RETURN(row_count); + } else { + KEY_PART_INFO key_part = key_info.key_part[0]; + Field *field = key_part.field; + const char *column_name = field->field_name; + mrn_change_encoding(ctx, field->charset()); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + DBUG_RETURN((ha_rows)1); + } + + if (range_min) { + key_min = key_min_entity; + storage_encode_key(field, range_min->key, key_min, &size_min); + if (size_min == 0) { + DBUG_RETURN(HA_POS_ERROR); + } + } + if (range_max) { + key_max = key_max_entity; + storage_encode_key(field, range_max->key, key_max, &size_max); + if (size_max == 0) { + DBUG_RETURN(HA_POS_ERROR); + } + } + } + + if (range_min) { + DBUG_PRINT("info", ("mroonga: range_min->flag=%u", range_min->flag)); + if (range_min->flag == HA_READ_AFTER_KEY) { + flags |= GRN_CURSOR_GT; + } + } + if (range_max) { + DBUG_PRINT("info", ("mroonga: range_min->flag=%u", range_max->flag)); + if (range_max->flag == HA_READ_BEFORE_KEY) { + flags |= GRN_CURSOR_LT; + } + } + + uint pkey_nr = table->s->primary_key; + if (key_nr == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, + key_max, size_max, + 0, -1, flags); + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + row_count++; + } + grn_table_cursor_close(ctx, cursor); + } else { + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + + grn_table_cursor *cursor; + grn_table_cursor *index_cursor; + cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + index_cursor = grn_index_cursor_open(ctx, cursor, + grn_index_columns[key_nr], + 0, GRN_ID_MAX, 0); + while (grn_table_cursor_next(ctx, index_cursor) != GRN_ID_NIL) { + row_count++; + } + grn_obj_unlink(ctx, index_cursor); + grn_table_cursor_close(ctx, cursor); + } + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::generic_records_in_range_geo(uint key_nr, + key_range *range_min, + key_range *range_max) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows row_count; + int error; + + if (!range_min) { + DBUG_PRINT("info", + ("mroonga: range min is missing for geometry range search")); + DBUG_RETURN(HA_POS_ERROR); + } + if (range_max) { + DBUG_PRINT("info", + ("mroonga: range max is specified for geometry range search")); + DBUG_RETURN(HA_POS_ERROR); + } + error = mrn_change_encoding(ctx, + table->key_info[key_nr].key_part->field->charset()); + if (error) + DBUG_RETURN(error); + if (!(range_min->flag & HA_READ_MBR_CONTAIN)) { + push_warning_unsupported_spatial_index_search(range_min->flag); + row_count = grn_table_size(ctx, grn_table); + DBUG_RETURN(row_count); + } + + geo_store_rectangle(range_min->key); + row_count = grn_geo_estimate_in_rectangle(ctx, + grn_index_columns[key_nr], + &top_left_point, + &bottom_right_point); + DBUG_RETURN(row_count); +} + +ha_rows ha_mroonga::records_in_range(uint key_nr, key_range *range_min, key_range *range_max) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows row_count = 0; + if (share->wrapper_mode) + { + row_count = wrapper_records_in_range(key_nr, range_min, range_max); + } else { + row_count = storage_records_in_range(key_nr, range_min, range_max); + } + DBUG_PRINT("info", ("mroonga: row_count=%" MRN_HA_ROWS_FORMAT, row_count)); + DBUG_RETURN(row_count); +} + +int ha_mroonga::wrapper_index_init(uint idx, bool sorted) +{ + int error = 0; + KEY key_info = table->s->key_info[idx]; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (!mrn_is_geo_key(&key_info) && key_info.algorithm != HA_KEY_ALG_FULLTEXT) + { + error = wrap_handler->ha_index_init(share->wrap_key_nr[idx], sorted); + } else { + error = wrap_handler->ha_index_init(share->wrap_primary_key, sorted); + } + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_init(uint idx, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::index_init(uint idx, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: idx=%u", idx)); + active_index = idx; + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_init(idx, sorted); + } else { + error = storage_index_init(idx, sorted); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_end() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_index_or_rnd_end(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_end() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + clear_cursor_geo(); + DBUG_RETURN(0); +} + +int ha_mroonga::index_end() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_end(); + } else { + error = storage_index_end(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + clear_cursor_geo(); + error = generic_geo_open_cursor(key, find_flag); + if (!error) { + error = wrapper_get_next_geo_record(buf); + } + DBUG_RETURN(error); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + error = wrap_handler->ha_index_read_map(buf, key, keypart_map, find_flag); +#else + error = wrap_handler->index_read_map(buf, key, keypart_map, find_flag); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + check_count_skip(keypart_map, 0, false); + + int error = 0; + + uint key_nr = active_index; + KEY key_info = table->key_info[key_nr]; + int flags = 0; + uint size_min = 0, size_max = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + uchar key_max_entity[MRN_MAX_KEY_SIZE]; + + clear_cursor(); + clear_cursor_geo(); + clear_empty_value_records(); + + bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1; + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + uint key_length = calculate_key_len(table, active_index, key, keypart_map); + DBUG_PRINT("info", + ("mroonga: multiple column index: " + "search key length=<%u>, " + "multiple column index key length=<%u>", + key_length, key_info.key_length)); + if (key_length == key_info.key_length) { + if (find_flag == HA_READ_BEFORE_KEY || + find_flag == HA_READ_PREFIX_LAST_OR_PREV) { + key_max = key_max_entity; + storage_encode_multiple_column_key(&key_info, + key, key_length, + key_max, &size_max); + } else { + key_min = key_min_entity; + storage_encode_multiple_column_key(&key_info, + key, key_length, + key_min, &size_min); + } + } else { + flags |= GRN_CURSOR_PREFIX; + key_min = key_min_entity; + storage_encode_multiple_column_key(&key_info, + key, key_length, + key_min, &size_min); + } + } else if (mrn_is_geo_key(&key_info)) { + error = mrn_change_encoding(ctx, key_info.key_part->field->charset()); + if (error) + DBUG_RETURN(error); + error = generic_geo_open_cursor(key, find_flag); + if (!error) { + error = storage_get_next_record(buf); + } + DBUG_RETURN(error); + } else { + KEY_PART_INFO key_part = key_info.key_part[0]; + Field *field = key_part.field; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + if (find_flag == HA_READ_KEY_EXACT) { + const char *column_name = field->field_name; + + key_min = key_min_entity; + key_max = key_min_entity; + storage_encode_key(field, key, key_min, &size_min); + size_max = size_min; + // for _id + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + grn_id found_record_id = *((grn_id *)key_min); + if (grn_table_at(ctx, grn_table, found_record_id) != GRN_ID_NIL) { // found + storage_store_fields(buf, found_record_id); + table->status = 0; + record_id = found_record_id; + DBUG_RETURN(0); + } else { + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + } + } else if (find_flag == HA_READ_BEFORE_KEY || + find_flag == HA_READ_PREFIX_LAST_OR_PREV) { + key_max = key_max_entity; + storage_encode_key(field, key, key_max_entity, &size_max); + } else { + key_min = key_min_entity; + storage_encode_key(field, key, key_min_entity, &size_min); + } + } + + switch (find_flag) { + case HA_READ_BEFORE_KEY: + flags |= GRN_CURSOR_LT | GRN_CURSOR_DESCENDING; + break; + case HA_READ_PREFIX_LAST_OR_PREV: + flags |= GRN_CURSOR_LE | GRN_CURSOR_DESCENDING; + break; + case HA_READ_AFTER_KEY: + flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_OR_NEXT: + flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; + break; + default: + break; + } + + uint pkey_nr = table->s->primary_key; + if (key_nr == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, + key_max, size_max, + 0, -1, flags); + } else { + bool is_empty_value_records_search = false; + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else if (flags == 0 && size_min == 0 && size_max == 0) { + is_empty_value_records_search = true; + DBUG_PRINT("info", + ("mroonga: use table scan for searching empty value records")); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + if (is_empty_value_records_search) { + grn_obj *expression, *expression_variable; + GRN_EXPR_CREATE_FOR_QUERY(ctx, grn_table, + expression, expression_variable); + grn_obj *target_column = + grn_columns[key_info.key_part->field->field_index]; + grn_expr_append_const(ctx, expression, target_column, GRN_OP_GET_VALUE, 1); + grn_obj empty_value; + GRN_TEXT_INIT(&empty_value, 0); + grn_expr_append_obj(ctx, expression, &empty_value, GRN_OP_PUSH, 1); + grn_expr_append_op(ctx, expression, GRN_OP_EQUAL, 2); + + empty_value_records = + grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + grn_table_select(ctx, grn_table, expression, empty_value_records, + GRN_OP_OR); + grn_obj_unlink(ctx, expression); + grn_obj_unlink(ctx, &empty_value); + + empty_value_records_cursor = + grn_table_cursor_open(ctx, empty_value_records, + NULL, 0, NULL, 0, + 0, -1, flags); + } else { + index_table_cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[key_nr], + 0, GRN_ID_MAX, 0); + } + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_read_map(buf, key, keypart_map, find_flag); + } else { + error = storage_index_read_map(buf, key, keypart_map, find_flag); + } + DBUG_PRINT("info", ("mroonga: error=%d", error)); + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP +int ha_mroonga::wrapper_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +# ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_LAST_MAP + error = wrap_handler->ha_index_read_last_map(buf, key, keypart_map); +# else + error = wrap_handler->index_read_last_map(buf, key, keypart_map); +# endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + MRN_DBUG_ENTER_METHOD(); + uint key_nr = active_index; + KEY key_info = table->key_info[key_nr]; + + int flags = GRN_CURSOR_DESCENDING, error; + uint size_min = 0, size_max = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + + clear_cursor(); + + bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1; + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + flags |= GRN_CURSOR_PREFIX; + uint key_length = calculate_key_len(table, active_index, key, keypart_map); + key_min = key_min_entity; + storage_encode_multiple_column_key(&key_info, + key, key_length, + key_min, &size_min); + } else { + KEY_PART_INFO key_part = key_info.key_part[0]; + Field *field = key_part.field; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + key_min = key_min_entity; + key_max = key_min_entity; + storage_encode_key(field, key, key_min, &size_min); + size_max = size_min; + } + + uint pkey_nr = table->s->primary_key; + if (key_nr == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, key_max, size_max, + 0, -1, flags); + } else { + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", key_nr)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", key_nr)); + } + index_table_cursor = grn_table_cursor_open(ctx, grn_index_tables[key_nr], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[key_nr], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_read_last_map(buf, key, keypart_map); + } else { + error = storage_index_read_last_map(buf, key, keypart_map); + } + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::wrapper_index_next(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + error = wrap_handler->ha_index_next(buf); +#else + error = wrap_handler->index_next(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_next(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_next(buf); + } else { + error = storage_index_next(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_prev(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + error = wrap_handler->ha_index_prev(buf); +#else + error = wrap_handler->index_prev(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_prev(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_prev(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_prev(buf); + } else { + error = storage_index_prev(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_first(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_FIRST + error = wrap_handler->ha_index_first(buf); +#else + error = wrap_handler->index_first(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_first(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + int flags = GRN_CURSOR_ASCENDING; + uint pkey_nr = table->s->primary_key; + mrn_change_encoding(ctx, NULL); + if (active_index == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } else { + if (KEY_N_KEY_PARTS(&(table->key_info[active_index])) > 1) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", active_index)); + } + index_table_cursor = grn_table_cursor_open(ctx, + grn_index_tables[active_index], + NULL, 0, + NULL, 0, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[active_index], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_first(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_first(buf); + } else { + error = storage_index_first(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_last(uchar *buf) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_LAST + error = wrap_handler->ha_index_last(buf); +#else + error = wrap_handler->index_last(buf); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_last(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + int flags = GRN_CURSOR_DESCENDING; + uint pkey_nr = table->s->primary_key; + mrn_change_encoding(ctx, NULL); + if (active_index == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } else { + if (KEY_N_KEY_PARTS(&(table->key_info[active_index])) > 1) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", active_index)); + } + index_table_cursor = grn_table_cursor_open(ctx, + grn_index_tables[active_index], + NULL, 0, + NULL, 0, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[active_index], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + int error = storage_get_next_record(buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_last(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_last(buf); + } else { + error = storage_index_last(buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_index_next_same(uchar *buf, const uchar *key, + uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY key_info = table->s->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = wrapper_get_next_geo_record(buf); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME + error = wrap_handler->ha_index_next_same(buf, key, keylen); +#else + error = wrap_handler->index_next_same(buf, key, keylen); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_index_next_same(uchar *buf, const uchar *key, + uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = storage_get_next_record(count_skip ? NULL : buf); + DBUG_RETURN(error); +} + +int ha_mroonga::index_next_same(uchar *buf, const uchar *key, uint keylen) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_index_next_same(buf, key, keylen); + } else { + error = storage_index_next_same(buf, key, keylen); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + clear_cursor_geo(); + error = generic_geo_open_cursor(start_key->key, start_key->flag); + if (!error) { + error = wrapper_get_next_geo_record(table->record[0]); + } + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_range_first(start_key, end_key, eq_range, + sorted); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + check_count_skip(start_key ? start_key->keypart_map : 0, + end_key ? end_key->keypart_map : 0, false); + int flags = 0, error; + uint size_min = 0, size_max = 0; + uchar *key_min = NULL, *key_max = NULL; + uchar key_min_entity[MRN_MAX_KEY_SIZE]; + uchar key_max_entity[MRN_MAX_KEY_SIZE]; + KEY key_info = table->s->key_info[active_index]; + + clear_cursor(); + + bool is_multiple_column_index = KEY_N_KEY_PARTS(&key_info) > 1; + if (is_multiple_column_index) { + mrn_change_encoding(ctx, NULL); + if (start_key && end_key && + start_key->length == end_key->length && + memcmp(start_key->key, end_key->key, start_key->length) == 0) { + flags |= GRN_CURSOR_PREFIX; + key_min = key_min_entity; + storage_encode_multiple_column_key(&key_info, + start_key->key, start_key->length, + key_min, &size_min); + } else { + key_min = key_min_entity; + key_max = key_max_entity; + storage_encode_multiple_column_key_range(&key_info, + start_key, end_key, + key_min, &size_min, + key_max, &size_max); + if (size_min == 0) { + key_min = NULL; + } + if (size_max == 0) { + key_max = NULL; + } + } + } else { + KEY_PART_INFO key_part = key_info.key_part[0]; + Field *field = key_part.field; + const char *column_name = field->field_name; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + if (start_key) { + key_min = key_min_entity; + storage_encode_key(field, start_key->key, key_min_entity, + &size_min); + if (start_key->flag == HA_READ_KEY_EXACT) { + // for _id + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + grn_id found_record_id = *((grn_id *)key_min); + if (grn_table_at(ctx, grn_table, found_record_id) != GRN_ID_NIL) { // found + storage_store_fields(table->record[0], found_record_id); + table->status = 0; + cursor = NULL; + record_id = found_record_id; + DBUG_RETURN(0); + } else { + table->status = STATUS_NOT_FOUND; + cursor = NULL; + record_id = GRN_ID_NIL; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + } + } + } + if (end_key) { + key_max = key_max_entity; + storage_encode_key(field, end_key->key, key_max, &size_max); + } + } + + if (start_key) { + switch (start_key->flag) { + case HA_READ_AFTER_KEY: + flags |= GRN_CURSOR_GT | GRN_CURSOR_ASCENDING; + break; + case HA_READ_KEY_OR_NEXT: + flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; + break; + default: + break; + } + } + if (end_key) { + switch (end_key->flag) { + case HA_READ_BEFORE_KEY: + flags |= GRN_CURSOR_LT | GRN_CURSOR_ASCENDING; + break; + case HA_READ_AFTER_KEY: + flags |= GRN_CURSOR_GE | GRN_CURSOR_ASCENDING; + break; + default: + break; + } + } + + uint pkey_nr = table->s->primary_key; + if (active_index == pkey_nr) { + DBUG_PRINT("info", ("mroonga: use primary key")); + cursor = grn_table_cursor_open(ctx, grn_table, + key_min, size_min, key_max, size_max, + 0, -1, flags); + } else { + if (is_multiple_column_index) { + DBUG_PRINT("info", ("mroonga: use multiple column key%u", active_index)); + } else { + DBUG_PRINT("info", ("mroonga: use key%u", active_index)); + } + index_table_cursor = grn_table_cursor_open(ctx, + grn_index_tables[active_index], + key_min, size_min, + key_max, size_max, + 0, -1, flags); + cursor = grn_index_cursor_open(ctx, index_table_cursor, + grn_index_columns[active_index], + 0, GRN_ID_MAX, 0); + } + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + error = storage_get_next_record(table->record[0]); + DBUG_RETURN(error); +} + +int ha_mroonga::read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_range_first(start_key, end_key, eq_range, + sorted); + } else { + error = storage_read_range_first(start_key, end_key, eq_range, sorted); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_read_range_next() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = wrapper_get_next_geo_record(table->record[0]); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_range_next(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_range_next() +{ + MRN_DBUG_ENTER_METHOD(); + + if (cursor == NULL) { + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + int error = storage_get_next_record(count_skip ? NULL : table->record[0]); + + DBUG_RETURN(error); +} + +int ha_mroonga::read_range_next() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_range_next(); + } else { + error = storage_read_range_next(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + int error = 0; + if (sorted_result) { + mrn_ft_info->cursor = grn_table_cursor_open(ctx, sorted_result, + NULL, 0, NULL, 0, + 0, -1, 0); + } else { + mrn_ft_info->cursor = grn_table_cursor_open(ctx, mrn_ft_info->result, + NULL, 0, NULL, 0, + 0, -1, 0); + } + if (ctx->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + } else { + if (sorted_result) { + if (grn_table->header.type == GRN_TABLE_NO_KEY) { + mrn_ft_info->id_accessor = grn_obj_column(ctx, sorted_result, + MRN_COLUMN_NAME_ID, + strlen(MRN_COLUMN_NAME_ID)); + } else { + mrn_ft_info->key_accessor = grn_obj_column(ctx, sorted_result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); + } + } else { + mrn_ft_info->key_accessor = grn_obj_column(ctx, mrn_ft_info->result, + MRN_COLUMN_NAME_KEY, + strlen(MRN_COLUMN_NAME_KEY)); + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_ft_init(); + record_id = GRN_ID_NIL; + DBUG_RETURN(error); +} + +int ha_mroonga::ft_init() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_ft_init(); + } else { + error = storage_ft_init(); + } + DBUG_RETURN(error); +} + +void ha_mroonga::generic_ft_init_ext_add_conditions_fast_order_limit( + struct st_mrn_ft_info *info, grn_obj *expression) +{ + MRN_DBUG_ENTER_METHOD(); + + Item *where = table->pos_in_table_list->select_lex->where; + + bool is_storage_mode = !(share->wrapper_mode); + mrn::ConditionConverter converter(info->ctx, grn_table, is_storage_mode); + converter.convert(where, expression); + + DBUG_VOID_RETURN; +} + +bool ha_mroonga::generic_ft_init_ext_parse_pragma_d(struct st_mrn_ft_info *info, + const char *keyword, + uint keyword_length, + grn_operator *default_operator, + uint *consumed_keyword_length) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_bool succeeded = true; + if (keyword_length >= 1 && keyword[0] == '+') { + *default_operator = GRN_OP_AND; + *consumed_keyword_length = 1; + } else if (keyword_length >= 1 && keyword[0] == '-') { + *default_operator = GRN_OP_AND_NOT; + *consumed_keyword_length = 1; + } else if (keyword_length >= 2 && memcmp(keyword, "OR", 2) == 0) { + *default_operator = GRN_OP_OR; + *consumed_keyword_length = 2; + } else { + succeeded = false; + } + + DBUG_RETURN(succeeded); +} + +void ha_mroonga::generic_ft_init_ext_parse_pragma_w_append_section( + struct st_mrn_ft_info *info, + grn_obj *index_column, + grn_obj *match_columns, + uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); + GRN_UINT32_SET(info->ctx, section_value_buffer, section); + grn_expr_append_const(info->ctx, match_columns, section_value_buffer, + GRN_OP_PUSH, 1); + grn_expr_append_op(info->ctx, match_columns, GRN_OP_GET_MEMBER, 2); + + if (weight != 1) { + grn_expr_append_const_int(info->ctx, match_columns, weight, + GRN_OP_PUSH, 1); + grn_expr_append_op(info->ctx, match_columns, GRN_OP_STAR, 2); + } + + if (n_weights >= 2) { + grn_expr_append_op(info->ctx, match_columns, GRN_OP_OR, 2); + } + + DBUG_VOID_RETURN; +} + +bool ha_mroonga::generic_ft_init_ext_parse_pragma_w(struct st_mrn_ft_info *info, + const char *keyword, + uint keyword_length, + grn_obj *index_column, + grn_obj *match_columns, + uint *consumed_keyword_length, + grn_obj *tmp_objects) +{ + MRN_DBUG_ENTER_METHOD(); + + *consumed_keyword_length = 0; + + uint n_sections = KEY_N_KEY_PARTS(info->key_info); + + grn_obj section_value_buffer; + GRN_UINT32_INIT(§ion_value_buffer, 0); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(bool, specified_sections, n_sections); + for (uint i = 0; i < n_sections; ++i) { + specified_sections[i] = false; + } + + uint n_weights = 0; + while (keyword_length >= 1) { + if (n_weights >= 1) { + if (keyword[0] != ',') { + break; + } + uint n_used_keyword_length = 1; + *consumed_keyword_length += n_used_keyword_length; + keyword_length -= n_used_keyword_length; + keyword += n_used_keyword_length; + if (keyword_length == 0) { + break; + } + } + + uint section = 0; + if ('1' <= keyword[0] && keyword[0] <= '9') { + const char *section_start = keyword; + const char *keyword_end = keyword + keyword_length; + const char *keyword_rest; + section = grn_atoui(section_start, keyword_end, &keyword_rest); + if (section_start == keyword_rest) { + break; + } + if (!(0 < section && section <= n_sections)) { + break; + } + section -= 1; + specified_sections[section] = true; + uint n_used_keyword_length = keyword_rest - keyword; + *consumed_keyword_length += n_used_keyword_length; + keyword_length -= n_used_keyword_length; + keyword += n_used_keyword_length; + } else { + break; + } + + int weight = 1; + if (keyword_length >= 2 && keyword[0] == ':') { + const char *weight_start = keyword + 1; + const char *keyword_end = keyword + keyword_length; + const char *keyword_rest; + weight = grn_atoi(weight_start, keyword_end, &keyword_rest); + if (weight_start == keyword_rest) { + break; + } + uint n_used_keyword_length = keyword_rest - keyword; + *consumed_keyword_length += n_used_keyword_length; + keyword_length -= n_used_keyword_length; + keyword += n_used_keyword_length; + } + + n_weights++; + + generic_ft_init_ext_parse_pragma_w_append_section(info, + index_column, + match_columns, + section, + §ion_value_buffer, + weight, + n_weights); + } + + for (uint section = 0; section < n_sections; ++section) { + if (specified_sections[section]) { + continue; + } + + ++n_weights; + + int default_weight = 1; + generic_ft_init_ext_parse_pragma_w_append_section(info, + index_column, + match_columns, + section, + §ion_value_buffer, + default_weight, + n_weights); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(specified_sections); + + GRN_OBJ_FIN(info->ctx, §ion_value_buffer); + + DBUG_RETURN(n_weights > 0); +} + +grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_boolean_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression, + grn_obj *tmp_objects) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_rc rc = GRN_SUCCESS; + + const char *keyword, *keyword_original; + uint keyword_length, keyword_length_original; + grn_operator default_operator = GRN_OP_OR; + grn_bool weight_specified = false; + keyword = keyword_original = key->ptr(); + keyword_length = keyword_length_original = key->length(); + // WORKAROUND: support only "D" and "W" pragmas. + if (keyword_length >= 2 && keyword[0] == '*') { + bool parsed = false; + bool done = false; + keyword++; + keyword_length++; + while (!done) { + uint consumed_keyword_length = 0; + switch (keyword[0]) { + case 'D': + if (generic_ft_init_ext_parse_pragma_d(info, + keyword + 1, + keyword_length - 1, + &default_operator, + &consumed_keyword_length)) { + parsed = true; + consumed_keyword_length += 1; + keyword += consumed_keyword_length; + keyword_length -= consumed_keyword_length; + } else { + done = true; + } + break; + case 'W': + if (generic_ft_init_ext_parse_pragma_w(info, + keyword + 1, + keyword_length - 1, + index_column, + match_columns, + &consumed_keyword_length, + tmp_objects)) { + parsed = true; + weight_specified = true; + consumed_keyword_length += 1; + keyword += consumed_keyword_length; + keyword_length -= consumed_keyword_length; + } else { + done = true; + } + break; + default: + done = true; + break; + } + } + if (!parsed) { + keyword = keyword_original; + keyword_length = keyword_length_original; + } + } + // WORKAROUND: ignore the first '+' to support "+apple macintosh" pattern. + while (keyword_length > 0 && keyword[0] == ' ') { + keyword++; + keyword_length--; + } + if (keyword_length > 0 && keyword[0] == '+') { + keyword++; + keyword_length--; + } + if (!weight_specified) { + grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); + } + grn_expr_flags expression_flags = + GRN_EXPR_SYNTAX_QUERY | GRN_EXPR_ALLOW_LEADING_NOT; + rc = grn_expr_parse(info->ctx, expression, + keyword, keyword_length, + match_columns, GRN_OP_MATCH, default_operator, + expression_flags); + if (rc) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to parse fulltext search keyword: <%.*s>: <%s>", + keyword_length_original, keyword_original, + info->ctx->errbuf); + ulong action = THDVAR(ha_thd(), action_on_fulltext_query_error); + switch (static_cast(action)) { + case MRN_ACTION_ON_ERROR_ERROR: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + break; + case MRN_ACTION_ON_ERROR_ERROR_AND_LOG: + my_message(ER_PARSE_ERROR, error_message, MYF(0)); + GRN_LOG(info->ctx, GRN_LOG_ERROR, "%s", error_message); + break; + case MRN_ACTION_ON_ERROR_IGNORE: + break; + case MRN_ACTION_ON_ERROR_IGNORE_AND_LOG: + GRN_LOG(info->ctx, GRN_LOG_ERROR, "%s", error_message); + break; + } + } + + DBUG_RETURN(rc); +} + +grn_rc ha_mroonga::generic_ft_init_ext_prepare_expression_in_normal_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression, + grn_obj *tmp_objects) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_rc rc = GRN_SUCCESS; + + grn_obj query; + GRN_TEXT_INIT(&query, GRN_OBJ_DO_SHALLOW_COPY); + GRN_TEXT_SET(info->ctx, &query, key->ptr(), key->length()); + grn_expr_append_obj(info->ctx, match_columns, index_column, GRN_OP_PUSH, 1); + grn_expr_append_obj(info->ctx, expression, match_columns, GRN_OP_PUSH, 1); + grn_expr_append_const(info->ctx, expression, &query, GRN_OP_PUSH, 1); + grn_expr_append_op(info->ctx, expression, GRN_OP_SIMILAR, 2); + grn_obj_unlink(info->ctx, &query); + + DBUG_RETURN(rc); +} + +struct st_mrn_ft_info *ha_mroonga::generic_ft_init_ext_select(uint flags, + uint key_nr, + String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + struct st_mrn_ft_info *info = new st_mrn_ft_info(); + info->mroonga = this; + info->ctx = ctx; + mrn_change_encoding(info->ctx, + table->key_info[key_nr].key_part->field->charset()); + info->encoding = GRN_CTX_GET_ENCODING(info->ctx); + info->table = grn_table; + info->result = grn_table_create(info->ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + info->score_column = grn_obj_column(info->ctx, info->result, + MRN_COLUMN_NAME_SCORE, + strlen(MRN_COLUMN_NAME_SCORE)); + GRN_TEXT_INIT(&(info->key), 0); + grn_bulk_space(info->ctx, &(info->key), table->key_info->key_length); + GRN_INT32_INIT(&(info->score), 0); + info->active_index = key_nr; + info->key_info = &(table->key_info[key_nr]); + info->primary_key_info = &(table->key_info[table_share->primary_key]); + info->cursor = NULL; + info->id_accessor = NULL; + info->key_accessor = NULL; + + if (key->length() == 0) { + DBUG_RETURN(info); + } + + grn_obj *index_column = grn_index_columns[key_nr]; + grn_obj *match_columns, *match_columns_variable; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->table, match_columns, + match_columns_variable); + + grn_obj *expression, *expression_variable; + GRN_EXPR_CREATE_FOR_QUERY(info->ctx, info->table, + expression, expression_variable); + grn_obj tmp_objects; + GRN_PTR_INIT(&tmp_objects, GRN_OBJ_VECTOR, GRN_ID_NIL); + + grn_rc rc = GRN_SUCCESS; + if (flags & FT_BOOL) { + rc = generic_ft_init_ext_prepare_expression_in_boolean_mode(info, + key, + index_column, + match_columns, + expression, + &tmp_objects); + } else { + rc = generic_ft_init_ext_prepare_expression_in_normal_mode(info, + key, + index_column, + match_columns, + expression, + &tmp_objects); + } + + if (rc == GRN_SUCCESS) { + if (fast_order_limit) { + generic_ft_init_ext_add_conditions_fast_order_limit(info, expression); + } + longlong escalation_threshold = THDVAR(ha_thd(), match_escalation_threshold); + mrn::MatchEscalationThresholdScope scope(info->ctx, escalation_threshold); + grn_table_select(info->ctx, info->table, expression, + info->result, GRN_OP_OR); + } + + grn_obj_unlink(info->ctx, expression); + grn_obj_unlink(info->ctx, match_columns); + + uint n_tmp_objects = GRN_BULK_VSIZE(&tmp_objects) / sizeof(grn_obj *); + for (uint i = 0; i < n_tmp_objects; ++i) { + grn_obj_unlink(info->ctx, GRN_PTR_VALUE_AT(&tmp_objects, i)); + } + grn_obj_unlink(info->ctx, &tmp_objects); + + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::generic_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + + check_count_skip(0, 0, true); + + mrn_change_encoding(ctx, system_charset_info); + grn_operator operation = GRN_OP_AND; + if (!matched_record_keys) { + matched_record_keys = grn_table_create(ctx, NULL, 0, NULL, + GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_WITH_SUBREC, + grn_table, 0); + operation = GRN_OP_OR; + } + + grn_table_sort_key *sort_keys = NULL; + int n_sort_keys = 0; + longlong limit = -1; + check_fast_order_limit(&sort_keys, &n_sort_keys, &limit); + + struct st_mrn_ft_info *info = + generic_ft_init_ext_select(flags, key_nr, key); + + grn_rc rc; + rc = grn_table_setoperation(ctx, matched_record_keys, info->result, + matched_record_keys, operation); + if (rc) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to merge matched record keys: <%s>", + ctx->errbuf); + my_message(ER_ERROR_ON_READ, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + if (fast_order_limit) { + sorted_result = grn_table_create(ctx, NULL, + 0, NULL, + GRN_OBJ_TABLE_NO_KEY, NULL, + matched_record_keys); + grn_table_sort(ctx, matched_record_keys, 0, static_cast(limit), + sorted_result, sort_keys, n_sort_keys); + } + if (sort_keys) { + for (int i = 0; i < n_sort_keys; i++) { + grn_obj_unlink(info->ctx, sort_keys[i].key); + } + free(sort_keys); + } + + DBUG_RETURN((FT_INFO *)info); +} + +FT_INFO *ha_mroonga::wrapper_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; + mrn_ft_info->please = &mrn_wrapper_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_wrapper_ft_vft_ext; +#endif + ++wrap_ft_init_count; + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::storage_ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + FT_INFO *info = generic_ft_init_ext(flags, key_nr, key); + struct st_mrn_ft_info *mrn_ft_info = (struct st_mrn_ft_info *)info; + mrn_ft_info->please = &mrn_storage_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_storage_ft_vft_ext; +#endif + DBUG_RETURN(info); +} + +FT_INFO *ha_mroonga::ft_init_ext(uint flags, uint key_nr, String *key) +{ + MRN_DBUG_ENTER_METHOD(); + fulltext_searching = true; + FT_INFO *info; + if (key_nr == NO_SUCH_KEY) { + struct st_mrn_ft_info *mrn_ft_info = new st_mrn_ft_info(); + mrn_ft_info->please = &mrn_no_such_key_ft_vft; +#ifdef HA_CAN_FULLTEXT_EXT + mrn_ft_info->could_you = &mrn_no_such_key_ft_vft_ext; +#endif + info = (FT_INFO *)mrn_ft_info; + } else { + if (share->wrapper_mode) + { + info = wrapper_ft_init_ext(flags, key_nr, key); + } else { + info = storage_ft_init_ext(flags, key_nr, key); + } + } + DBUG_RETURN(info); +} + +int ha_mroonga::wrapper_ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + if (wrap_ft_init_count) + set_pk_bitmap(); + + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + int error = 0; + do { + grn_id found_record_id; + found_record_id = grn_table_cursor_next(ctx, mrn_ft_info->cursor); + if (found_record_id == GRN_ID_NIL) { + error = HA_ERR_END_OF_FILE; + break; + } + + GRN_BULK_REWIND(&key_buffer); + if (mrn_ft_info->key_accessor) { + grn_obj_get_value(ctx, mrn_ft_info->key_accessor, + found_record_id, &key_buffer); + } else { + void *key; + int key_length; + key_length = grn_table_cursor_get_key(ctx, mrn_ft_info->cursor, &key); + GRN_TEXT_SET(ctx, &key_buffer, key, key_length); + } + error = wrapper_get_record(buf, (const uchar *)GRN_TEXT_VALUE(&key_buffer)); + } while (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + struct st_mrn_ft_info *mrn_ft_info = + reinterpret_cast(ft_handler); + GRN_CTX_SET_ENCODING(ctx, mrn_ft_info->encoding); + + grn_id found_record_id; + found_record_id = grn_table_cursor_next(ctx, mrn_ft_info->cursor); + if (ctx->rc) { + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + + if (found_record_id == GRN_ID_NIL) { + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + table->status = 0; + + if (count_skip && record_id != GRN_ID_NIL) { + DBUG_RETURN(0); + } + + GRN_BULK_REWIND(&key_buffer); + if (mrn_ft_info->id_accessor) { + grn_obj id_buffer; + GRN_RECORD_INIT(&id_buffer, 0, grn_obj_id(ctx, grn_table)); + grn_obj_get_value(ctx, mrn_ft_info->id_accessor, + found_record_id, &id_buffer); + record_id = GRN_RECORD_VALUE(&id_buffer); + } else if (mrn_ft_info->key_accessor) { + grn_obj_get_value(ctx, mrn_ft_info->key_accessor, + found_record_id, &key_buffer); + record_id = grn_table_get(ctx, grn_table, + GRN_TEXT_VALUE(&key_buffer), + GRN_TEXT_LEN(&key_buffer)); + } else { + void *key; + grn_table_cursor_get_key(ctx, mrn_ft_info->cursor, &key); + if (ctx->rc) { + record_id = GRN_ID_NIL; + my_message(ER_ERROR_ON_READ, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } else { + record_id = *((grn_id *)key); + } + } + storage_store_fields(buf, record_id); + DBUG_RETURN(0); +} + +int ha_mroonga::ft_read(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_ft_read(buf); + } else { + error = storage_ft_read(buf); + } + DBUG_RETURN(error); +} + +const Item *ha_mroonga::wrapper_cond_push(const Item *cond) +{ + const Item *reminder_cond; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + reminder_cond = wrap_handler->cond_push(cond); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(reminder_cond); +} + +const Item *ha_mroonga::storage_cond_push(const Item *cond) +{ + MRN_DBUG_ENTER_METHOD(); + const Item *reminder_cond = cond; + if (!pushed_cond) { + mrn::ConditionConverter converter(ctx, grn_table, true); + if (converter.find_match_against(cond) && converter.is_convertable(cond)) { + reminder_cond = NULL; + } + } + DBUG_RETURN(reminder_cond); +} + +const Item *ha_mroonga::cond_push(const Item *cond) +{ + MRN_DBUG_ENTER_METHOD(); + const Item *reminder_cond; + if (share->wrapper_mode) + { + reminder_cond = wrapper_cond_push(cond); + } else { + reminder_cond = storage_cond_push(cond); + } + DBUG_RETURN(reminder_cond); +} + +void ha_mroonga::wrapper_cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->cond_pop(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::cond_pop() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + wrapper_cond_pop(); + else + storage_cond_pop(); + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_get_error_message(int error, String *buf) +{ + bool temporary_error; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + temporary_error = wrap_handler->get_error_message(error, buf); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(temporary_error); +} + +bool ha_mroonga::storage_get_error_message(int error, String *buf) +{ + MRN_DBUG_ENTER_METHOD(); + bool temporary_error = false; + // latest error message + buf->copy(ctx->errbuf, (uint) strlen(ctx->errbuf), system_charset_info); + DBUG_RETURN(temporary_error); +} + +bool ha_mroonga::get_error_message(int error, String *buf) +{ + MRN_DBUG_ENTER_METHOD(); + bool temporary_error; + if (share && share->wrapper_mode) + { + temporary_error = wrapper_get_error_message(error, buf); + } else { + temporary_error = storage_get_error_message(error, buf); + } + DBUG_RETURN(temporary_error); +} + +ulonglong ha_mroonga::file_size(const char *path) +{ + MRN_DBUG_ENTER_METHOD(); + + struct stat file_status; + if (stat(path, &file_status) == 0) { + DBUG_RETURN(file_status.st_size); + } else { + DBUG_RETURN(0); + } +} + +void ha_mroonga::push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag) +{ + char search_name[MRN_BUFFER_SIZE]; + if (flag == HA_READ_MBR_INTERSECT) { + strcpy(search_name, "intersect"); + } else if (flag == HA_READ_MBR_WITHIN) { + strcpy(search_name, "within"); + } else if (flag & HA_READ_MBR_DISJOINT) { + strcpy(search_name, "disjoint"); + } else if (flag & HA_READ_MBR_EQUAL) { + strcpy(search_name, "equal"); + } else { + sprintf(search_name, "unknown: %d", flag); + } + push_warning_printf(ha_thd(), + Sql_condition::WARN_LEVEL_WARN, + ER_UNSUPPORTED_EXTENSION, + "spatial index search " + "except MBRContains aren't supported: <%s>", + search_name); +} + +void ha_mroonga::clear_cursor() +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor) { + grn_obj_unlink(ctx, cursor); + cursor = NULL; + } + if (index_table_cursor) { + grn_table_cursor_close(ctx, index_table_cursor); + index_table_cursor = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_cursor_geo() +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor_geo) { + grn_obj_unlink(ctx, cursor_geo); + cursor_geo = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_empty_value_records() +{ + MRN_DBUG_ENTER_METHOD(); + if (empty_value_records_cursor) { + grn_table_cursor_close(ctx, empty_value_records_cursor); + empty_value_records_cursor = NULL; + } + if (empty_value_records) { + grn_obj_unlink(ctx, empty_value_records); + empty_value_records = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_search_result() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor(); + if (sorted_result) { + grn_obj_unlink(ctx, sorted_result); + sorted_result = NULL; + } + if (matched_record_keys) { + grn_obj_unlink(ctx, matched_record_keys); + matched_record_keys = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_search_result_geo() +{ + MRN_DBUG_ENTER_METHOD(); + clear_cursor_geo(); + if (grn_source_column_geo) { + grn_obj_unlink(ctx, grn_source_column_geo); + grn_source_column_geo = NULL; + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::clear_indexes() +{ + MRN_DBUG_ENTER_METHOD(); + uint n_keys = table->s->keys; + uint pkey_nr = table->s->primary_key; + + for (uint i = 0; i < n_keys; i++) { + if (i != pkey_nr) { + if (grn_index_tables) { + grn_obj_unlink(ctx, grn_index_tables[i]); + } + if (grn_index_columns) { + grn_obj_unlink(ctx, grn_index_columns[i]); + } + } + } + + if (grn_index_tables) { + free(grn_index_tables); + grn_index_tables = NULL; + } + + if (grn_index_columns) { + free(grn_index_columns); + grn_index_columns = NULL; + } + + if (key_id) { + free(key_id); + key_id = NULL; + } + + if (del_key_id) { + free(del_key_id); + del_key_id = NULL; + } + + DBUG_VOID_RETURN; +} + +int ha_mroonga::alter_share_add(const char *path, TABLE_SHARE *table_share) +{ + MRN_DBUG_ENTER_METHOD(); + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), true); + if (!slot_data) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + st_mrn_alter_share *alter_share = + (st_mrn_alter_share *)malloc(sizeof(st_mrn_alter_share)); + if (!alter_share) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + alter_share->next = NULL; + strcpy(alter_share->path, path); + alter_share->alter_share = table_share; + if (slot_data->first_alter_share) + { + st_mrn_alter_share *tmp_alter_share = slot_data->first_alter_share; + while (tmp_alter_share->next) + tmp_alter_share = tmp_alter_share->next; + tmp_alter_share->next = alter_share; + } else { + slot_data->first_alter_share = alter_share; + } + DBUG_RETURN(0); +} + +void ha_mroonga::remove_related_files(const char *base_path) +{ + MRN_DBUG_ENTER_METHOD(); + + const char *base_directory_name = "."; + size_t base_path_length = strlen(base_path); +#ifdef WIN32 + WIN32_FIND_DATA data; + HANDLE finder = FindFirstFile(base_directory_name, &data); + if (finder != INVALID_HANDLE_VALUE) { + do { + if (!(data.dwFileAttributes & FILE_ATTRIBUTE_NORMAL)) { + continue; + } + if (strncmp(data.cFileName, base_path, base_path_length) == 0) { + unlink(data.cFileName); + } + } while (FindNextFile(finder, &data) != 0); + FindClose(finder); + } +#else + DIR *dir = opendir(base_directory_name); + if (dir) { + while (struct dirent *entry = readdir(dir)) { + struct stat file_status; + if (stat(entry->d_name, &file_status) != 0) { + continue; + } + if (!((file_status.st_mode & S_IFMT) && S_IFREG)) { + continue; + } + if (strncmp(entry->d_name, base_path, base_path_length) == 0) { + unlink(entry->d_name); + } + } + closedir(dir); + } +#endif + + DBUG_VOID_RETURN; +} + +void ha_mroonga::remove_grn_obj_force(const char *name) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *obj = grn_ctx_get(ctx, name, strlen(name)); + if (obj) { + grn_obj_remove(ctx, obj); + } else { + grn_obj *db = grn_ctx_db(ctx); + grn_id id = grn_table_get(ctx, db, name, strlen(name)); + if (id) { + char path[MRN_MAX_PATH_SIZE]; + grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); + if (grn_obj_path_by_id(ctx, db, id, path) == GRN_SUCCESS) { + remove_related_files(path); + } + } + } + + DBUG_VOID_RETURN; +} + +int ha_mroonga::drop_index(MRN_SHARE *target_share, uint key_index) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_rc rc = GRN_SUCCESS; + char target_name[GRN_TABLE_MAX_KEY_SIZE]; + int target_name_length; + + KEY *key_info = target_share->table_share->key_info; + if (!target_share->wrapper_mode && target_share->index_table[key_index]) { + const char *table_name = target_share->index_table[key_index]; + snprintf(target_name, GRN_TABLE_MAX_KEY_SIZE, + "%s.%s", table_name, key_info[key_index].name); + grn_obj *index_column = grn_ctx_get(ctx, target_name, strlen(target_name)); + if (index_column) { + rc = grn_obj_remove(ctx, index_column); + } + } else { + mrn::PathMapper mapper(target_share->table_name); + mrn::IndexTableName index_table_name(mapper.table_name(), + key_info[key_index].name); + grn_obj *index_table = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (index_table) { + target_name_length = grn_obj_name(ctx, index_table, + target_name, GRN_TABLE_MAX_KEY_SIZE); + rc = grn_obj_remove(ctx, index_table); + } + } + + if (rc != GRN_SUCCESS) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to drop index: <%.*s>: <%s>", + target_name_length, target_name, + ctx->errbuf); + my_message(ER_ERROR_ON_WRITE, error_message, MYF(0)); + GRN_LOG(ctx, GRN_LOG_ERROR, "%s", error_message); + } + + DBUG_RETURN(error); +} + +grn_obj *ha_mroonga::find_tokenizer(const char *name, int name_length) +{ + MRN_DBUG_ENTER_METHOD(); + + if (strncasecmp("off", name, name_length) == 0) { + DBUG_RETURN(NULL); + } + + grn_obj *tokenizer; + mrn_change_encoding(ctx, system_charset_info); + tokenizer = grn_ctx_get(ctx, name, name_length); + if (!tokenizer) { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "specified fulltext parser <%.*s> doesn't exist. " + "default fulltext parser <%s> is used instead.", + name_length, name, + MRN_PARSER_DEFAULT); + push_warning(ha_thd(), + Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION, + message); + tokenizer = grn_ctx_get(ctx, + MRN_PARSER_DEFAULT, + strlen(MRN_PARSER_DEFAULT)); + } + if (!tokenizer) { + push_warning(ha_thd(), + Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION, + "couldn't find fulltext parser. " + "Bigram fulltext parser is used instead."); + tokenizer = grn_ctx_at(ctx, GRN_DB_BIGRAM); + } + DBUG_RETURN(tokenizer); +} + +grn_obj *ha_mroonga::find_normalizer(KEY *key_info) +{ + MRN_DBUG_ENTER_METHOD(); + grn_obj *normalizer = NULL; +#if MYSQL_VERSION_ID >= 50500 + if (key_info->comment.length > 0) { + mrn::ParametersParser parser(key_info->comment.str, + key_info->comment.length); + parser.parse(); + const char *normalizer_name = parser["normalizer"]; + if (normalizer_name) { + normalizer = grn_ctx_get(ctx, normalizer_name, -1); + } + } +#endif + if (!normalizer) { + Field *field = key_info->key_part[0].field; + mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field); + normalizer = field_normalizer.find_grn_normalizer(); + } + DBUG_RETURN(normalizer); +} + +bool ha_mroonga::find_token_filters(KEY *key_info, grn_obj *token_filters) +{ + MRN_DBUG_ENTER_METHOD(); + bool found = false; +#if MYSQL_VERSION_ID >= 50500 + if (key_info->comment.length > 0) { + mrn::ParametersParser parser(key_info->comment.str, + key_info->comment.length); + parser.parse(); + const char *names = parser["token_filters"]; + if (names) { + found = find_token_filters_fill(token_filters, names, strlen(names)); + } + } +#endif + DBUG_RETURN(found); +} + +bool ha_mroonga::find_token_filters_put(grn_obj *token_filters, + const char *token_filter_name, + int token_filter_name_length) +{ + grn_obj *token_filter; + + token_filter = grn_ctx_get(ctx, + token_filter_name, + token_filter_name_length); + if (token_filter) { + GRN_PTR_PUT(ctx, token_filters, token_filter); + return true; + } else { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "nonexistent token filter: <%.*s>", + token_filter_name_length, token_filter_name); + push_warning(ha_thd(), + Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION, + message); + return false; + } +} + +bool ha_mroonga::find_token_filters_fill(grn_obj *token_filters, + const char *token_filter_names, + int token_filter_names_length) +{ + const char *start, *current, *end; + const char *name_start, *name_end; + const char *last_name_end; + + start = token_filter_names; + end = start + token_filter_names_length; + current = start; + name_start = NULL; + name_end = NULL; + last_name_end = start; + while (current < end) { + switch (current[0]) { + case ' ' : + if (name_start && !name_end) { + name_end = current; + } + break; + case ',' : + if (!name_start) { + goto break_loop; + } + if (!name_end) { + name_end = current; + } + find_token_filters_put(token_filters, + name_start, + name_end - name_start); + last_name_end = name_end + 1; + name_start = NULL; + name_end = NULL; + break; + default : + if (!name_start) { + name_start = current; + } + break; + } + current++; + } + +break_loop: + if (!name_start) { + char message[MRN_BUFFER_SIZE]; + sprintf(message, + "empty token filter name: " + "<%.*s|%.*s|%.*s>", + (int)(last_name_end - start), start, + (int)(current - last_name_end), last_name_end, + (int)(end - current), current); + push_warning(ha_thd(), + Sql_condition::WARN_LEVEL_WARN, ER_UNSUPPORTED_EXTENSION, + message); + return false; + } + + if (!name_end) { + name_end = current; + } + find_token_filters_put(token_filters, + name_start, + name_end - name_start); + + return true; +} + +int ha_mroonga::wrapper_get_record(uchar *buf, const uchar *key) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (wrap_handler->inited == NONE) { +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP + error = wrap_handler->ha_index_read_idx_map(buf, + share->wrap_primary_key, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#else + error = wrap_handler->index_read_idx_map(buf, + share->wrap_primary_key, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#endif + } else { +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + error = wrap_handler->ha_index_read_map(buf, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#else + error = wrap_handler->index_read_map(buf, + key, + pk_keypart_map, + HA_READ_KEY_EXACT); +#endif + } + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_get_next_geo_record(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn_change_encoding(ctx, NULL); + do { + GRN_BULK_REWIND(&key_buffer); + grn_id found_record_id; + grn_posting *posting; + posting = grn_geo_cursor_next(ctx, cursor_geo); + if (!posting) { + error = HA_ERR_END_OF_FILE; + clear_cursor_geo(); + break; + } + found_record_id = posting->rid; + grn_table_get_key(ctx, grn_table, found_record_id, + GRN_TEXT_VALUE(&key_buffer), + table->key_info->key_length); + error = wrapper_get_record(buf, (const uchar *)GRN_TEXT_VALUE(&key_buffer)); + } while (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_get_next_record(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + if (cursor_geo) { + grn_posting *posting; + posting = grn_geo_cursor_next(ctx, cursor_geo); + if (posting) { + record_id = posting->rid; + } else { + record_id = GRN_ID_NIL; + } + } else if (cursor) { + record_id = grn_table_cursor_next(ctx, cursor); + } else if (empty_value_records_cursor) { + grn_id empty_value_record_id; + empty_value_record_id = + grn_table_cursor_next(ctx, empty_value_records_cursor); + if (empty_value_record_id == GRN_ID_NIL) { + record_id = GRN_ID_NIL; + } else { + grn_table_get_key(ctx, empty_value_records, empty_value_record_id, + &record_id, sizeof(grn_id)); + } + } else { + record_id = GRN_ID_NIL; + } + if (ctx->rc) { + int error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + if (record_id == GRN_ID_NIL) { + DBUG_PRINT("info", ("mroonga: storage_get_next_record: end-of-file")); + table->status = STATUS_NOT_FOUND; + DBUG_RETURN(HA_ERR_END_OF_FILE); + } + if (buf) { + if (ignoring_no_key_columns) + storage_store_fields_by_index(buf); + else + storage_store_fields(buf, record_id); + if (cursor_geo && grn_source_column_geo) { + int latitude, longitude; + GRN_GEO_POINT_VALUE(&source_point, latitude, longitude); + double latitude_in_degree = GRN_GEO_MSEC2DEGREE(latitude); + double longitude_in_degree = GRN_GEO_MSEC2DEGREE(longitude); + if (!((bottom_right_latitude_in_degree <= latitude_in_degree && + latitude_in_degree <= top_left_latitude_in_degree) && + (top_left_longitude_in_degree <= longitude_in_degree && + longitude_in_degree <= bottom_right_longitude_in_degree))) { + DBUG_PRINT("info", + ("mroonga: remove not contained geo point: " + "<%g,%g>(<%d,%d>); key: <%g,%g>(<%d,%d>), <%g,%g>(<%d,%d>)", + latitude_in_degree, longitude_in_degree, + latitude, longitude, + top_left_latitude_in_degree, top_left_longitude_in_degree, + GRN_GEO_DEGREE2MSEC(top_left_latitude_in_degree), + GRN_GEO_DEGREE2MSEC(top_left_longitude_in_degree), + bottom_right_latitude_in_degree, + bottom_right_longitude_in_degree, + GRN_GEO_DEGREE2MSEC(bottom_right_latitude_in_degree), + GRN_GEO_DEGREE2MSEC(bottom_right_longitude_in_degree))); + int error = storage_get_next_record(buf); + DBUG_RETURN(error); + } + } + } + table->status = 0; + DBUG_RETURN(0); +} + +void ha_mroonga::geo_store_rectangle(const uchar *rectangle) +{ + MRN_DBUG_ENTER_METHOD(); + + double locations[4]; + for (int i = 0; i < 4; i++) { + uchar reversed_value[8]; + for (int j = 0; j < 8; j++) { + reversed_value[j] = (rectangle + (8 * i))[7 - j]; + } + mi_float8get(locations[i], reversed_value); + } + top_left_longitude_in_degree = locations[0]; + bottom_right_longitude_in_degree = locations[1]; + bottom_right_latitude_in_degree = locations[2]; + top_left_latitude_in_degree = locations[3]; + int top_left_latitude = GRN_GEO_DEGREE2MSEC(top_left_latitude_in_degree); + int top_left_longitude = GRN_GEO_DEGREE2MSEC(top_left_longitude_in_degree); + int bottom_right_latitude = GRN_GEO_DEGREE2MSEC(bottom_right_latitude_in_degree); + int bottom_right_longitude = GRN_GEO_DEGREE2MSEC(bottom_right_longitude_in_degree); + GRN_GEO_POINT_SET(ctx, &top_left_point, + top_left_latitude, top_left_longitude); + GRN_GEO_POINT_SET(ctx, &bottom_right_point, + bottom_right_latitude, bottom_right_longitude); + + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_geo_open_cursor(const uchar *key, + enum ha_rkey_function find_flag) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + int flags = 0; + if (find_flag & HA_READ_MBR_CONTAIN) { + grn_obj *index = grn_index_columns[active_index]; + geo_store_rectangle(key); + cursor_geo = grn_geo_cursor_open_in_rectangle(ctx, + index, + &top_left_point, + &bottom_right_point, + 0, -1); + if (cursor_geo) { + if (grn_source_column_geo) { + grn_obj_unlink(ctx, grn_source_column_geo); + } + grn_obj sources; + GRN_OBJ_INIT(&sources, GRN_BULK, 0, GRN_ID_NIL); + grn_obj_get_info(ctx, index, GRN_INFO_SOURCE, &sources); + grn_source_column_geo = grn_ctx_at(ctx, GRN_RECORD_VALUE(&sources)); + grn_obj_unlink(ctx, &sources); + } + } else { + push_warning_unsupported_spatial_index_search(find_flag); + cursor = grn_table_cursor_open(ctx, grn_table, NULL, 0, NULL, 0, + 0, -1, flags); + } + if (ctx->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::is_dry_write() +{ + MRN_DBUG_ENTER_METHOD(); + bool dry_write_p = THDVAR(ha_thd(), dry_write); + DBUG_RETURN(dry_write_p); +} + +bool ha_mroonga::is_enable_optimization() +{ + MRN_DBUG_ENTER_METHOD(); + bool enable_optimization_p = THDVAR(ha_thd(), enable_optimization); + DBUG_RETURN(enable_optimization_p); +} + +bool ha_mroonga::should_normalize(Field *field) const +{ + MRN_DBUG_ENTER_METHOD(); + mrn::FieldNormalizer field_normalizer(ctx, ha_thd(), field); + bool need_normalize_p = field_normalizer.should_normalize(); + DBUG_RETURN(need_normalize_p); +} + +bool ha_mroonga::is_temporary_table_name(const char *name) const +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: table name = %s", name)); +#ifdef MRN_USE_MYSQL_DATA_HOME + bool temporary_table_name_p = false; + if (name[0] != '.') { + int len = strlen(name); + int mysql_data_home_len = strlen(mysql_data_home); + if (len < mysql_data_home_len || + strncmp(name, mysql_data_home, mysql_data_home_len) || + !strchr(&name[mysql_data_home_len], FN_LIBCHAR)) { + temporary_table_name_p = true; + } + } +#else + bool temporary_table_name_p = (name[0] != '.'); +#endif + DBUG_RETURN(temporary_table_name_p); +} + +void ha_mroonga::check_count_skip(key_part_map start_key_part_map, + key_part_map end_key_part_map, bool fulltext) +{ + MRN_DBUG_ENTER_METHOD(); + + if (!is_enable_optimization()) { + DBUG_PRINT("info", ("mroonga: count skip: optimization is disabled")); + count_skip = false; + DBUG_VOID_RETURN; + } + + st_select_lex *select_lex = table->pos_in_table_list->select_lex; + + if ( + thd_sql_command(ha_thd()) == SQLCOM_SELECT && + !select_lex->non_agg_fields.elements && + !select_lex->group_list.elements && + !select_lex->having && + select_lex->table_list.elements == 1 + ) { + Item *info = (Item *) select_lex->item_list.first_node()->info; + if ( + info->type() != Item::SUM_FUNC_ITEM || + ((Item_sum *) info)->sum_func() != Item_sum::COUNT_FUNC || + ((Item_sum *) info)->nest_level || + ((Item_sum *) info)->aggr_level || + ((Item_sum *) info)->max_arg_level != -1 || + ((Item_sum *) info)->max_sum_func_level != -1 + ) { + DBUG_PRINT("info", ("mroonga: count skip: sum func is not match")); + count_skip = false; + DBUG_VOID_RETURN; + } + + uint i = 0; + Item *where; + if (fulltext) { + DBUG_PRINT("info", ("mroonga: count skip: fulltext")); + where = select_lex->where; + if (!where || + where->type() != Item::FUNC_ITEM || + ((Item_func *)where)->functype() != Item_func::FT_FUNC) { + DBUG_PRINT("info", ("mroonga: count skip: ft func is not match")); + count_skip = false; + DBUG_VOID_RETURN; + } + where = where->next; + if (!where || + where->type() != Item::STRING_ITEM) { + DBUG_PRINT("info", ("mroonga: count skip: string item is not match")); + count_skip = false; + DBUG_VOID_RETURN; + } + for (where = where->next; where; where = where->next) { + if (where->type() != Item::FIELD_ITEM) + break; + DBUG_PRINT("info", ("mroonga: count skip: FIELD_ITEM=%p", where)); + } + if (where != info) { + DBUG_PRINT("info", ("mroonga: count skip: where clause is not match")); + count_skip = false; + DBUG_VOID_RETURN; + } + if (share->wrapper_mode && + !(wrap_handler->ha_table_flags() & HA_NO_TRANSACTIONS)) { + DBUG_PRINT("info", ("mroonga: count skip: transactional wrapper mode")); + count_skip = false; + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("mroonga: count skip: skip enabled")); + count_skip = true; + mrn_count_skip++; + DBUG_VOID_RETURN; + } else if (share->wrapper_mode) { + DBUG_PRINT("info", ("mroonga: count skip: wrapper mode")); + count_skip = false; + DBUG_VOID_RETURN; + } else { + DBUG_PRINT("info", ("mroonga: count skip: without fulltext")); + uint key_nr = active_index; + KEY key_info = table->key_info[key_nr]; + KEY_PART_INFO *key_part = key_info.key_part; + for (where = select_lex->where; where; where = where->next) { + if (where->type() == Item::FIELD_ITEM) + { + Field *field = ((Item_field *)where)->field; + if (!field) + break; + if (field->table != table) + break; + uint j; + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + if (key_part[j].field == field) + { + if (!(start_key_part_map >> j) && !(end_key_part_map >> j)) + j = KEY_N_KEY_PARTS(&key_info); + else + i++; + break; + } + } + if (j >= KEY_N_KEY_PARTS(&key_info)) + break; + } + if (i >= select_lex->select_n_where_fields) + { + DBUG_PRINT("info", ("mroonga: count skip: skip enabled")); + count_skip = true; + mrn_count_skip++; + DBUG_VOID_RETURN; + } + } + DBUG_PRINT("info", ("mroonga: count skip: skip disabled")); + } + } + DBUG_PRINT("info", ("mroonga: count skip: select type is not match")); + count_skip = false; + DBUG_VOID_RETURN; +} + +bool ha_mroonga::is_grn_zero_column_value(grn_obj *column, grn_obj *value) +{ + MRN_DBUG_ENTER_METHOD(); + + if (column->header.type != GRN_COLUMN_FIX_SIZE) { + DBUG_RETURN(false); + } + + char *bytes = GRN_BULK_HEAD(value); + unsigned int size = GRN_BULK_VSIZE(value); + for (unsigned int i = 0; i < size; ++i) { + if (bytes[i] != '\0') { + DBUG_RETURN(false); + } + } + + DBUG_RETURN(true); +} + +void ha_mroonga::check_fast_order_limit(grn_table_sort_key **sort_keys, + int *n_sort_keys, + longlong *limit) +{ + MRN_DBUG_ENTER_METHOD(); + + if (!is_enable_optimization()) { + DBUG_PRINT("info", ("mroonga: fast order limit: optimization is disabled")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + + TABLE_LIST *table_list = table->pos_in_table_list; + st_select_lex *select_lex = table_list->select_lex; + SELECT_LEX_UNIT *unit = table_list->derived; + st_select_lex *first_select_lex; + if (unit) + { + first_select_lex = unit->first_select(); + } else { + first_select_lex = select_lex; + } + DBUG_PRINT("info", + ("mroonga: first_select_lex->options=%llu", + first_select_lex ? first_select_lex->options : 0)); + + if ( + thd_sql_command(ha_thd()) == SQLCOM_SELECT && + !select_lex->with_sum_func && + !select_lex->group_list.elements && + !select_lex->having && + select_lex->table_list.elements == 1 && + select_lex->order_list.elements && + select_lex->explicit_limit && + select_lex->select_limit && + select_lex->select_limit->val_int() > 0 + ) { + if (select_lex->offset_limit) { + *limit = select_lex->offset_limit->val_int(); + } else { + *limit = 0; + } + *limit += select_lex->select_limit->val_int(); + if (*limit > (longlong)INT_MAX) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "too long limit: %lld <= %d is required", + *limit, INT_MAX)); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + if (first_select_lex && (first_select_lex->options & OPTION_FOUND_ROWS)) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "SQL_CALC_FOUND_ROWS is specified")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + Item *where = select_lex->where; + const Item_func *match_against = NULL; + if (where) { + bool is_storage_mode = !(share->wrapper_mode); + mrn::ConditionConverter converter(ctx, grn_table, is_storage_mode); + if (!converter.is_convertable(where)) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "not groonga layer condition search")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + match_against = converter.find_match_against(where); + if (!match_against) { + DBUG_PRINT("info", + ("mroonga: fast_order_limit = false: " + "groonga layer condition but not fulltext search")); + fast_order_limit = false; + DBUG_VOID_RETURN; + } + } + *n_sort_keys = select_lex->order_list.elements; + *sort_keys = (grn_table_sort_key *)malloc(sizeof(grn_table_sort_key) * + *n_sort_keys); + ORDER *order; + int i; + mrn_change_encoding(ctx, system_charset_info); + for (order = (ORDER *) select_lex->order_list.first, i = 0; order; + order = order->next, i++) { + Item *item = *order->item; + if (grn_columns && item->type() == Item::FIELD_ITEM) + { + Field *field = ((Item_field *) (*order->item))->field; + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + + if (should_normalize(field)) + { + DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " + "sort by collated value isn't supported yet.")); + fast_order_limit = false; + free(*sort_keys); + *sort_keys = NULL; + *n_sort_keys = 0; + DBUG_VOID_RETURN; + } + + (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys, + column_name, column_name_size); + } else if (!match_against || match_against->eq(item, true)) { + (*sort_keys)[i].key = grn_obj_column(ctx, matched_record_keys, + MRN_COLUMN_NAME_SCORE, + strlen(MRN_COLUMN_NAME_SCORE)); + } else { + DBUG_PRINT("info", ("mroonga: fast_order_limit = false: " + "sort by computed value isn't supported.")); + fast_order_limit = false; + free(*sort_keys); + *sort_keys = NULL; + *n_sort_keys = 0; + DBUG_VOID_RETURN; + } + (*sort_keys)[i].offset = 0; + if (MRN_ORDER_IS_ASC(order)) + { + (*sort_keys)[i].flags = GRN_TABLE_SORT_ASC; + } else { + (*sort_keys)[i].flags = GRN_TABLE_SORT_DESC; + } + } + DBUG_PRINT("info", ("mroonga: fast_order_limit = true")); + fast_order_limit = true; + mrn_fast_order_limit++; + DBUG_VOID_RETURN; + } + DBUG_PRINT("info", ("mroonga: fast_order_limit = false")); + fast_order_limit = false; + DBUG_VOID_RETURN; +} + +int ha_mroonga::generic_store_bulk_fixed_size_string(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + GRN_TEXT_SET(ctx, buf, field->ptr, field->field_length); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_variable_size_string(Field *field, + grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String value; + field->val_str(NULL, &value); + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + DBUG_PRINT("info", ("mroonga: length=%u", value.length())); + DBUG_PRINT("info", ("mroonga: value=%s", value.c_ptr_safe())); + GRN_TEXT_SET(ctx, buf, value.ptr(), value.length()); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_integer(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long value = field->val_int(); + DBUG_PRINT("info", ("mroonga: value=%lld", value)); + uint32 size = field->pack_length(); + DBUG_PRINT("info", ("mroonga: size=%u", size)); + Field_num *field_num = static_cast(field); + bool is_unsigned = field_num->unsigned_flag; + DBUG_PRINT("info", ("mroonga: is_unsigned=%s", is_unsigned ? "true" : "false")); + switch (size) { + case 1: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT8, 0); + GRN_UINT8_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT8, 0); + GRN_INT8_SET(ctx, buf, value); + } + break; + case 2: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT16, 0); + GRN_UINT16_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT16, 0); + GRN_INT16_SET(ctx, buf, value); + } + break; + case 3: + case 4: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT32, 0); + GRN_UINT32_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT32, 0); + GRN_INT32_SET(ctx, buf, value); + } + break; + case 8: + if (is_unsigned) { + grn_obj_reinit(ctx, buf, GRN_DB_UINT64, 0); + GRN_UINT64_SET(ctx, buf, value); + } else { + grn_obj_reinit(ctx, buf, GRN_DB_INT64, 0); + GRN_INT64_SET(ctx, buf, value); + } + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%u>: " + "available sizes: [1, 2, 3, 4, 8]", + size); + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_unsigned_integer(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long signed_value = field->val_int(); + unsigned long long unsigned_value = *((unsigned long long *)(&signed_value)); + uint32 size = field->pack_length(); + switch (size) { + case 1: + grn_obj_reinit(ctx, buf, GRN_DB_UINT8, 0); + GRN_UINT8_SET(ctx, buf, unsigned_value); + break; + case 2: + grn_obj_reinit(ctx, buf, GRN_DB_UINT16, 0); + GRN_UINT16_SET(ctx, buf, unsigned_value); + break; + case 3: + case 4: + grn_obj_reinit(ctx, buf, GRN_DB_UINT32, 0); + GRN_UINT32_SET(ctx, buf, unsigned_value); + break; + case 8: + grn_obj_reinit(ctx, buf, GRN_DB_UINT64, 0); + GRN_UINT64_SET(ctx, buf, unsigned_value); + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown unsigned integer value size: <%u>: " + "available sizes: [1, 2, 3, 4, 8]", + size); + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_float(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + double value = field->val_real(); + uint32 size = field->pack_length(); + switch (size) { + case 4: + case 8: + grn_obj_reinit(ctx, buf, GRN_DB_FLOAT, 0); + GRN_FLOAT_SET(ctx, buf, value); + break; + default: + // Why!? + error = HA_ERR_UNSUPPORTED; + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown float value size: <%u>: " + "available sizes: [4, 8]", + size); + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, + error, error_message); + break; + } + DBUG_RETURN(error); +} + +long long int ha_mroonga::get_grn_time_from_timestamp_field(Field_timestamp *field) +{ + MRN_DBUG_ENTER_METHOD(); + long long int grn_time = 0; +#ifdef MRN_TIMESTAMP_USE_TIMEVAL + int warnings = 0; + struct timeval time_value; + if (field->get_timestamp(&time_value, &warnings)) { + // XXX: Should we report warnings or MySQL does? + } else { + DBUG_PRINT("info", ("mroonga: timeval tv_sec=%ld", time_value.tv_sec)); + grn_time = GRN_TIME_PACK(time_value.tv_sec, time_value.tv_usec); + } +#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T) + unsigned long int micro_seconds; + my_time_t seconds = field->get_timestamp(µ_seconds); + DBUG_PRINT("info", ("mroonga: my_time_t seconds=%ld", seconds)); + grn_time = GRN_TIME_PACK(seconds, micro_seconds); +#else + my_bool is_null_value; + long seconds = field->get_timestamp(&is_null_value); + DBUG_PRINT("info", ("mroonga: long seconds=%ld", seconds)); + grn_time = GRN_TIME_PACK(seconds, 0); +#endif + DBUG_RETURN(grn_time); +} + +int ha_mroonga::generic_store_bulk_timestamp(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + Field_timestamp *timestamp_field = (Field_timestamp *)field; + long long int time = get_grn_time_from_timestamp_field(timestamp_field); + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_date(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int date_value = field->val_int(); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = date_value / 10000 % 10000 - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = date_value / 100 % 100 - 1; + date.tm_mday = date_value % 100; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_time(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_time *time_field = (Field_time *)field; + MYSQL_TIME mysql_time; + time_field->get_time(&mysql_time); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_datetime(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_datetime *datetime_field = (Field_datetime *)field; + MYSQL_TIME mysql_time; + datetime_field->get_time(&mysql_time); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_year(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + int year; + if (field->field_length == 2) { + year = static_cast(field->val_int() + 2000); + } else { + year = static_cast(field->val_int()); + } + + DBUG_PRINT("info", ("mroonga: year=%d", year)); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = year - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = 0; + date.tm_mday = 1; + + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +int ha_mroonga::generic_store_bulk_datetime2(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_datetimef *datetimef_field = (Field_datetimef *)field; + MYSQL_TIME mysql_time; + datetimef_field->get_time(&mysql_time); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +int ha_mroonga::generic_store_bulk_time2(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + MYSQL_TIME mysql_time; + field->get_time(&mysql_time); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::generic_store_bulk_new_date(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + Field_newdate *newdate_field = (Field_newdate *)field; + MYSQL_TIME mysql_date; + newdate_field->get_time(&mysql_date); + mrn::TimeConverter time_converter; + long long int time = time_converter.mysql_time_to_grn_time(&mysql_date, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + grn_obj_reinit(ctx, buf, GRN_DB_TIME, 0); + GRN_TIME_SET(ctx, buf, time); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_new_decimal(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String value; + Field_new_decimal *new_decimal_field = (Field_new_decimal *)field; + new_decimal_field->val_str(&value, NULL); + grn_obj_reinit(ctx, buf, GRN_DB_SHORT_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value.ptr(), value.length()); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_blob(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + String buffer; + Field_blob *blob = (Field_blob *)field; + const char *value = blob->val_str(0, &buffer)->ptr(); + grn_obj_reinit(ctx, buf, GRN_DB_TEXT, 0); + GRN_TEXT_SET(ctx, buf, value, blob->get_length()); + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk_geometry(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; +#ifdef HAVE_SPATIAL + String buffer; + Field_geom *geometry = (Field_geom *)field; + const char *wkb = geometry->val_str(0, &buffer)->ptr(); + int len = geometry->get_length(); + error = mrn_set_geometry(ctx, buf, wkb, len); +#endif + DBUG_RETURN(error); +} + +int ha_mroonga::generic_store_bulk(Field *field, grn_obj *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + return error; + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + error = generic_store_bulk_integer(field, buf); + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + error = generic_store_bulk_float(field, buf); + break; + case MYSQL_TYPE_NULL: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_TIMESTAMP: + error = generic_store_bulk_timestamp(field, buf); + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + error = generic_store_bulk_integer(field, buf); + break; + case MYSQL_TYPE_DATE: + error = generic_store_bulk_date(field, buf); + break; + case MYSQL_TYPE_TIME: + error = generic_store_bulk_time(field, buf); + break; + case MYSQL_TYPE_DATETIME: + error = generic_store_bulk_datetime(field, buf); + break; + case MYSQL_TYPE_YEAR: + error = generic_store_bulk_year(field, buf); + break; + case MYSQL_TYPE_NEWDATE: + error = generic_store_bulk_new_date(field, buf); + break; + case MYSQL_TYPE_VARCHAR: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_BIT: + error = generic_store_bulk_unsigned_integer(field, buf); + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + error = generic_store_bulk_timestamp(field, buf); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + error = generic_store_bulk_datetime2(field, buf); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + error = generic_store_bulk_time2(field, buf); + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + error = generic_store_bulk_new_decimal(field, buf); + break; + case MYSQL_TYPE_ENUM: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_SET: + error = generic_store_bulk_unsigned_integer(field, buf); + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + error = generic_store_bulk_blob(field, buf); + break; + case MYSQL_TYPE_VAR_STRING: + error = generic_store_bulk_variable_size_string(field, buf); + break; + case MYSQL_TYPE_STRING: + error = generic_store_bulk_fixed_size_string(field, buf); + break; + case MYSQL_TYPE_GEOMETRY: + error = generic_store_bulk_geometry(field, buf); + break; + default: + error = HA_ERR_UNSUPPORTED; + break; + } + DBUG_RETURN(error); +} + +void ha_mroonga::storage_store_field_string(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + field->store(value, value_length, field->charset()); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_integer(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_num *field_num = static_cast(field); + bool is_unsigned = field_num->unsigned_flag; + switch (value_length) { + case 1: + { + if (is_unsigned) { + unsigned char field_value; + field_value = *((unsigned char *)value); + field->store(field_value, is_unsigned); + } else { + signed char field_value; + field_value = *((signed char *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 2: + { + if (is_unsigned) { + unsigned short field_value; + field_value = *((unsigned short *)value); + field->store(field_value, is_unsigned); + } else { + short field_value; + field_value = *((short *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 4: + { + if (is_unsigned) { + unsigned int field_value; + field_value = *((unsigned int *)value); + field->store(field_value, is_unsigned); + } else { + int field_value; + field_value = *((int *)value); + field->store(field_value, is_unsigned); + } + break; + } + case 8: + { + if (is_unsigned) { + unsigned long long int field_value; + field_value = *((unsigned long long int *)value); + DBUG_PRINT("info", ("mroonga: field_value=%llu", field_value)); + field->store(field_value, is_unsigned); + } else { + long long int field_value; + field_value = *((long long int *)value); + field->store(field_value, is_unsigned); + } + break; + } + default: + { + // Why!? + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%d>: " + "available sizes: [1, 2, 4, 8]", + value_length); + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, error_message); + storage_store_field_string(field, value, value_length); + break; + } + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_unsigned_integer(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + switch (value_length) { + case 1: + { + unsigned char field_value; + field_value = *((unsigned char *)value); + field->store(field_value, true); + break; + } + case 2: + { + unsigned short field_value; + field_value = *((unsigned short *)value); + field->store(field_value, true); + break; + } + case 4: + { + unsigned int field_value; + field_value = *((unsigned int *)value); + field->store(field_value, true); + break; + } + case 8: + { + unsigned long long int field_value; + field_value = *((unsigned long long int *)value); + DBUG_PRINT("info", ("mroonga: field_value=%llu", field_value)); + field->store(field_value, true); + break; + } + default: + { + // Why!? + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "unknown integer value size: <%d>: " + "available sizes: [1, 2, 4, 8]", + value_length); + push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, error_message); + storage_store_field_string(field, value, value_length); + break; + } + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_float(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + double field_value; + field_value = *((double *)value); + field->store(field_value); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_timestamp(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + Field_timestamp *timestamp_field = (Field_timestamp *)field; +#ifdef MRN_TIMESTAMP_USE_TIMEVAL + struct timeval time_value; + GRN_TIME_UNPACK(time, time_value.tv_sec, time_value.tv_usec); + timestamp_field->store_timestamp(&time_value); +#elif defined(MRN_TIMESTAMP_USE_MY_TIME_T) + long long int sec, usec; + GRN_TIME_UNPACK(time, sec, usec); + timestamp_field->store_TIME(static_cast(sec), + static_cast(usec)); +#else + int32 sec, usec __attribute__((unused)); + GRN_TIME_UNPACK(time, sec, usec); + timestamp_field->store_timestamp(sec); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_date(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + long long int sec, usec __attribute__((unused)); + GRN_TIME_UNPACK(time, sec, usec); + struct tm date; + time_t sec_t = static_cast(sec); + gmtime_r(&sec_t, &date); + long long int date_in_mysql = + (date.tm_year + mrn::TimeConverter::TM_YEAR_BASE) * 10000 + + (date.tm_mon + 1) * 100 + + date.tm_mday; + field->store(date_in_mysql, false); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_time(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_time *time_field = (Field_time *)field; + time_field->store_time(&mysql_time, mysql_time.time_type); +#else + field->store_time(&mysql_time); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_datetime(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_datetime; + memset(&mysql_datetime, 0, sizeof(MYSQL_TIME)); + mysql_datetime.time_type = MYSQL_TIMESTAMP_DATETIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_datetime); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_datetime *datetime_field = (Field_datetime *)field; + datetime_field->store_time(&mysql_datetime, mysql_datetime.time_type); +#else + field->store_time(&mysql_datetime); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_year(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_DATE; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); + DBUG_PRINT("info", ("mroonga: stored %d", mysql_time.year)); + field->store(mysql_time.year, false); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_new_date(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_date; + memset(&mysql_date, 0, sizeof(MYSQL_TIME)); + mysql_date.time_type = MYSQL_TIMESTAMP_DATE; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_date); +#ifdef MRN_FIELD_STORE_TIME_NEED_TYPE + Field_newdate *newdate_field = (Field_newdate *)field; + newdate_field->store_time(&mysql_date, MYSQL_TIMESTAMP_DATE); +#else + field->store_time(&mysql_date); +#endif + DBUG_VOID_RETURN; +} + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +void ha_mroonga::storage_store_field_datetime2(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + MYSQL_TIME mysql_datetime; + memset(&mysql_datetime, 0, sizeof(MYSQL_TIME)); + mysql_datetime.time_type = MYSQL_TIMESTAMP_DATETIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_datetime); + field->store_time(&mysql_datetime); + DBUG_VOID_RETURN; +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +void ha_mroonga::storage_store_field_time2(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + long long int time = *((long long int *)value); + + MYSQL_TIME mysql_time; + memset(&mysql_time, 0, sizeof(MYSQL_TIME)); + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + mrn::TimeConverter time_converter; + time_converter.grn_time_to_mysql_time(time, &mysql_time); + field->store_time(&mysql_time); + DBUG_VOID_RETURN; +} +#endif + +void ha_mroonga::storage_store_field_blob(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); + Field_blob *blob = (Field_blob *)field; + String *blob_buffer = &blob_buffers[field->field_index]; + blob_buffer->length(0); + blob_buffer->reserve(value_length); + blob_buffer->q_append(value, value_length); + blob->set_ptr((uint32) value_length, (uchar *) blob_buffer->ptr()); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field_geometry(Field *field, + const char *value, + uint value_length) +{ + MRN_DBUG_ENTER_METHOD(); +#ifdef HAVE_SPATIAL + uchar wkb[SRID_SIZE + WKB_HEADER_SIZE + POINT_DATA_SIZE]; + grn_geo_point *field_value = (grn_geo_point *)value; + int latitude, longitude; + latitude = field_value->latitude; + longitude = field_value->longitude; + if (grn_source_column_geo) { + GRN_GEO_POINT_SET(ctx, &source_point, latitude, longitude); + } + memset(wkb, 0, SRID_SIZE); + memset(wkb + SRID_SIZE, Geometry::wkb_ndr, 1); // wkb_ndr is meaningless. + int4store(wkb + SRID_SIZE + 1, Geometry::wkb_point); + double latitude_in_degree, longitude_in_degree; + latitude_in_degree = GRN_GEO_MSEC2DEGREE(latitude); + longitude_in_degree = GRN_GEO_MSEC2DEGREE(longitude); + float8store(wkb + SRID_SIZE + WKB_HEADER_SIZE, + longitude_in_degree); + float8store(wkb + SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE, + latitude_in_degree); + String *geometry_buffer = &blob_buffers[field->field_index]; + geometry_buffer->length(0); + uint wkb_length = sizeof(wkb) / sizeof(*wkb); + Field_geom *geometry = (Field_geom *)field; + geometry_buffer->reserve(wkb_length); + geometry_buffer->q_append((const char *) wkb, wkb_length); + geometry->set_ptr((uint32) wkb_length, (uchar *) geometry_buffer->ptr()); +#endif + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_field(Field *field, + const char *value, uint value_length) +{ + field->set_notnull(); + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + storage_store_field_integer(field, value, value_length); + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + storage_store_field_float(field, value, value_length); + break; + case MYSQL_TYPE_NULL: + storage_store_field_unsigned_integer(field, value, value_length); + break; + case MYSQL_TYPE_TIMESTAMP: + storage_store_field_timestamp(field, value, value_length); + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + storage_store_field_integer(field, value, value_length); + break; + case MYSQL_TYPE_DATE: + storage_store_field_date(field, value, value_length); + break; + case MYSQL_TYPE_TIME: + storage_store_field_time(field, value, value_length); + break; + case MYSQL_TYPE_DATETIME: + storage_store_field_datetime(field, value, value_length); + break; + case MYSQL_TYPE_YEAR: + storage_store_field_year(field, value, value_length); + break; + case MYSQL_TYPE_NEWDATE: + storage_store_field_new_date(field, value, value_length); + break; + case MYSQL_TYPE_VARCHAR: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_BIT: + storage_store_field_unsigned_integer(field, value, value_length); + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + storage_store_field_timestamp(field, value, value_length); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + storage_store_field_datetime2(field, value, value_length); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + storage_store_field_time2(field, value, value_length); + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + storage_store_field_unsigned_integer(field, value, value_length); + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + storage_store_field_blob(field, value, value_length); + break; + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + storage_store_field_string(field, value, value_length); + break; + case MYSQL_TYPE_GEOMETRY: + storage_store_field_geometry(field, value, value_length); + break; + } +} + +void ha_mroonga::storage_store_field_column(Field *field, + int nth_column, grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + + grn_obj *column = grn_columns[nth_column]; + grn_id range_id = grn_obj_get_range(ctx, column); + grn_obj *range = grn_column_ranges[nth_column]; + grn_obj *value = &new_value_buffer; + + if (mrn::grn::is_table(range)) { + if (mrn::grn::is_vector_column(column)) { + grn_obj_reinit(ctx, value, range_id, GRN_OBJ_VECTOR); + grn_obj_get_value(ctx, column, record_id, value); + + // TODO: Check whether reference type or not + grn_obj unvectored_value; + GRN_TEXT_INIT(&unvectored_value, 0); + int n_ids = GRN_BULK_VSIZE(value) / sizeof(grn_id); + for (int i = 0; i < n_ids; i++) { + grn_id id = GRN_RECORD_VALUE_AT(value, i); + if (i > 0) { + GRN_TEXT_PUTS(ctx, &unvectored_value, mrn_vector_column_delimiter); + } + char key[GRN_TABLE_MAX_KEY_SIZE]; + int key_length; + key_length = grn_table_get_key(ctx, range, id, + &key, GRN_TABLE_MAX_KEY_SIZE); + GRN_TEXT_PUT(ctx, &unvectored_value, key, key_length); + } + storage_store_field(field, + GRN_TEXT_VALUE(&unvectored_value), + GRN_TEXT_LEN(&unvectored_value)); + GRN_OBJ_FIN(ctx, &unvectored_value); + } else { + grn_obj_reinit(ctx, value, range_id, 0); + grn_obj_get_value(ctx, column, record_id, value); + + grn_id id = GRN_RECORD_VALUE(value); + char key[GRN_TABLE_MAX_KEY_SIZE]; + int key_length; + key_length = grn_table_get_key(ctx, range, id, + &key, GRN_TABLE_MAX_KEY_SIZE); + storage_store_field(field, key, key_length); + } + } else { + grn_obj_reinit(ctx, value, range_id, 0); + grn_obj_get_value(ctx, column, record_id, value); + storage_store_field(field, GRN_BULK_HEAD(value), GRN_BULK_VSIZE(value)); + } + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_fields(uchar *buf, grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: stored record ID: %d", record_id)); + + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(buf, table->record[0]); + + Field *primary_key_field = NULL; + if (grn_table_is_referenced && table->s->primary_key != MAX_INDEXES) { + KEY *key_info = &(table->s->key_info[table->s->primary_key]); + primary_key_field = key_info->key_part[0].field; + } + + int i; + int n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + + if (bitmap_is_set(table->read_set, field->field_index) || + bitmap_is_set(table->write_set, field->field_index)) { + const char *column_name = field->field_name; + + if (ignoring_no_key_columns) { + KEY key_info = table->s->key_info[active_index]; + if (strcmp(key_info.key_part[0].field->field_name, column_name)) { + continue; + } + } + + mrn::DebugColumnAccess debug_column_access(table, table->write_set); + DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index)); + field->move_field_offset(ptr_diff); + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + // for _id column + field->set_notnull(); + field->store((int)record_id); + } else if (primary_key_field && + strcmp(primary_key_field->field_name, column_name) == 0) { + // for primary key column + char key[GRN_TABLE_MAX_KEY_SIZE]; + int key_length; + key_length = grn_table_get_key(ctx, grn_table, record_id, + &key, GRN_TABLE_MAX_KEY_SIZE); + storage_store_field(field, key, key_length); + } else { + storage_store_field_column(field, i ,record_id); + } + field->move_field_offset(-ptr_diff); + } + } + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_fields_for_prep_update(const uchar *old_data, + uchar *new_data, + grn_id record_id) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: stored record ID: %d", record_id)); + my_ptrdiff_t ptr_diff_old = PTR_BYTE_DIFF(old_data, table->record[0]); + my_ptrdiff_t ptr_diff_new = 0; +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + if (!written_by_row_based_binlog) { + if (check_written_by_row_based_binlog()) { + written_by_row_based_binlog = 2; + } else { + written_by_row_based_binlog = 1; + } + } + bool need_all_columns = + (new_data && written_by_row_based_binlog == 2); +#endif + if (new_data) { + ptr_diff_new = PTR_BYTE_DIFF(new_data, table->record[0]); + } + int i; + int n_columns = table->s->fields; + for (i = 0; i < n_columns; i++) { + Field *field = table->field[i]; + + if ( + !bitmap_is_set(table->read_set, field->field_index) && + !bitmap_is_set(table->write_set, field->field_index) && +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + ( + need_all_columns || +#endif + bitmap_is_set(&multiple_column_key_bitmap, field->field_index) +#ifdef MRN_RBR_UPDATE_NEED_ALL_COLUMNS + ) +#endif + ) { + mrn::DebugColumnAccess debug_column_access(table, table->write_set); + DBUG_PRINT("info", ("mroonga: store column %d(%d)",i,field->field_index)); + grn_obj value; + GRN_OBJ_INIT(&value, GRN_BULK, 0, grn_obj_get_range(ctx, grn_columns[i])); + grn_obj_get_value(ctx, grn_columns[i], record_id, &value); + // old column + field->move_field_offset(ptr_diff_old); + storage_store_field(field, GRN_BULK_HEAD(&value), GRN_BULK_VSIZE(&value)); + field->move_field_offset(-ptr_diff_old); + if (new_data) { + // new column + field->move_field_offset(ptr_diff_new); + storage_store_field(field, GRN_BULK_HEAD(&value), GRN_BULK_VSIZE(&value)); + field->move_field_offset(-ptr_diff_new); + } + GRN_OBJ_FIN(ctx, &value); + } + } + + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_store_fields_by_index(uchar *buf) +{ + MRN_DBUG_ENTER_METHOD(); + uint key_length; + void *key; + KEY *key_info = &table->key_info[active_index]; + if (table->s->primary_key == active_index) + key_length = grn_table_cursor_get_key(ctx, cursor, &key); + else + key_length = grn_table_cursor_get_key(ctx, index_table_cursor, &key); + + if (KEY_N_KEY_PARTS(key_info) == 1) { + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(buf, table->record[0]); + Field *field = key_info->key_part->field; + mrn::DebugColumnAccess debug_column_access(table, table->write_set); + field->move_field_offset(ptr_diff); + storage_store_field(field, (const char *)key, key_length); + field->move_field_offset(-ptr_diff); + } else { + uchar enc_buf[MAX_KEY_LENGTH]; + uint enc_len; + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + codec.decode(static_cast(key), key_length, enc_buf, &enc_len); + key_restore(buf, enc_buf, key_info, enc_len); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::storage_encode_key_normalize_min_sort_chars(Field *field, + uchar *buf, + uint size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (size == 0) { + DBUG_RETURN(0); + } + if (!field->has_charset()) { + DBUG_RETURN(0); + } + + uint16 raw_min_sort_char = + static_cast(field->sort_charset()->min_sort_char); + if (raw_min_sort_char <= UINT_MAX8) { + uchar min_sort_char = static_cast(raw_min_sort_char); + for (uint i = size - 1; i > 0; --i) { + if (buf[i] != min_sort_char) { + break; + } + buf[i] = '\0'; + } + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_fixed_size_string(Field *field, + const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + memcpy(buf, key, field->field_length); + *size = field->field_length; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_variable_size_string(Field *field, + const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + *size = uint2korr(key); + memcpy(buf, key + HA_KEY_BLOB_LENGTH, *size); + storage_encode_key_normalize_min_sort_chars(field, buf, *size); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_timestamp(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int time; + MYSQL_TIME mysql_time; +#ifdef MRN_MARIADB_P + if (field->decimals() == 0) { + my_time_t my_time = sint4korr(key); + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, my_time); + mysql_time.second_part = 0; + } else { + Field_timestamp_hires *timestamp_hires_field = + (Field_timestamp_hires *)field; + uint fuzzy_date = 0; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + TABLE *table_backup = field->table; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + field->table = table; + timestamp_hires_field->get_date(&mysql_time, fuzzy_date); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + field->table = table_backup; + } +#else + my_time_t my_time = uint4korr(key); + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, my_time); +#endif + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_time(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + long long int time; +#ifdef MRN_MARIADB_P + MYSQL_TIME mysql_time; + bool truncated = false; + if (field->decimals() == 0) { + long long int packed_time = sint3korr(key); + mysql_time.neg = false; + if (packed_time < 0) { + mysql_time.neg = true; + packed_time = -packed_time; + } + mysql_time.year = 0; + mysql_time.month = 0; + mysql_time.day = 0; + mysql_time.hour = (int)(packed_time / 10000); + long long int minute_part = packed_time - mysql_time.hour * 10000; + mysql_time.minute = (int)(minute_part / 100); + mysql_time.second = (int)(minute_part % 100); + mysql_time.second_part = 0; + mysql_time.time_type = MYSQL_TIMESTAMP_TIME; + } else { + Field_time_hires *time_hires_field = (Field_time_hires *)field; + uint fuzzy_date = 0; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + time_hires_field->get_date(&mysql_time, fuzzy_date); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + } + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } +#else + int mysql_time = (int)sint3korr(key); + int sec = + mysql_time / 10000 * 60 * 60 + + mysql_time / 100 % 100 * 60 + + mysql_time % 60; + int usec = 0; + time = GRN_TIME_PACK(sec, usec); +#endif + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_year(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + int year = (int)key[0]; + + struct tm datetime; + memset(&datetime, 0, sizeof(struct tm)); + datetime.tm_year = year; + datetime.tm_mon = 0; + datetime.tm_mday = 1; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&datetime, usec, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_datetime(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + long long int time; +#ifdef MRN_MARIADB_P + if (field->decimals() > 0) { + Field_datetime_hires *datetime_hires_field = (Field_datetime_hires *)field; + MYSQL_TIME mysql_time; + uint fuzzy_date = 0; + uchar *ptr_backup = field->ptr; + uchar *null_ptr_backup = field->null_ptr; + field->ptr = (uchar *)key; + field->null_ptr = (uchar *)(key - 1); + datetime_hires_field->get_date(&mysql_time, fuzzy_date); + field->ptr = ptr_backup; + field->null_ptr = null_ptr_backup; + mrn::TimeConverter time_converter; + time = time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + } else +#endif + { + long long int encoded_datetime = sint8korr(key); + uint32 part1 = (uint32)(encoded_datetime / 1000000LL); + uint32 part2 = (uint32)(encoded_datetime - + (unsigned long long int)part1 * 1000000LL); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = part1 / 10000 - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = part1 / 100 % 100 - 1; + date.tm_mday = part1 % 100; + date.tm_hour = part2 / 10000; + date.tm_min = part2 / 100 % 100; + date.tm_sec = part2 % 100; + int usec = 0; + mrn::TimeConverter time_converter; + time = time_converter.tm_to_grn_time(&date, usec, &truncated); + } + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &time, 8); + *size = 8; + DBUG_RETURN(error); +} + +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 +int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_timestampf *timestamp2_field = (Field_timestampf *)field; + struct timeval tm; + my_timestamp_from_binary(&tm, key, timestamp2_field->decimals()); + MYSQL_TIME mysql_time; + mrn_my_tz_UTC->gmt_sec_to_TIME(&mysql_time, (my_time_t)tm.tv_sec); + mysql_time.second_part = tm.tv_usec; + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 +int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_datetimef *datetime2_field = (Field_datetimef *)field; + longlong packed_time = + my_datetime_packed_from_binary(key, datetime2_field->decimals()); + MYSQL_TIME mysql_time; + TIME_from_longlong_datetime_packed(&mysql_time, packed_time); + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 +int ha_mroonga::storage_encode_key_time2(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + bool truncated = false; + + Field_timef *time2_field = (Field_timef *)field; + longlong packed_time = + my_time_packed_from_binary(key, time2_field->decimals()); + MYSQL_TIME mysql_time; + TIME_from_longlong_time_packed(&mysql_time, packed_time); + mrn::TimeConverter time_converter; + long long int grn_time = time_converter.mysql_time_to_grn_time(&mysql_time, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &grn_time, 8); + *size = 8; + + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::storage_encode_key_enum(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (field->pack_length() == 1) { + uchar value; + value = key[0]; + *size = 1; + memcpy(buf, &value, *size); + } else { + uint16 value; + shortget(value, key); + *size = 2; + memcpy(buf, &value, *size); + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key_set(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + Field_set unpacker((uchar *)key, field->field_length, (uchar *)(key - 1), + field->null_bit, field->unireg_check, field->field_name, + field->pack_length(), + static_cast(field)->typelib, + static_cast(field)->charset()); + switch (field->pack_length()) { + case 1: + { + int8 signed_value = (int8)(unpacker.val_int()); + uint8 unsigned_value = *((uint8 *)&signed_value); + *size = 1; + memcpy(buf, &unsigned_value, *size); + } + break; + case 2: + { + int16 signed_value = (int16)(unpacker.val_int()); + uint16 unsigned_value = *((uint16 *)&signed_value); + *size = 2; + memcpy(buf, &unsigned_value, *size); + } + break; + case 3: + case 4: + { + int32 signed_value = (int32)(unpacker.val_int()); + uint32 unsigned_value = *((uint32 *)&signed_value); + *size = 4; + memcpy(buf, &unsigned_value, *size); + } + break; + case 8: + default: + { + int64 signed_value = (int64)(unpacker.val_int()); + uint64 unsigned_value = *((uint64 *)&signed_value); + *size = 8; + memcpy(buf, &unsigned_value, *size); + } + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_key(Field *field, const uchar *key, + uchar *buf, uint *size) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + bool truncated = false; + const uchar *ptr = key; + + error = mrn_change_encoding(ctx, field->charset()); + if (error) + DBUG_RETURN(error); + + if (field->null_bit) { + ptr += 1; + } + + switch (field->real_type()) { + case MYSQL_TYPE_BIT: + case MYSQL_TYPE_TINY: + { + memcpy(buf, ptr, 1); + *size = 1; + break; + } + case MYSQL_TYPE_SHORT: + { + memcpy(buf, ptr, 2); + *size = 2; + break; + } + case MYSQL_TYPE_INT24: + { + memcpy(buf, ptr, 3); + buf[3] = 0; + *size = 4; + break; + } + case MYSQL_TYPE_LONG: + { + memcpy(buf, ptr, 4); + *size = 4; + break; + } + case MYSQL_TYPE_TIMESTAMP: + error = storage_encode_key_timestamp(field, ptr, buf, size); + break; + case MYSQL_TYPE_LONGLONG: + { + memcpy(buf, ptr, 8); + *size = 8; + break; + } + case MYSQL_TYPE_FLOAT: + { + float float_value; + double double_value; + float4get(float_value, ptr); + double_value = float_value; + memcpy(buf, &double_value, 8); + *size = 8; + break; + } + case MYSQL_TYPE_DOUBLE: + { + double val; + float8get(val, ptr); + memcpy(buf, &val, 8); + *size = 8; + break; + } + case MYSQL_TYPE_TIME: + error = storage_encode_key_time(field, ptr, buf, size); + break; + case MYSQL_TYPE_YEAR: + error = storage_encode_key_year(field, ptr, buf, size); + break; + case MYSQL_TYPE_DATETIME: + error = storage_encode_key_datetime(field, ptr, buf, size); + break; + case MYSQL_TYPE_NEWDATE: + { + uint32 encoded_date = uint3korr(ptr); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = encoded_date / (16 * 32) - mrn::TimeConverter::TM_YEAR_BASE; + date.tm_mon = encoded_date / 32 % 16 - 1; + date.tm_mday = encoded_date % 32; + int usec = 0; + mrn::TimeConverter time_converter; + long long int time = time_converter.tm_to_grn_time(&date, usec, + &truncated); + if (truncated) { + field->set_warning(Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, 1); + } + memcpy(buf, &time, 8); + *size = 8; + break; + } +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + error = storage_encode_key_timestamp2(field, ptr, buf, size); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + error = storage_encode_key_datetime2(field, ptr, buf, size); + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + error = storage_encode_key_time2(field, ptr, buf, size); + break; +#endif + case MYSQL_TYPE_STRING: + error = storage_encode_key_fixed_size_string(field, ptr, buf, size); + break; + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_BLOB: + error = storage_encode_key_variable_size_string(field, ptr, buf, size); + break; + case MYSQL_TYPE_ENUM: + error = storage_encode_key_enum(field, ptr, buf, size); + break; + case MYSQL_TYPE_SET: + error = storage_encode_key_set(field, ptr, buf, size); + break; + default: + error = HA_ERR_UNSUPPORTED; + break; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_multiple_column_key(KEY *key_info, + const uchar *key, + uint key_length, + uchar *buffer, + uint *encoded_length) +{ + MRN_DBUG_ENTER_METHOD(); + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + int error = codec.encode(key, key_length, buffer, encoded_length); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_encode_multiple_column_key_range(KEY *key_info, + const key_range *start, + const key_range *end, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + mrn::MultipleColumnKeyCodec codec(ctx, ha_thd(), key_info); + uint encoded_key_size = codec.size(); + if (start) { + memset(min_buffer, 0, encoded_key_size); + error = codec.encode(start->key, start->length, + min_buffer, min_encoded_size); + // TODO: handle error? + *min_encoded_size = encoded_key_size; + } + if (end) { + memset(max_buffer, 0xff, encoded_key_size); + error = codec.encode(end->key, end->length, + max_buffer, max_encoded_size); + // TODO: handle error? + *max_encoded_size = encoded_key_size; + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (thd_sql_command(ha_thd()) == SQLCOM_SELECT) { + st_select_lex *select_lex = table->pos_in_table_list->select_lex; + List_iterator iterator(*(select_lex->ftfunc_list)); + Item_func_match *item; + while ((item = iterator++)) { + if (item->ft_handler) { + mrn_generic_ft_clear(item->ft_handler); + } + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_reset(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + if (alter_key_info_buffer) { + my_free(alter_key_info_buffer, MYF(0)); + alter_key_info_buffer = NULL; + } +#else + if (wrap_alter_key_info) { + my_free(wrap_alter_key_info, MYF(0)); + wrap_alter_key_info = NULL; + } +#endif + wrap_ft_init_count = 0; + int generic_error = generic_reset(); + if (error == 0) { + error = generic_error; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_reset() +{ + MRN_DBUG_ENTER_METHOD(); + int error; + error = generic_reset(); + DBUG_RETURN(error); +} + +int ha_mroonga::reset() +{ + int error = 0; + THD *thd = ha_thd(); + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: this=%p", this)); + clear_empty_value_records(); + clear_search_result(); + clear_search_result_geo(); + if (share->wrapper_mode) + error = wrapper_reset(); + else + error = storage_reset(); + ignoring_no_key_columns = false; + inserting_with_update = false; + ignoring_duplicated_key = false; + fulltext_searching = false; + replacing_ = false; + written_by_row_based_binlog = 0; + mrn_lock_type = F_UNLCK; + mrn_clear_alter_share(thd); + current_ft_item = NULL; + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_CLONE_NEED_NAME +handler *ha_mroonga::wrapper_clone(const char *name, MEM_ROOT *mem_root) +{ + handler *cloned_handler; + MRN_DBUG_ENTER_METHOD(); + if (!(cloned_handler = get_new_handler(table->s, mem_root, + table->s->db_type()))) + DBUG_RETURN(NULL); + ((ha_mroonga *) cloned_handler)->is_clone = true; + ((ha_mroonga *) cloned_handler)->parent_for_clone = this; + ((ha_mroonga *) cloned_handler)->mem_root_for_clone = mem_root; + if (cloned_handler->ha_open(table, table->s->normalized_path.str, + table->db_stat, HA_OPEN_IGNORE_IF_LOCKED)) + { + delete cloned_handler; + DBUG_RETURN(NULL); + } + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::storage_clone(const char *name, MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + cloned_handler = handler::clone(name, mem_root); + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::clone(const char *name, MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + if (share->wrapper_mode) + { + cloned_handler = wrapper_clone(name, mem_root); + } else { + cloned_handler = storage_clone(name, mem_root); + } + DBUG_RETURN(cloned_handler); +} +#else +handler *ha_mroonga::wrapper_clone(MEM_ROOT *mem_root) +{ + handler *cloned_handler; + MRN_DBUG_ENTER_METHOD(); + if (!(cloned_handler = get_new_handler(table->s, mem_root, + table->s->db_type()))) + DBUG_RETURN(NULL); + ((ha_mroonga *) cloned_handler)->is_clone = true; + ((ha_mroonga *) cloned_handler)->parent_for_clone = this; + ((ha_mroonga *) cloned_handler)->mem_root_for_clone = mem_root; + if (cloned_handler->ha_open(table, table->s->normalized_path.str, + table->db_stat, HA_OPEN_IGNORE_IF_LOCKED)) + { + delete cloned_handler; + DBUG_RETURN(NULL); + } + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::storage_clone(MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + cloned_handler = handler::clone(mem_root); + DBUG_RETURN(cloned_handler); +} + +handler *ha_mroonga::clone(MEM_ROOT *mem_root) +{ + MRN_DBUG_ENTER_METHOD(); + handler *cloned_handler; + if (share->wrapper_mode) + { + cloned_handler = wrapper_clone(mem_root); + } else { + cloned_handler = storage_clone(mem_root); + } + DBUG_RETURN(cloned_handler); +} +#endif + +uint8 ha_mroonga::wrapper_table_cache_type() +{ + uint8 res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->table_cache_type(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +uint8 ha_mroonga::storage_table_cache_type() +{ + MRN_DBUG_ENTER_METHOD(); + uint8 type = handler::table_cache_type(); + DBUG_RETURN(type); +} + +uint8 ha_mroonga::table_cache_type() +{ + MRN_DBUG_ENTER_METHOD(); + uint8 type; + if (share->wrapper_mode) + { + type = wrapper_table_cache_type(); + } else { + type = storage_table_cache_type(); + } + DBUG_RETURN(type); +} + +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ +ha_rows ha_mroonga::wrapper_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + KEY key_info = table->key_info[keyno]; + if (mrn_is_geo_key(&key_info)) { + rows = handler::multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, flags, cost); + DBUG_RETURN(rows); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + rows = wrap_handler->multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, flags, + cost); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::storage_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::multi_range_read_info_const(keyno, seq, + seq_init_param, + n_ranges, bufsz, flags, + cost); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, + flags, cost); + } else { + rows = storage_multi_range_read_info_const(keyno, seq, seq_init_param, + n_ranges, bufsz, + flags, cost); + } + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::wrapper_multi_range_read_info(uint keyno, uint n_ranges, + uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + KEY key_info = table->key_info[keyno]; + if (mrn_is_geo_key(&key_info)) { + rows = handler::multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + DBUG_RETURN(rows); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + rows = wrap_handler->multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::storage_multi_range_read_info(uint keyno, uint n_ranges, + uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, + uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost) +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + } else { + rows = storage_multi_range_read_info(keyno, n_ranges, keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + key_parts, +#endif + bufsz, flags, cost); + } + DBUG_RETURN(rows); +} + +int ha_mroonga::wrapper_multi_range_read_init(RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = handler::multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_multi_range_read_init(RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + DBUG_RETURN(error); +} + +int ha_mroonga::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + } else { + error = storage_multi_range_read_init(seq, seq_init_param, + n_ranges, mode, buf); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = handler::multi_range_read_next(range_info); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->multi_range_read_next(range_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::multi_range_read_next(range_info); + DBUG_RETURN(error); +} + +int ha_mroonga::multi_range_read_next(range_id_t *range_info) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_multi_range_read_next(range_info); + } else { + error = storage_multi_range_read_next(range_info); + } + DBUG_RETURN(error); +} +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ +int ha_mroonga::wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = handler::read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + DBUG_RETURN(error); +} + +int ha_mroonga::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + } else { + error = storage_read_multi_range_first(found_range_p, ranges, + range_count, sorted, buffer); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + KEY key_info = table->key_info[active_index]; + if (mrn_is_geo_key(&key_info)) { + error = handler::read_multi_range_next(found_range_p); + DBUG_RETURN(error); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + if (fulltext_searching) + set_pk_bitmap(); + error = wrap_handler->read_multi_range_next(found_range_p); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + MRN_DBUG_ENTER_METHOD(); + int error = handler::read_multi_range_next(found_range_p); + DBUG_RETURN(error); +} + +int ha_mroonga::read_multi_range_next(KEY_MULTI_RANGE **found_range_p) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_read_multi_range_next(found_range_p); + } else { + error = storage_read_multi_range_next(found_range_p); + } + DBUG_RETURN(error); +} +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::wrapper_start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::wrapper_start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + wrap_handler->ha_start_bulk_insert(rows, flags); +#else + wrap_handler->ha_start_bulk_insert(rows); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::storage_start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::storage_start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +void ha_mroonga::start_bulk_insert(ha_rows rows, uint flags) +#else +void ha_mroonga::start_bulk_insert(ha_rows rows) +#endif +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) { +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + wrapper_start_bulk_insert(rows, flags); +#else + wrapper_start_bulk_insert(rows); +#endif + } else { +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + storage_start_bulk_insert(rows, flags); +#else + storage_start_bulk_insert(rows); +#endif + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_end_bulk_insert() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_end_bulk_insert(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_end_bulk_insert() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::end_bulk_insert() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_end_bulk_insert(); + } else { + error = storage_end_bulk_insert(); + } + DBUG_RETURN(error); +} + +int ha_mroonga::generic_delete_all_rows(grn_obj *target_grn_table, + const char *function_name) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + if (is_dry_write()) { + DBUG_PRINT("info", + ("mroonga: dry write: %s::%s", MRN_CLASS_NAME, function_name)); + DBUG_RETURN(error); + } + + grn_table_cursor *cursor; + cursor = grn_table_cursor_open(ctx, target_grn_table, + NULL, 0, + NULL, 0, + 0, -1, + 0); + if (cursor) { + while (grn_table_cursor_next(ctx, cursor) != GRN_ID_NIL) { + grn_table_cursor_delete(ctx, cursor); + } + grn_table_cursor_close(ctx, cursor); + } else { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_delete_all_rows() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_delete_all_rows(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (error) { + DBUG_RETURN(error); + } + + if (!wrapper_have_target_index()) { + DBUG_RETURN(error); + } + + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + error = generic_delete_all_rows(grn_index_tables[i], __FUNCTION__); + if (error) { + break; + } + } + + int grn_table_error; + grn_table_error = generic_delete_all_rows(grn_table, __FUNCTION__); + if (!error) { + error = grn_table_error; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_delete_all_rows() +{ + MRN_DBUG_ENTER_METHOD(); + int error = generic_delete_all_rows(grn_table, __FUNCTION__); + DBUG_RETURN(error); +} + +int ha_mroonga::delete_all_rows() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_delete_all_rows(); + } else { + error = storage_delete_all_rows(); + } + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_TRUNCATE +int ha_mroonga::wrapper_truncate() +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_truncate(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + + if (!error && wrapper_have_target_index()) { + error = wrapper_truncate_index(); + } + + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::wrapper_truncate_index() +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + if (is_dry_write()) { + DBUG_PRINT("info", + ("mroonga: dry write: %s::%s", MRN_CLASS_NAME, __FUNCTION__)); + DBUG_RETURN(error); + } + + grn_rc rc; + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + KEY key_info = table->key_info[i]; + + if (!(wrapper_is_target_index(&key_info))) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + rc = grn_table_truncate(ctx, grn_index_tables[i]); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + rc = grn_table_truncate(ctx, grn_table); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_truncate() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + if (is_dry_write()) { + DBUG_PRINT("info", ("mroonga: dry write: ha_mroonga::%s", __FUNCTION__)); + DBUG_RETURN(error); + } + + grn_rc rc; + rc = grn_table_truncate(ctx, grn_table); + if (rc) { + my_message(ER_ERROR_ON_WRITE, ctx->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_WRITE); + } + error = storage_truncate_index(); + + if (!error && thd_sql_command(ha_thd()) == SQLCOM_TRUNCATE) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = 0; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = false; + } + + DBUG_RETURN(error); +} + +int ha_mroonga::storage_truncate_index() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + grn_rc rc; + uint i; + uint n_keys = table->s->keys; + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + + KEY key_info = table->key_info[i]; + + if ( + !(key_info.flags & HA_NOSAME) && + (KEY_N_KEY_PARTS(&key_info) == 1 || (key_info.flags & HA_FULLTEXT)) + ) { + continue; + } + + if (!grn_index_tables[i]) { + /* disable keys */ + continue; + } + + rc = grn_table_truncate(ctx, grn_index_tables[i]); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + goto err; + } + } +err: + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_TRUNCATE +int ha_mroonga::truncate() +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_truncate(); + } else { + error = storage_truncate(); + } + DBUG_RETURN(error); +} +#endif + +double ha_mroonga::wrapper_scan_time() +{ + double res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->scan_time(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +double ha_mroonga::storage_scan_time() +{ + MRN_DBUG_ENTER_METHOD(); + double time = handler::scan_time(); + DBUG_RETURN(time); +} + +double ha_mroonga::scan_time() +{ + MRN_DBUG_ENTER_METHOD(); + double time; + if (share->wrapper_mode) + { + time = wrapper_scan_time(); + } else { + time = storage_scan_time(); + } + DBUG_RETURN(time); +} + +double ha_mroonga::wrapper_read_time(uint index, uint ranges, ha_rows rows) +{ + double res; + MRN_DBUG_ENTER_METHOD(); + if (index < MAX_KEY) { + KEY key_info = table->key_info[index]; + if (mrn_is_geo_key(&key_info)) { + res = handler::read_time(index, ranges, rows); + DBUG_RETURN(res); + } + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->read_time(share->wrap_key_nr[index], ranges, rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } else { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->read_time(index, ranges, rows); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + DBUG_RETURN(res); +} + +double ha_mroonga::storage_read_time(uint index, uint ranges, ha_rows rows) +{ + MRN_DBUG_ENTER_METHOD(); + double time = handler::read_time(index, ranges, rows); + DBUG_RETURN(time); +} + +double ha_mroonga::read_time(uint index, uint ranges, ha_rows rows) +{ + MRN_DBUG_ENTER_METHOD(); + double time; + if (share->wrapper_mode) + { + time = wrapper_read_time(index, ranges, rows); + } else { + time = storage_read_time(index, ranges, rows); + } + DBUG_RETURN(time); +} + +const key_map *ha_mroonga::wrapper_keys_to_use_for_scanning() +{ + const key_map *res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->keys_to_use_for_scanning(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +const key_map *ha_mroonga::storage_keys_to_use_for_scanning() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(&key_map_full); +} + +const key_map *ha_mroonga::keys_to_use_for_scanning() +{ + MRN_DBUG_ENTER_METHOD(); + const key_map *key_map; + if (share->wrapper_mode) + { + key_map = wrapper_keys_to_use_for_scanning(); + } else { + key_map = storage_keys_to_use_for_scanning(); + } + DBUG_RETURN(key_map); +} + +ha_rows ha_mroonga::wrapper_estimate_rows_upper_bound() +{ + ha_rows res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->estimate_rows_upper_bound(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +ha_rows ha_mroonga::storage_estimate_rows_upper_bound() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows = handler::estimate_rows_upper_bound(); + DBUG_RETURN(rows); +} + +ha_rows ha_mroonga::estimate_rows_upper_bound() +{ + MRN_DBUG_ENTER_METHOD(); + ha_rows rows; + if (share->wrapper_mode) + { + rows = wrapper_estimate_rows_upper_bound(); + } else { + rows = storage_estimate_rows_upper_bound(); + } + DBUG_RETURN(rows); +} + +void ha_mroonga::wrapper_update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->update_create_info(create_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + handler::update_create_info(create_info); + if (!(create_info->used_fields & HA_CREATE_USED_AUTO)) { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + if (!long_term_share->auto_inc_inited) { + storage_info(HA_STATUS_AUTO); + } + create_info->auto_increment_value = long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::update_create_info(HA_CREATE_INFO* create_info) +{ + MRN_DBUG_ENTER_METHOD(); + if (!create_info->connect_string.str) + { + create_info->connect_string.str = table->s->connect_string.str; + create_info->connect_string.length = table->s->connect_string.length; + } + if (share->wrapper_mode) + wrapper_update_create_info(create_info); + else + storage_update_create_info(create_info); + st_mrn_slot_data *slot_data = mrn_get_slot_data(ha_thd(), true); + if (slot_data) { + slot_data->alter_create_info = create_info; + if (slot_data->alter_connect_string) { + my_free(slot_data->alter_connect_string, MYF(0)); + slot_data->alter_connect_string = NULL; + } + if (create_info->connect_string.str) { + slot_data->alter_connect_string = + my_strndup(create_info->connect_string.str, + create_info->connect_string.length, + MYF(MY_WME)); + } + if (slot_data->alter_comment) { + my_free(slot_data->alter_comment, MYF(0)); + slot_data->alter_comment = NULL; + } + if (create_info->comment.str) { + slot_data->alter_comment = + my_strndup(create_info->comment.str, + create_info->comment.length, + MYF(MY_WME)); + } + if (share && share->disable_keys) { + slot_data->disable_keys_create_info = create_info; + } + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error = 0; + handler *hnd; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(tmp_share, tmp_share->table_share); + if (!(hnd = + tmp_share->hton->create(tmp_share->hton, tmp_share->table_share, + current_thd->mem_root))) + { + MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + hnd->init(); + MRN_SET_BASE_SHARE_KEY(tmp_share, tmp_share->table_share); + + if ((error = hnd->ha_rename_table(from, to))) + { + delete hnd; + DBUG_RETURN(error); + } + + error = wrapper_rename_index(from, to, tmp_share, + from_table_name, to_table_name); + + delete hnd; + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_rename_index(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + grn_rc rc; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(from); + if (error) + DBUG_RETURN(error); + + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + const char *mysql_index_name = tmp_table_share->key_info[i].name; + mrn::IndexTableName from_index_table_name(from_table_name, mysql_index_name); + mrn::IndexTableName to_index_table_name(to_table_name, mysql_index_name); + grn_obj *index_table; + index_table = grn_ctx_get(ctx, + from_index_table_name.c_str(), + from_index_table_name.length()); + if (index_table) { + rc = grn_table_rename(ctx, index_table, + to_index_table_name.c_str(), + to_index_table_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + } + + grn_obj *table = grn_ctx_get(ctx, from_table_name, strlen(from_table_name)); + if (ctx->rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + rc = grn_table_rename(ctx, table, to_table_name, + strlen(to_table_name)); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + DBUG_RETURN(0); +} + +int ha_mroonga::storage_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + grn_rc rc; + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + MRN_LONG_TERM_SHARE *from_long_term_share = tmp_share->long_term_share, + *to_long_term_share; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + error = ensure_database_open(from); + if (error) + DBUG_RETURN(error); + + if (!(to_long_term_share = mrn_get_long_term_share(to, strlen(to), &error))) + DBUG_RETURN(error); + to_long_term_share->auto_inc_value = from_long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: to_auto_inc_value=%llu", + to_long_term_share->auto_inc_value)); + to_long_term_share->auto_inc_inited = from_long_term_share->auto_inc_inited; + + uint i; + for (i = 0; i < tmp_table_share->keys; i++) { + const char *mysql_index_name = tmp_table_share->key_info[i].name; + mrn::IndexTableName from_index_table_name(from_table_name, + mysql_index_name); + mrn::IndexTableName to_index_table_name(to_table_name, + mysql_index_name); + grn_obj *index_table; + index_table = grn_ctx_get(ctx, + from_index_table_name.c_str(), + from_index_table_name.length()); + if (index_table) { + rc = grn_table_rename(ctx, index_table, + to_index_table_name.c_str(), + to_index_table_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + } + } +#ifdef MRN_SUPPORT_FOREIGN_KEYS + error = storage_rename_foreign_key(tmp_share, from_table_name, to_table_name); + if (error) { + goto error_end; + } +#endif + { + grn_obj *table_obj = grn_ctx_get(ctx, from_table_name, strlen(from_table_name)); + if (ctx->rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + rc = grn_table_rename(ctx, table_obj, to_table_name, + strlen(to_table_name)); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + goto error_end; + } + } + DBUG_RETURN(0); + +error_end: + mrn_free_long_term_share(to_long_term_share); + DBUG_RETURN(error); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +int ha_mroonga::storage_rename_foreign_key(MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name) +{ + int error; + uint i; + grn_obj *column, *ref_column; + grn_rc rc; + TABLE_SHARE *tmp_table_share = tmp_share->table_share; + uint n_columns = tmp_table_share->fields; + MRN_DBUG_ENTER_METHOD(); + for (i = 0; i < n_columns; ++i) { + Field *field = tmp_table_share->field[i]; + const char *column_name = field->field_name; + uint column_name_size = strlen(column_name); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + + column = grn_obj_column(ctx, grn_table, + column_name, column_name_size); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + if (ref_table->header.type != GRN_TABLE_NO_KEY && + ref_table->header.type != GRN_TABLE_HASH_KEY && + ref_table->header.type != GRN_TABLE_PAT_KEY && + ref_table->header.type != GRN_TABLE_DAT_KEY) { + continue; + } + mrn::IndexColumnName from_index_column_name(from_table_name, column_name); + ref_column = grn_obj_column(ctx, ref_table, + from_index_column_name.c_str(), + from_index_column_name.length()); + if (!ref_column) { + continue; + } + mrn::IndexColumnName to_index_column_name(to_table_name, column_name); + rc = grn_column_rename(ctx, ref_column, + to_index_column_name.c_str(), + to_index_column_name.length()); + if (rc != GRN_SUCCESS) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + DBUG_RETURN(0); +} +#endif + +int ha_mroonga::rename_table(const char *from, const char *to) +{ + int error = 0; + TABLE_LIST table_list; + TABLE_SHARE *tmp_table_share; + TABLE tmp_table; + MRN_SHARE *tmp_share; + MRN_DBUG_ENTER_METHOD(); + mrn::PathMapper to_mapper(to); + mrn::PathMapper from_mapper(from); + if (strcmp(from_mapper.db_name(), to_mapper.db_name())) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(from_mapper.db_name(), + strlen(from_mapper.db_name()), + from_mapper.mysql_table_name(), + strlen(from_mapper.mysql_table_name()), + from_mapper.mysql_table_name(), TL_WRITE); +#else + table_list.init_one_table(from_mapper.db_name(), + from_mapper.mysql_table_name(), + TL_WRITE); +#endif + mrn_open_mutex_lock(NULL); + tmp_table_share = mrn_create_tmp_table_share(&table_list, from, &error); + mrn_open_mutex_unlock(NULL); + if (!tmp_table_share) { + DBUG_RETURN(error); + } + tmp_table.s = tmp_table_share; +#ifdef WITH_PARTITION_STORAGE_ENGINE + tmp_table.part_info = NULL; +#endif + if (!(tmp_share = mrn_get_share(from, &tmp_table, &error))) + { + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + DBUG_RETURN(error); + } + + if (tmp_share->wrapper_mode) + { + error = wrapper_rename_table(from, to, tmp_share, + from_mapper.table_name(), + to_mapper.table_name()); + } else { + error = storage_rename_table(from, to, tmp_share, + from_mapper.table_name(), + to_mapper.table_name()); + } + + if (!error) { + mrn_free_long_term_share(tmp_share->long_term_share); + tmp_share->long_term_share = NULL; + } + mrn_free_share(tmp_share); + if (!error && to_mapper.table_name()[0] == '#') { + if ((error = alter_share_add(to, tmp_table_share))) + DBUG_RETURN(error); + } else if (error && from_mapper.table_name()[0] == '#') { + alter_share_add(from, tmp_table_share); + } else { + mrn_open_mutex_lock(NULL); + mrn_free_tmp_table_share(tmp_table_share); + mrn_open_mutex_unlock(NULL); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_crashed() const +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->is_crashed(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_is_crashed() const +{ + MRN_DBUG_ENTER_METHOD(); + bool crashed = handler::is_crashed(); + DBUG_RETURN(crashed); +} + +bool ha_mroonga::is_crashed() const +{ + MRN_DBUG_ENTER_METHOD(); + int crashed; + if (share->wrapper_mode) + { + crashed = wrapper_is_crashed(); + } else { + crashed = storage_is_crashed(); + } + DBUG_RETURN(crashed); +} + +bool ha_mroonga::wrapper_auto_repair(int error) const +{ + bool crashed; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR + crashed = wrap_handler->auto_repair(error); +#else + crashed = wrap_handler->auto_repair(); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(crashed); +} + +bool ha_mroonga::storage_auto_repair(int error) const +{ + MRN_DBUG_ENTER_METHOD(); + bool crashed; +#ifdef MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR + crashed = handler::auto_repair(error); +#else + crashed = handler::auto_repair(); +#endif + DBUG_RETURN(crashed); +} + +bool ha_mroonga::auto_repair(int error) const +{ + MRN_DBUG_ENTER_METHOD(); + bool crashed; + // TODO: We should consider about creating share for error = + // ER_CANT_OPEN_FILE. The following code just ignores the error. + if (share && share->wrapper_mode) + { + crashed = wrapper_auto_repair(error); + } else { + crashed = storage_auto_repair(error); + } + DBUG_RETURN(crashed); +} + +bool ha_mroonga::auto_repair() const +{ + MRN_DBUG_ENTER_METHOD(); + bool crashed = auto_repair(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(crashed); +} + +int ha_mroonga::wrapper_disable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_disable_indexes(mode); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error == HA_ERR_WRONG_COMMAND) { + error = 0; + } + if (!error) { + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < table_share->keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + continue; + } + + mrn::IndexTableName index_table_name(mapper.table_name(), + key_info[i].name); + grn_obj *index_table = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (index_table) { + grn_obj_remove(ctx, index_table); + } + grn_index_tables[i] = NULL; + grn_index_columns[i] = NULL; + } + } else { + error = HA_ERR_WRONG_COMMAND; + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_disable_indexes(uint mode) +{ + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + DBUG_PRINT("info", ("mroonga: keys are disabled already %u", i)); + DBUG_RETURN(0); + } + } + KEY *key_info = table_share->key_info; + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE && + (key_info[i].flags & HA_NOSAME)) { + continue; + } + + mrn::IndexTableName index_table_name(mapper.table_name(), + key_info[i].name); + grn_obj *index_table = grn_ctx_get(ctx, + index_table_name.c_str(), + index_table_name.length()); + if (index_table) { + grn_obj_remove(ctx, index_table); + } + grn_index_tables[i] = NULL; + grn_index_columns[i] = NULL; + } + } else { + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + DBUG_RETURN(0); +} + +int ha_mroonga::disable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + error = wrapper_disable_indexes(mode); + } else { + error = storage_disable_indexes(mode); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_enable_indexes(uint mode) +{ + int error = 0, tmp_error = 0; + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i, j; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (share->wrap_key_nr[i] < MAX_KEY) { + continue; + } + if (!grn_index_tables[i]) { + break; + } + } + if (i == table_share->keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + DBUG_RETURN(0); + } + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *key_info = table_share->key_info; + uint n_keys = table_share->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + mrn::PathMapper mapper(share->table_name); + for (i = 0, j = 0; i < n_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[i])) { + j++; + continue; + } + + if ((error = mrn_add_index_param(share, &key_info[i], i))) + { + break; + } + index_tables[i] = NULL; + index_columns[i] = NULL; + if (!grn_index_tables[i]) { + if ( + (key_info[i].flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } else if ( + mrn_is_geo_key(&key_info[i]) && + (error = wrapper_create_index_geo(mapper.table_name(), + i, &key_info[i], + index_tables, index_columns, + share)) + ) { + break; + } + grn_index_columns[i] = index_columns[i]; + } + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + if (!error && i > j) + { + error = wrapper_fill_indexes(ha_thd(), table->key_info, index_columns, + n_keys); + } + bitmap_set_all(table->read_set); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + } else { + tmp_error = HA_ERR_WRONG_COMMAND; + } + + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_enable_indexes(mode); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error == HA_ERR_WRONG_COMMAND) { + error = tmp_error; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_enable_indexes(uint mode) +{ + int error = 0; + uint n_keys = table_share->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, n_keys); + bool have_multiple_column_index = false; + bool skip_unique_key = (mode == HA_KEY_SWITCH_NONUNIQ_SAVE); + MRN_DBUG_ENTER_METHOD(); + if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE || mode == HA_KEY_SWITCH_ALL) { + uint i; + for (i = 0; i < table_share->keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (!grn_index_tables[i]) { + break; + } + } + if (i == table_share->keys) { + DBUG_PRINT("info", ("mroonga: keys are enabled already")); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(0); + } + KEY *key_info = table->key_info; + bitmap_clear_all(table->read_set); + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < n_keys; i++) { + if (i == table->s->primary_key) { + continue; + } + if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) { + continue; + } + + if ((error = mrn_add_index_param(share, &key_info[i], i))) + { + break; + } + index_tables[i] = NULL; + if (!grn_index_tables[i]) { + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + share, &key_info[i], index_tables, + index_columns, i))) + { + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } + } else { + index_columns[i] = NULL; + } + } + if (!error && have_multiple_column_index) + { + error = storage_add_index_multiple_columns(key_info, n_keys, + index_tables, + index_columns, + skip_unique_key); + } + bitmap_set_all(table->read_set); + } else { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} + +int ha_mroonga::enable_indexes(uint mode) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + share->disable_keys = false; + if (share->wrapper_mode) + { + error = wrapper_enable_indexes(mode); + } else { + error = storage_enable_indexes(mode); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_check(THD* thd, HA_CHECK_OPT* check_opt) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_check(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_check(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_check(thd, check_opt); + } else { + error = storage_check(thd, check_opt); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_fill_indexes(THD *thd, KEY *key_info, + grn_obj **index_columns, uint n_keys) +{ + int error = 0; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *tmp_key_info; +#ifdef MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK + int wrapper_lock_type_backup = wrap_handler->get_lock_type(); +#endif + MRN_DBUG_ENTER_METHOD(); + DBUG_PRINT("info", ("mroonga: n_keys=%u", n_keys)); + + grn_bool need_lock = true; + if (mrn_lock_type != F_UNLCK) { + need_lock = false; + } +#ifdef MRN_NEED_M_LOCK_TYPE_CHECK_FOR_WRAPPER_EXTERNAL_LOCK + if (wrapper_lock_type_backup != F_UNLCK) { + need_lock = false; + } +#endif + if (need_lock) { + error = wrapper_external_lock(thd, F_WRLCK); + } + if (!error) { + if ( + !(error = wrapper_start_stmt(thd, thr_lock_data.type)) && + !(error = wrapper_rnd_init(true)) + ) { + grn_obj key; + GRN_TEXT_INIT(&key, 0); + grn_bulk_space(ctx, &key, p_key_info->key_length); + while (!(error = wrapper_rnd_next(table->record[0]))) + { + key_copy((uchar *)(GRN_TEXT_VALUE(&key)), table->record[0], + p_key_info, p_key_info->key_length); + int added; + grn_id record_id; + mrn_change_encoding(ctx, NULL); + record_id = grn_table_add(ctx, grn_table, + GRN_TEXT_VALUE(&key), p_key_info->key_length, + &added); + if (record_id == GRN_ID_NIL) + { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "failed to add a new record into groonga: key=<%.*s>", + (int) p_key_info->key_length, GRN_TEXT_VALUE(&key)); + error = ER_ERROR_ON_WRITE; + my_message(error, error_message, MYF(0)); + } + if (error) + break; + + uint k; + for (k = 0; k < n_keys; k++) { + tmp_key_info = &key_info[k]; + if (!(tmp_key_info->flags & HA_FULLTEXT) && + !mrn_is_geo_key(tmp_key_info)) { + continue; + } + if (!index_columns[k]) { + continue; + } + DBUG_PRINT("info", ("mroonga: key_num=%u", k)); + + uint l; + for (l = 0; l < KEY_N_KEY_PARTS(tmp_key_info); l++) { + Field *field = tmp_key_info->key_part[l].field; + + if (field->is_null()) + continue; + error = mrn_change_encoding(ctx, field->charset()); + if (error) + break; + + error = generic_store_bulk(field, &new_value_buffer); + if (error) { + my_message(error, + "mroonga: wrapper: " + "failed to get new value for updating index.", + MYF(0)); + break; + } + + grn_obj *index_column = index_columns[k]; + grn_rc rc; + rc = grn_column_index_update(ctx, index_column, record_id, l + 1, + NULL, &new_value_buffer); + grn_obj_unlink(ctx, index_column); + if (rc) { + error = ER_ERROR_ON_WRITE; + my_message(error, ctx->errbuf, MYF(0)); + break; + } + } + if (error) + break; + } + if (error) + break; + } + grn_obj_unlink(ctx, &key); + if (error != HA_ERR_END_OF_FILE) + wrapper_rnd_end(); + else + error = wrapper_rnd_end(); + } + if (need_lock) { + wrapper_external_lock(thd, F_UNLCK); + } + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_recreate_indexes(THD *thd) +{ + int error; + uint i, n_keys = table_share->keys; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + KEY *key_info = table->key_info; + MRN_DBUG_ENTER_METHOD(); + mrn::PathMapper mapper(table_share->normalized_path.str); + bitmap_clear_all(table->read_set); + clear_indexes(); + remove_grn_obj_force(mapper.table_name()); + grn_table = NULL; + mrn_set_bitmap_by_key(table->read_set, p_key_info); + for (i = 0; i < n_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[i])) { + continue; + } + mrn::IndexTableName index_table_name(mapper.table_name(), + table_share->key_info[i].name); + char index_column_full_name[MRN_MAX_PATH_SIZE]; + snprintf(index_column_full_name, MRN_MAX_PATH_SIZE, + "%s.%s", index_table_name.c_str(), INDEX_COLUMN_NAME); + remove_grn_obj_force(index_column_full_name); + remove_grn_obj_force(index_table_name.c_str()); + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + error = wrapper_create_index(table_share->normalized_path.str, table, + NULL, share, mapper.table_name()); + if (error) + DBUG_RETURN(error); + error = wrapper_open_indexes(table_share->normalized_path.str); + if (error) + DBUG_RETURN(error); + error = wrapper_fill_indexes(thd, key_info, grn_index_columns, n_keys); + bitmap_set_all(table->read_set); + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + int error; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_repair(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (error && error != HA_ADMIN_NOT_IMPLEMENTED) + DBUG_RETURN(error); + error = wrapper_recreate_indexes(thd); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::repair(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + share->disable_keys = false; + if (share->wrapper_mode) + { + error = wrapper_repair(thd, check_opt); + } else { + error = storage_repair(thd, check_opt); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_check_and_repair(THD *thd) +{ + // XXX: success is valid variable name? + bool success; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + success = wrap_handler->ha_check_and_repair(thd); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(success); +} + +bool ha_mroonga::storage_check_and_repair(THD *thd) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(true); +} + +bool ha_mroonga::check_and_repair(THD *thd) +{ + MRN_DBUG_ENTER_METHOD(); + // XXX: success is valid variable name? + bool success; + if (share->wrapper_mode) + { + success = wrapper_check_and_repair(thd); + } else { + success = storage_check_and_repair(thd); + } + DBUG_RETURN(success); +} + +int ha_mroonga::wrapper_analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->ha_analyze(thd, check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::analyze(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_analyze(thd, check_opt); + } else { + error = storage_analyze(thd, check_opt); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_TRY_ALTER); +} + +int ha_mroonga::storage_optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED); +} + +int ha_mroonga::optimize(THD* thd, HA_CHECK_OPT* check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error = 0; + if (share->wrapper_mode) + { + error = wrapper_optimize(thd, check_opt); + } else { + error = storage_optimize(thd, check_opt); + } + DBUG_RETURN(error); +} + +bool ha_mroonga::wrapper_is_fatal_error(int error_num, uint flags) +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->is_fatal_error(error_num, flags); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_is_fatal_error(int error_num, uint flags) +{ + MRN_DBUG_ENTER_METHOD(); + bool is_fatal_error = handler::is_fatal_error(error_num, flags); + DBUG_RETURN(is_fatal_error); +} + +bool ha_mroonga::is_fatal_error(int error_num, uint flags) +{ + MRN_DBUG_ENTER_METHOD(); + bool is_fatal_error; + if (share->wrapper_mode) + { + is_fatal_error = wrapper_is_fatal_error(error_num, flags); + } else { + is_fatal_error = storage_is_fatal_error(error_num, flags); + } + DBUG_RETURN(is_fatal_error); +} + +bool ha_mroonga::wrapper_check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->check_if_incompatible_data(create_info, table_changes); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + MRN_DBUG_ENTER_METHOD(); + uint n = table_share->fields; + for (uint i = 0; i < n; i++) { + Field *field = table->field[i]; + if (field->flags & FIELD_IS_RENAMED) { + DBUG_RETURN(COMPATIBLE_DATA_NO); + } + } + DBUG_RETURN(COMPATIBLE_DATA_YES); +} + +bool ha_mroonga::check_if_incompatible_data( + HA_CREATE_INFO *create_info, uint table_changes) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if ( + create_info->comment.str != table_share->comment.str || + create_info->connect_string.str != table_share->connect_string.str + ) { + DBUG_RETURN(COMPATIBLE_DATA_NO); + } + if (share->wrapper_mode) + { + res = wrapper_check_if_incompatible_data(create_info, table_changes); + } else { + res = storage_check_if_incompatible_data(create_info, table_changes); + } + DBUG_RETURN(res); +} + +int ha_mroonga::storage_add_index_multiple_columns(KEY *key_info, + uint num_of_keys, + grn_obj **index_tables, + grn_obj **index_columns, + bool skip_unique_key) +{ + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + if (!(error = storage_rnd_init(true))) + { + while (!(error = storage_rnd_next(table->record[0]))) + { + for (uint i = 0; i < num_of_keys; i++) { + KEY *current_key_info = key_info + i; + if ( + KEY_N_KEY_PARTS(current_key_info) == 1 || + (current_key_info->flags & HA_FULLTEXT) + ) { + continue; + } + if (skip_unique_key && (key_info[i].flags & HA_NOSAME)) { + continue; + } + if (!index_columns[i]) { + continue; + } + + /* fix key_info.key_length */ + for (uint j = 0; j < KEY_N_KEY_PARTS(current_key_info); j++) { + if ( + !current_key_info->key_part[j].null_bit && + current_key_info->key_part[j].field->null_bit + ) { + current_key_info->key_length++; + current_key_info->key_part[j].null_bit = + current_key_info->key_part[j].field->null_bit; + } + } + if (key_info[i].flags & HA_NOSAME) { + grn_id key_id; + if ((error = storage_write_row_unique_index(table->record[0], + current_key_info, + index_tables[i], + &key_id))) + { + if (error == HA_ERR_FOUND_DUPP_KEY) + { + error = HA_ERR_FOUND_DUPP_UNIQUE; + } + break; + } + } + if ((error = storage_write_row_multiple_column_index(table->record[0], + record_id, + current_key_info, + index_columns[i]))) + { + break; + } + } + if (error) + break; + } + if (error != HA_ERR_END_OF_FILE) { + storage_rnd_end(); + } else { + error = storage_rnd_end(); + } + } + + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER +bool ha_mroonga::wrapper_is_comment_changed(TABLE *table1, TABLE *table2) +{ + MRN_DBUG_ENTER_METHOD(); + + if (table1->s->comment.length != table2->s->comment.length) { + DBUG_RETURN(true); + } + + if (strncmp(table1->s->comment.str, + table2->s->comment.str, + table1->s->comment.length) == 0) { + DBUG_RETURN(false); + } else { + DBUG_RETURN(true); + } +} + +enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + uint n_keys; + uint i; + enum_alter_inplace_result result_mroonga = HA_ALTER_INPLACE_NO_LOCK; + DBUG_PRINT("info", ("mroonga: handler_flags=%lu", ha_alter_info->handler_flags)); + + if (wrapper_is_comment_changed(table, altered_table)) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + if ( + (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) && + (ha_alter_info->handler_flags & + ( + Alter_inplace_info::ADD_COLUMN | + Alter_inplace_info::DROP_COLUMN | + Alter_inplace_info::ALTER_COLUMN_TYPE | + Alter_inplace_info::ALTER_COLUMN_ORDER | + Alter_inplace_info::ALTER_COLUMN_NULLABLE | + Alter_inplace_info::ALTER_COLUMN_NOT_NULLABLE | + Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE | + Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT + ) + ) + ) { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + if (ha_alter_info->handler_flags & Alter_inplace_info::ALTER_RENAME) + { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + + DBUG_ASSERT(ha_alter_info->key_count == altered_table->s->keys); + alter_key_count = 0; + alter_index_drop_count = 0; + alter_index_add_count = 0; + alter_handler_flags = ha_alter_info->handler_flags; + if (!(alter_key_info_buffer = (KEY *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &alter_key_info_buffer, sizeof(KEY) * ha_alter_info->key_count, + &alter_index_drop_buffer, sizeof(KEY) * ha_alter_info->index_drop_count, + &alter_index_add_buffer, sizeof(uint) * ha_alter_info->index_add_count, + &wrap_altered_table, sizeof(TABLE), + &wrap_altered_table_key_info, sizeof(KEY) * altered_table->s->keys, + &wrap_altered_table_share, sizeof(TABLE_SHARE), + &wrap_altered_table_share_key_info, sizeof(KEY) * altered_table->s->keys, + NullS)) + ) { + DBUG_RETURN(HA_ALTER_ERROR); + } + memcpy(wrap_altered_table, altered_table, sizeof(TABLE)); + memcpy(wrap_altered_table_share, altered_table->s, sizeof(TABLE_SHARE)); + + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = ha_alter_info->index_drop_buffer[i]; + if (key->flags & HA_FULLTEXT || mrn_is_geo_key(key)) { + result_mroonga = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; + } else { + memcpy(&alter_index_drop_buffer[alter_index_drop_count], + ha_alter_info->index_drop_buffer[i], sizeof(KEY)); + ++alter_index_drop_count; + } + } + if (!alter_index_drop_count) { + alter_handler_flags &= ~Alter_inplace_info::DROP_INDEX; + } + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = + &altered_table->key_info[ha_alter_info->index_add_buffer[i]]; + if (key->flags & HA_FULLTEXT || mrn_is_geo_key(key)) { + result_mroonga = HA_ALTER_INPLACE_EXCLUSIVE_LOCK; + } else { + alter_index_add_buffer[alter_index_add_count] = + ha_alter_info->index_add_buffer[i]; + ++alter_index_add_count; + } + } + if (!alter_index_add_count) { + alter_handler_flags &= ~Alter_inplace_info::ADD_INDEX; + } + uint add_index_pos = 0; + n_keys = ha_alter_info->key_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = &altered_table->key_info[i]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + memcpy(&alter_key_info_buffer[alter_key_count], + &ha_alter_info->key_info_buffer[i], sizeof(KEY)); + memcpy(&wrap_altered_table_key_info[alter_key_count], + &altered_table->key_info[i], sizeof(KEY)); + memcpy(&wrap_altered_table_share_key_info[alter_key_count], + &altered_table->s->key_info[i], sizeof(KEY)); + if (add_index_pos < alter_index_add_count && + alter_index_add_buffer[add_index_pos] == i) { + alter_index_add_buffer[add_index_pos] = alter_key_count; + ++add_index_pos; + } + ++alter_key_count; + } + } + wrap_altered_table->key_info = wrap_altered_table_key_info; + wrap_altered_table_share->key_info = wrap_altered_table_share_key_info; + wrap_altered_table_share->keys = alter_key_count; + wrap_altered_table->s = wrap_altered_table_share; + + if (!alter_handler_flags) { + DBUG_RETURN(result_mroonga); + } + enum_alter_inplace_result result; + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->check_if_supported_inplace_alter(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + if (result_mroonga > result) + DBUG_RETURN(result); + DBUG_RETURN(result_mroonga); +} + +enum_alter_inplace_result ha_mroonga::storage_check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + Alter_inplace_info::HA_ALTER_FLAGS supported_flags = + Alter_inplace_info::ADD_INDEX | + Alter_inplace_info::DROP_INDEX | + Alter_inplace_info::ADD_UNIQUE_INDEX | + Alter_inplace_info::DROP_UNIQUE_INDEX | + Alter_inplace_info::ADD_PK_INDEX | + Alter_inplace_info::DROP_PK_INDEX | + Alter_inplace_info::ADD_COLUMN | + Alter_inplace_info::DROP_COLUMN | + Alter_inplace_info::ALTER_COLUMN_NAME; + if (ha_alter_info->handler_flags & supported_flags) { + DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK); + } else { + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } +} + +enum_alter_inplace_result ha_mroonga::check_if_supported_inplace_alter( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + enum_alter_inplace_result result; + if (share->wrapper_mode) { + result = wrapper_check_if_supported_inplace_alter(altered_table, + ha_alter_info); + } else { + result = storage_check_if_supported_inplace_alter(altered_table, + ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + bool result; + MRN_DBUG_ENTER_METHOD(); + if (!alter_handler_flags) { + DBUG_RETURN(false); + } + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_prepare_inplace_alter_table(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(false); +} + +bool ha_mroonga::prepare_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_prepare_inplace_alter_table(altered_table, ha_alter_info); + } else { + result = storage_prepare_inplace_alter_table(altered_table, ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + int error; + bool result = false; + uint n_keys; + uint i, j = 0; + KEY *key_info = table_share->key_info; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(true); + + DBUG_PRINT("info", ("mroonga: table_name=%s", share->table_name)); + mrn::PathMapper mapper(share->table_name); + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + const KEY *key = ha_alter_info->index_drop_buffer[i]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + while (strcmp(key_info[j].name, key->name)) { + ++j; + } + DBUG_PRINT("info", ("mroonga: key_name=%s", key->name)); + error = drop_index(share, j); + if (error) + DBUG_RETURN(true); + grn_index_tables[j] = NULL; + grn_index_columns[j] = NULL; + } + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, + ha_alter_info->key_count); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, + ha_alter_info->key_count); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **key_parser; + uint *key_parser_length; + KEY *p_key_info = &table->key_info[table_share->primary_key]; + bool need_fill_index = false; + memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + memset(index_columns, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + tmp_table_share.keys = ha_alter_info->key_count; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &key_parser, sizeof(char *) * (tmp_table_share.keys), + &key_parser_length, sizeof(uint) * (tmp_table_share.keys), + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(true); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = NULL; + tmp_share->index_table_length = NULL; + tmp_share->key_parser = key_parser; + tmp_share->key_parser_length = key_parser_length; + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = &altered_table->key_info[key_pos]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + if (share->disable_keys) { + continue; + } + if ((error = mrn_add_index_param(tmp_share, key, key_pos))) + { + break; + } + DBUG_PRINT("info", ("mroonga: add key pos=%u", key_pos)); + if ( + (key->flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + key_pos, + key, index_tables, NULL, + tmp_share)) + ) { + break; + } else if ( + mrn_is_geo_key(key) && + (error = wrapper_create_index_geo(mapper.table_name(), + key_pos, key, + index_tables, NULL, tmp_share)) + ) { + break; + } + mrn_set_bitmap_by_key(table->read_set, key); + index_columns[key_pos] = grn_obj_column(ctx, + index_tables[key_pos], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + need_fill_index = true; + } + if (!error && need_fill_index) { + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); + uint n_columns = altered_table->s->fields; + for (i = 0; i < n_columns; ++i) { + Field *field = altered_table->field[i]; + field->move_field_offset(ptr_diff); + } + error = wrapper_fill_indexes(ha_thd(), altered_table->key_info, + index_columns, ha_alter_info->key_count); + for (i = 0; i < n_columns; ++i) { + Field *field = altered_table->field[i]; + field->move_field_offset(-ptr_diff); + } + } + bitmap_set_all(table->read_set); + + if (!error && alter_handler_flags) { + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_inplace_alter_table(wrap_altered_table, + ha_alter_info); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + + if (result || error) + { + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = + &altered_table->key_info[key_pos]; + if (!(key->flags & HA_FULLTEXT || mrn_is_geo_key(key))) { + continue; + } + if (share->disable_keys) { + continue; + } + if (index_tables[key_pos]) + { + grn_obj_remove(ctx, index_tables[key_pos]); + } + } + result = true; + } + mrn_free_share_alloc(tmp_share); + my_free(tmp_share, MYF(0)); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_inplace_alter_table_index( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + int error = 0; + uint n_keys; + uint i, j = 0; + KEY *key_info = table_share->key_info; + mrn::PathMapper mapper(share->table_name); + n_keys = ha_alter_info->index_drop_count; + for (i = 0; i < n_keys; ++i) { + KEY *key = ha_alter_info->index_drop_buffer[i]; + while (strcmp(key_info[j].name, key->name)) { + ++j; + } + error = drop_index(share, j); + if (error) + DBUG_RETURN(true); + grn_index_tables[j] = NULL; + grn_index_columns[j] = NULL; + } + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, + ha_alter_info->key_count); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, + ha_alter_info->key_count); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_parser, **col_flags, **col_type; + uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length; + bool have_multiple_column_index = false; + memset(index_tables, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + memset(index_columns, 0, sizeof(grn_obj *) * ha_alter_info->key_count); + tmp_table_share.keys = ha_alter_info->key_count; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &index_table, sizeof(char *) * tmp_table_share.keys, + &index_table_length, sizeof(uint) * tmp_table_share.keys, + &key_parser, sizeof(char *) * tmp_table_share.keys, + &key_parser_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(true); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_parser = key_parser; + tmp_share->key_parser_length = key_parser_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + bitmap_clear_all(table->read_set); + if (table_share->primary_key != MAX_KEY) { + KEY *p_key_info = &table->key_info[table_share->primary_key]; + mrn_set_bitmap_by_key(table->read_set, p_key_info); + } + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = + &altered_table->key_info[key_pos]; + if (share->disable_keys && !(key->flags & HA_NOSAME)) { + continue; // key is disabled + } + if ((error = mrn_add_index_param(tmp_share, key, key_pos))) + { + break; + } + DBUG_PRINT("info", ("mroonga: add key pos=%u", key_pos)); + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + tmp_share, key, index_tables, + index_columns, key_pos))) + { + break; + } + if ( + KEY_N_KEY_PARTS(key) == 1 && + (key->flags & HA_NOSAME) && + grn_table_size(ctx, grn_table) != + grn_table_size(ctx, index_tables[key_pos]) + ) { + error = HA_ERR_FOUND_DUPP_UNIQUE; + my_printf_error(ER_DUP_UNIQUE, ER(ER_DUP_UNIQUE), MYF(0), + table_share->table_name); + ++i; + break; + } + if ( + KEY_N_KEY_PARTS(key) != 1 && + !(key->flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, key); + have_multiple_column_index = true; + } + } + if (!error && have_multiple_column_index) { + my_ptrdiff_t ptr_diff = PTR_BYTE_DIFF(table->record[0], altered_table->record[0]); + uint n_columns = altered_table->s->fields; + for (i = 0; i < n_columns; ++i) { + Field *field = altered_table->field[i]; + field->move_field_offset(ptr_diff); + } + error = storage_add_index_multiple_columns(altered_table->key_info, + ha_alter_info->key_count, + index_tables, + index_columns, false); + for (i = 0; i < n_columns; ++i) { + Field *field = altered_table->field[i]; + field->move_field_offset(-ptr_diff); + } + } + bitmap_set_all(table->read_set); + + if (error) + { + n_keys = ha_alter_info->index_add_count; + for (i = 0; i < n_keys; ++i) { + uint key_pos = ha_alter_info->index_add_buffer[i]; + KEY *key = + &altered_table->key_info[key_pos]; + if (share->disable_keys && !(key->flags & HA_NOSAME)) { + continue; + } + if (index_tables[key_pos]) + { + grn_obj_remove(ctx, index_columns[key_pos]); + grn_obj_remove(ctx, index_tables[key_pos]); + } + } + have_error = true; + } + mrn_free_share_alloc(tmp_share); + my_free(tmp_share, MYF(0)); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_add_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_parser, **col_flags, **col_type; + uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length; + tmp_table_share.keys = 0; + tmp_table_share.fields = altered_table->s->fields; + tmp_share = (MRN_SHARE *)my_multi_malloc( + MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &index_table, sizeof(char *) * tmp_table_share.keys, + &index_table_length, sizeof(uint) * tmp_table_share.keys, + &key_parser, sizeof(char *) * tmp_table_share.keys, + &key_parser_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS); + if (!tmp_share) { + have_error = true; + DBUG_RETURN(have_error); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_parser = key_parser; + tmp_share->key_parser_length = key_parser_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + List_iterator_fast create_fields(alter_info->create_list); + for (uint i = 0; Create_field *create_field = create_fields++; i++) { + if (create_field->field) { + continue; + } + + grn_obj *col_type; + Field *field = altered_table->s->field[i]; + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + + int error = mrn_add_column_param(tmp_share, field, i); + if (error) { + have_error = true; + break; + } + + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT; + if (tmp_share->col_flags[i]) { + // TODO: parse flags + if (strcmp(tmp_share->col_flags[i], "COLUMN_VECTOR") == 0) { + col_flags |= GRN_OBJ_COLUMN_VECTOR; + } else { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + } else { + col_flags |= GRN_OBJ_COLUMN_SCALAR; + } + + grn_builtin_type gtype = mrn_grn_type_from_field(ctx, field, false); + if (tmp_share->col_type[i]) { + col_type = grn_ctx_get(ctx, tmp_share->col_type[i], -1); + } else { + col_type = grn_ctx_at(ctx, gtype); + } + char *col_path = NULL; // we don't specify path + + grn_obj *column_obj = + grn_column_create(ctx, table_obj, column_name, column_name_size, + col_path, col_flags, col_type); + if (ctx->rc) { + error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + } + if (column_obj) { + grn_obj_unlink(ctx, column_obj); + } + + if (have_error) { + break; + } + } + + grn_obj_unlink(ctx, table_obj); + + mrn_free_share_alloc(tmp_share); + my_free(tmp_share, MYF(0)); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_drop_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + + uint n_fields = table->s->fields; + for (uint i = 0; i < n_fields; i++) { + Field *field = table->field[i]; + + bool dropped = true; + List_iterator_fast create_fields(alter_info->create_list); + while (Create_field *create_field = create_fields++) { + if (create_field->field == field) { + dropped = false; + break; + } + } + if (!dropped) { + continue; + } + + const char *column_name = field->field_name; + int column_name_size = strlen(column_name); + + grn_obj *column_obj; + column_obj = grn_obj_column(ctx, table_obj, column_name, column_name_size); + if (column_obj) { + grn_obj_remove(ctx, column_obj); + } + if (ctx->rc) { + int error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + break; + } + } + grn_obj_unlink(ctx, table_obj); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table_rename_column( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + mrn::PathMapper mapper(share->table_name); + grn_obj *table_obj; + table_obj = grn_ctx_get(ctx, mapper.table_name(), strlen(mapper.table_name())); + + Alter_info *alter_info = ha_alter_info->alter_info; + uint n_fields = table->s->fields; + for (uint i = 0; i < n_fields; i++) { + Field *field = table->field[i]; + + if (!(field->flags & FIELD_IS_RENAMED)) { + continue; + } + + const char *new_name = NULL; + List_iterator_fast create_fields(alter_info->create_list); + while (Create_field *create_field = create_fields++) { + if (create_field->field == field) { + new_name = create_field->field_name; + break; + } + } + + if (!new_name) { + continue; + } + + const char *old_name = field->field_name; + grn_obj *column_obj; + column_obj = grn_obj_column(ctx, table_obj, old_name, strlen(old_name)); + if (column_obj) { + grn_column_rename(ctx, column_obj, new_name, strlen(new_name)); + if (ctx->rc) { + int error = ER_WRONG_COLUMN_NAME; + my_message(error, ctx->errbuf, MYF(0)); + have_error = true; + } + grn_obj_unlink(ctx, column_obj); + } + + if (have_error) { + break; + } + } + grn_obj_unlink(ctx, table_obj); + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::storage_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + + bool have_error = false; + + int error = mrn_change_encoding(ctx, system_charset_info); + if (error) { + have_error = true; + } + + Alter_inplace_info::HA_ALTER_FLAGS index_related_flags = + Alter_inplace_info::ADD_INDEX | + Alter_inplace_info::DROP_INDEX | + Alter_inplace_info::ADD_UNIQUE_INDEX | + Alter_inplace_info::DROP_UNIQUE_INDEX | + Alter_inplace_info::ADD_PK_INDEX | + Alter_inplace_info::DROP_PK_INDEX; + if (!have_error && + (ha_alter_info->handler_flags & index_related_flags)) { + have_error = storage_inplace_alter_table_index(altered_table, ha_alter_info); + } + + Alter_inplace_info::HA_ALTER_FLAGS add_column_related_flags = + Alter_inplace_info::ADD_COLUMN; + if (!have_error && + (ha_alter_info->handler_flags & add_column_related_flags)) { + have_error = storage_inplace_alter_table_add_column(altered_table, ha_alter_info); + } + + Alter_inplace_info::HA_ALTER_FLAGS drop_column_related_flags = + Alter_inplace_info::DROP_COLUMN; + if (!have_error && + (ha_alter_info->handler_flags & drop_column_related_flags)) { + have_error = storage_inplace_alter_table_drop_column(altered_table, ha_alter_info); + } + + Alter_inplace_info::HA_ALTER_FLAGS rename_column_related_flags = + Alter_inplace_info::ALTER_COLUMN_NAME; + if (!have_error && + (ha_alter_info->handler_flags & rename_column_related_flags)) { + have_error = storage_inplace_alter_table_rename_column(altered_table, ha_alter_info); + } + + DBUG_RETURN(have_error); +} + +bool ha_mroonga::inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_inplace_alter_table(altered_table, ha_alter_info); + } else { + result = storage_inplace_alter_table(altered_table, ha_alter_info); + } + DBUG_RETURN(result); +} + +bool ha_mroonga::wrapper_commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + bool result; + MRN_DBUG_ENTER_METHOD(); + if (!alter_handler_flags) { + my_free(alter_key_info_buffer, MYF(0)); + alter_key_info_buffer = NULL; + DBUG_RETURN(false); + } + MRN_SET_WRAP_ALTER_KEY(this, ha_alter_info); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + result = wrap_handler->ha_commit_inplace_alter_table(wrap_altered_table, + ha_alter_info, + commit); + MRN_SET_BASE_ALTER_KEY(this, ha_alter_info); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + my_free(alter_key_info_buffer, MYF(0)); + alter_key_info_buffer = NULL; + DBUG_RETURN(result); +} + +bool ha_mroonga::storage_commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(false); +} + +bool ha_mroonga::commit_inplace_alter_table( + TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + bool result; + if (share->wrapper_mode) { + result = wrapper_commit_inplace_alter_table(altered_table, ha_alter_info, + commit); + } else { + result = storage_commit_inplace_alter_table(altered_table, ha_alter_info, + commit); + } + DBUG_RETURN(result); +} + +void ha_mroonga::wrapper_notify_table_changed() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->ha_notify_table_changed(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_notify_table_changed() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::notify_table_changed() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) { + wrapper_notify_table_changed(); + } else { + storage_notify_table_changed(); + } + DBUG_VOID_RETURN; +} +#else +uint ha_mroonga::wrapper_alter_table_flags(uint flags) +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->alter_table_flags(flags); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_alter_table_flags(uint flags) +{ + MRN_DBUG_ENTER_METHOD(); + uint res = handler::alter_table_flags(flags); + DBUG_RETURN(res); +} + +uint ha_mroonga::alter_table_flags(uint flags) +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + if (share->wrapper_mode) + { + res = wrapper_alter_table_flags(flags); + } else { + res = storage_alter_table_flags(flags); + } + DBUG_RETURN(res); +} + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +#else +int ha_mroonga::wrapper_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +#endif +{ + int error = 0; + uint i, j, k; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, num_of_keys + n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, num_of_keys + n_keys); + THD *thd = ha_thd(); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **key_parser; + uint *key_parser_length; + MRN_DBUG_ENTER_METHOD(); + if (!(wrap_alter_key_info = (KEY *) my_malloc(sizeof(KEY) * num_of_keys, + MYF(MY_WME)))) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + KEY *p_key_info = &table->key_info[table_share->primary_key], *tmp_key_info; + tmp_table_share.keys = n_keys + num_of_keys; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &key_parser, sizeof(char *) * (n_keys + num_of_keys), + &key_parser_length, sizeof(uint) * (n_keys + num_of_keys), + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = NULL; + tmp_share->index_table_length = NULL; + tmp_share->key_parser = key_parser; + tmp_share->key_parser_length = key_parser_length; + tmp_share->col_flags = NULL; + tmp_share->col_type = NULL; +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + hnd_add_index = NULL; +#endif + bitmap_clear_all(table->read_set); + mrn_set_bitmap_by_key(table->read_set, p_key_info); + mrn::PathMapper mapper(share->table_name); + for (i = 0, j = 0; i < num_of_keys; i++) { + if (!(key_info[i].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[i])) { + wrap_alter_key_info[j] = key_info[i]; + j++; + continue; + } + if (share->disable_keys) { + continue; + } + if ((error = mrn_add_index_param(tmp_share, &key_info[i], i + n_keys))) + { + break; + } + index_tables[i + n_keys] = NULL; + if ( + (key_info[i].flags & HA_FULLTEXT) && + (error = wrapper_create_index_fulltext(mapper.table_name(), + i + n_keys, + &key_info[i], index_tables, NULL, + tmp_share)) + ) { + break; + } else if ( + mrn_is_geo_key(&key_info[i]) && + (error = wrapper_create_index_geo(mapper.table_name(), + i + n_keys, &key_info[i], + index_tables, NULL, tmp_share)) + ) { + break; + } + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + } + if (!error && i > j && !share->disable_keys) { + for (k = 0; k < num_of_keys; k++) { + tmp_key_info = &key_info[k]; + if (!(tmp_key_info->flags & HA_FULLTEXT) && + !mrn_is_geo_key(tmp_key_info)) { + continue; + } + index_columns[k + n_keys] = grn_obj_column(ctx, + index_tables[k + n_keys], + INDEX_COLUMN_NAME, + strlen(INDEX_COLUMN_NAME)); + } + error = wrapper_fill_indexes(thd, key_info, &index_columns[n_keys], + num_of_keys); + } + bitmap_set_all(table->read_set); + + if (!error && j) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + error = wrap_handler->add_index(table_arg, wrap_alter_key_info, j, + &hnd_add_index); +#else + error = wrap_handler->add_index(table_arg, wrap_alter_key_info, j); +#endif + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + if (error) + { + for (k = 0; k < i; k++) { + if (!(key_info[k].flags & HA_FULLTEXT) && !mrn_is_geo_key(&key_info[k])) + { + continue; + } + if (index_tables[k + n_keys]) + { + grn_obj_remove(ctx, index_tables[k + n_keys]); + } + } + } +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + else { + *add = new handler_add_index(table_arg, key_info, num_of_keys); + } +#endif + mrn_free_share_alloc(tmp_share); + my_free(tmp_share, MYF(0)); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +#else +int ha_mroonga::storage_add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +#endif +{ + int error = 0; + uint i; + uint n_keys = table->s->keys; + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_tables, num_of_keys + n_keys); + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(grn_obj *, index_columns, num_of_keys + n_keys); + MRN_SHARE *tmp_share; + TABLE_SHARE tmp_table_share; + char **index_table, **key_parser, **col_flags, **col_type; + uint *index_table_length, *key_parser_length, *col_flags_length, *col_type_length; + bool have_multiple_column_index = false; + + MRN_DBUG_ENTER_METHOD(); + tmp_table_share.keys = n_keys + num_of_keys; + tmp_table_share.fields = 0; + if (!(tmp_share = (MRN_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &tmp_share, sizeof(*tmp_share), + &index_table, sizeof(char*) * tmp_table_share.keys, + &index_table_length, sizeof(uint) * tmp_table_share.keys, + &key_parser, sizeof(char *) * tmp_table_share.keys, + &key_parser_length, sizeof(uint) * tmp_table_share.keys, + &col_flags, sizeof(char *) * tmp_table_share.fields, + &col_flags_length, sizeof(uint) * tmp_table_share.fields, + &col_type, sizeof(char *) * tmp_table_share.fields, + &col_type_length, sizeof(uint) * tmp_table_share.fields, + NullS)) + ) { + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + tmp_share->engine = NULL; + tmp_share->table_share = &tmp_table_share; + tmp_share->index_table = index_table; + tmp_share->index_table_length = index_table_length; + tmp_share->key_parser = key_parser; + tmp_share->key_parser_length = key_parser_length; + tmp_share->col_flags = col_flags; + tmp_share->col_flags_length = col_flags_length; + tmp_share->col_type = col_type; + tmp_share->col_type_length = col_type_length; + bitmap_clear_all(table->read_set); + mrn::PathMapper mapper(share->table_name); + for (i = 0; i < num_of_keys; i++) { + if (share->disable_keys && !(key_info[i].flags & HA_NOSAME)) { + continue; // key is disabled + } + index_tables[i + n_keys] = NULL; + index_columns[i + n_keys] = NULL; + if ((error = mrn_add_index_param(tmp_share, &key_info[i], i + n_keys))) + { + break; + } + if ((error = storage_create_index(table, mapper.table_name(), grn_table, + tmp_share, &key_info[i], index_tables, + index_columns, i + n_keys))) + { + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) == 1 && + (key_info[i].flags & HA_NOSAME) && + grn_table_size(ctx, grn_table) != + grn_table_size(ctx, index_tables[i + n_keys]) + ) { + error = HA_ERR_FOUND_DUPP_UNIQUE; + i++; + break; + } + if ( + KEY_N_KEY_PARTS(&(key_info[i])) != 1 && + !(key_info[i].flags & HA_FULLTEXT) + ) { + mrn_set_bitmap_by_key(table->read_set, &key_info[i]); + have_multiple_column_index = true; + } + } + if (!error && have_multiple_column_index) + { + error = storage_add_index_multiple_columns(key_info, num_of_keys, + index_tables + n_keys, + index_columns + n_keys, false); + } + bitmap_set_all(table->read_set); + if (error) + { + for (uint j = 0; j < i; j++) { + if (index_tables[j + n_keys]) + { + grn_obj_remove(ctx, index_columns[j + n_keys]); + grn_obj_remove(ctx, index_tables[j + n_keys]); + } + } + } +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + else { + *add = new handler_add_index(table_arg, key_info, num_of_keys); + } +#endif + mrn_free_share_alloc(tmp_share); + my_free(tmp_share, MYF(0)); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_tables); + MRN_FREE_VARIABLE_LENGTH_ARRAYS(index_columns); + DBUG_RETURN(error); +} +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys, handler_add_index **add) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_add_index(table_arg, key_info, num_of_keys, add); + } else { + error = storage_add_index(table_arg, key_info, num_of_keys, add); + } + DBUG_RETURN(error); +} +#else +int ha_mroonga::add_index(TABLE *table_arg, KEY *key_info, + uint num_of_keys) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_add_index(table_arg, key_info, num_of_keys); + } else { + error = storage_add_index(table_arg, key_info, num_of_keys); + } + DBUG_RETURN(error); +} +#endif + +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX +int ha_mroonga::wrapper_final_add_index(handler_add_index *add, bool commit) +{ + int error = 0; + MRN_DBUG_ENTER_METHOD(); + if (hnd_add_index) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + error = wrap_handler->final_add_index(hnd_add_index, commit); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + if (add) + { + delete add; + } + DBUG_RETURN(error); +} + +int ha_mroonga::storage_final_add_index(handler_add_index *add, bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + if (add) + { + delete add; + } + DBUG_RETURN(0); +} + +int ha_mroonga::final_add_index(handler_add_index *add, bool commit) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) + { + error = wrapper_final_add_index(add, commit); + } else { + error = storage_final_add_index(add, commit); + } + DBUG_RETURN(error); +} +#endif + +int ha_mroonga::wrapper_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + int res = 0; + uint i, j; + KEY *key_info = table_share->key_info; + MRN_DBUG_ENTER_METHOD(); + res = mrn_change_encoding(ctx, system_charset_info); + if (res) + DBUG_RETURN(res); + + MRN_ALLOCATE_VARIABLE_LENGTH_ARRAYS(uint, wrap_key_num, num_of_keys); + for (i = 0, j = 0; i < num_of_keys; i++) { + uint key_index = key_num[i]; + if (!(key_info[key_index].flags & HA_FULLTEXT) && + !mrn_is_geo_key(&key_info[key_index])) { + wrap_key_num[j] = share->wrap_key_nr[key_index]; + j++; + continue; + } + + res = drop_index(share, key_index); + if (res) + DBUG_RETURN(res); + grn_index_tables[key_index] = NULL; + grn_index_columns[key_index] = NULL; + } + if (j) + { + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->prepare_drop_index(table_arg, wrap_key_num, j); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + } + MRN_FREE_VARIABLE_LENGTH_ARRAYS(wrap_key_num); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + int error; + uint i; + MRN_DBUG_ENTER_METHOD(); + error = mrn_change_encoding(ctx, system_charset_info); + if (error) + DBUG_RETURN(error); + + for (i = 0; i < num_of_keys; i++) { + uint key_index = key_num[i]; + error = drop_index(share, key_index); + if (error) + break; + grn_index_tables[key_index] = NULL; + grn_index_columns[key_index] = NULL; + } + DBUG_RETURN(error); +} + +int ha_mroonga::prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_prepare_drop_index(table_arg, key_num, num_of_keys); + } else { + res = storage_prepare_drop_index(table_arg, key_num, num_of_keys); + } + DBUG_RETURN(res); +} + +int ha_mroonga::wrapper_final_drop_index(TABLE *table_arg) +{ + uint res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->final_drop_index(table_arg); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_final_drop_index(TABLE *table_arg) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_RETURN(0); +} + +int ha_mroonga::final_drop_index(TABLE *table_arg) +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + if (share->wrapper_mode) + { + res = wrapper_final_drop_index(table_arg); + } else { + res = storage_final_drop_index(table_arg); + } + DBUG_RETURN(res); +} +#endif + +int ha_mroonga::wrapper_update_auto_increment() +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->update_auto_increment(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_update_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::update_auto_increment(); + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + table->next_number_field->val_int())); + DBUG_RETURN(res); +} + +int ha_mroonga::update_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_update_auto_increment(); + } else { + res = storage_update_auto_increment(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->set_next_insert_id(id); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + handler::set_next_insert_id(id); + DBUG_VOID_RETURN; +} + +void ha_mroonga::set_next_insert_id(ulonglong id) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_set_next_insert_id(id); + } else { + storage_set_next_insert_id(id); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_get_auto_increment(ulonglong offset, + ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_get_auto_increment(ulonglong offset, + ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + if (table->found_next_number_field && + !table->s->next_number_keypart) { + if (long_term_share->auto_inc_inited) { + *first_value = long_term_share->auto_inc_value; + DBUG_PRINT("info", ("mroonga: *first_value(auto_inc_value)=%llu", + *first_value)); + *nb_reserved_values = ULONGLONG_MAX; + } else { + handler::get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + long_term_share->auto_inc_value = *first_value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + } + } else { + handler::get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + } else { + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + mrn::Lock lock(&long_term_share->auto_inc_mutex); + storage_get_auto_increment(offset, increment, nb_desired_values, + first_value, nb_reserved_values); + long_term_share->auto_inc_value += nb_desired_values * increment; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->restore_auto_increment(prev_insert_id); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + handler::restore_auto_increment(prev_insert_id); + DBUG_VOID_RETURN; +} + +void ha_mroonga::restore_auto_increment(ulonglong prev_insert_id) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_restore_auto_increment(prev_insert_id); + } else { + storage_restore_auto_increment(prev_insert_id); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->ha_release_auto_increment(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::release_auto_increment() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_release_auto_increment(); + } else { + storage_release_auto_increment(); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + int error = wrap_handler->ha_check_for_upgrade(check_opt); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(error); +} + +int ha_mroonga::storage_check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < table->s->fields; ++i) { + grn_obj *column = grn_columns[i]; + if (!column) { + continue; + } + Field *field = table->field[i]; + grn_id column_range = grn_obj_get_range(ctx, column); + switch (field->real_type()) { + case MYSQL_TYPE_ENUM: + if (column_range != GRN_DB_UINT16) { + DBUG_RETURN(HA_ADMIN_NEEDS_ALTER); + } + break; + case MYSQL_TYPE_SET: + if (column_range != GRN_DB_UINT64) { + DBUG_RETURN(HA_ADMIN_NEEDS_ALTER); + } + break; + default: + break; + } + } + DBUG_RETURN(HA_ADMIN_OK); +} + +int ha_mroonga::check_for_upgrade(HA_CHECK_OPT *check_opt) +{ + MRN_DBUG_ENTER_METHOD(); + int error; + if (share->wrapper_mode) { + error = wrapper_check_for_upgrade(check_opt); + } else { + error = storage_check_for_upgrade(check_opt); + } + DBUG_RETURN(error); +} + +int ha_mroonga::wrapper_reset_auto_increment(ulonglong value) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->ha_reset_auto_increment(value); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_reset_auto_increment(ulonglong value) +{ + MRN_LONG_TERM_SHARE *long_term_share = share->long_term_share; + MRN_DBUG_ENTER_METHOD(); + mrn::Lock lock(&long_term_share->auto_inc_mutex); + long_term_share->auto_inc_value = value; + DBUG_PRINT("info", ("mroonga: auto_inc_value=%llu", + long_term_share->auto_inc_value)); + long_term_share->auto_inc_inited = true; + DBUG_RETURN(0); +} + +int ha_mroonga::reset_auto_increment(ulonglong value) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_reset_auto_increment(value); + } else { + res = storage_reset_auto_increment(value); + } + DBUG_RETURN(res); +} + +void ha_mroonga::set_pk_bitmap() +{ + KEY key_info = table->key_info[table_share->primary_key]; + uint j; + MRN_DBUG_ENTER_METHOD(); + for (j = 0; j < KEY_N_KEY_PARTS(&key_info); j++) { + Field *field = key_info.key_part[j].field; + bitmap_set_bit(table->read_set, field->field_index); + } + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->was_semi_consistent_read(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + res = handler::was_semi_consistent_read(); + DBUG_RETURN(res); +} + +bool ha_mroonga::was_semi_consistent_read() +{ + bool res; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + res = wrapper_was_semi_consistent_read(); + } else { + res = storage_was_semi_consistent_read(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->try_semi_consistent_read(yes); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + handler::try_semi_consistent_read(yes); + DBUG_VOID_RETURN; +} + +void ha_mroonga::try_semi_consistent_read(bool yes) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_try_semi_consistent_read(yes); + } else { + storage_try_semi_consistent_read(yes); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->unlock_row(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + handler::unlock_row(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::unlock_row() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_unlock_row(); + } else { + storage_unlock_row(); + } + DBUG_VOID_RETURN; +} + +int ha_mroonga::wrapper_start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->start_stmt(thd, lock_type); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + res = handler::start_stmt(thd, lock_type); + DBUG_RETURN(res); +} + +int ha_mroonga::start_stmt(THD *thd, thr_lock_type lock_type) +{ + int res; + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + res = wrapper_start_stmt(thd, lock_type); + } else { + res = storage_start_stmt(thd, lock_type); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_change_table_ptr(TABLE *table_arg, + TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->change_table_ptr(table_arg, share->wrap_table_share); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_change_table_ptr(TABLE *table_arg, + TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg) +{ + MRN_DBUG_ENTER_METHOD(); + handler::change_table_ptr(table_arg, share_arg); + if (share && share->wrapper_mode) + { + wrapper_change_table_ptr(table_arg, share_arg); + } else { + storage_change_table_ptr(table_arg, share_arg); + } + DBUG_VOID_RETURN; +} + +bool ha_mroonga::wrapper_primary_key_is_clustered() +{ + MRN_DBUG_ENTER_METHOD(); + bool is_clustered; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + is_clustered = wrap_handler->primary_key_is_clustered(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(is_clustered); +} + +bool ha_mroonga::storage_primary_key_is_clustered() +{ + MRN_DBUG_ENTER_METHOD(); + bool is_clustered = handler::primary_key_is_clustered(); + DBUG_RETURN(is_clustered); +} + +bool ha_mroonga::primary_key_is_clustered() +{ + MRN_DBUG_ENTER_METHOD(); + bool is_clustered; + if (share && share->wrapper_mode) + { + is_clustered = wrapper_primary_key_is_clustered(); + } else { + is_clustered = storage_primary_key_is_clustered(); + } + DBUG_RETURN(is_clustered); +} + +bool ha_mroonga::wrapper_is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->is_fk_defined_on_table_or_index(index); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res = handler::is_fk_defined_on_table_or_index(index); + DBUG_RETURN(res); +} + +bool ha_mroonga::is_fk_defined_on_table_or_index(uint index) +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if (share->wrapper_mode) + { + res = wrapper_is_fk_defined_on_table_or_index(index); + } else { + res = storage_is_fk_defined_on_table_or_index(index); + } + DBUG_RETURN(res); +} + +char *ha_mroonga::wrapper_get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_foreign_key_create_info(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +char *ha_mroonga::storage_get_foreign_key_create_info() +{ + int error; + uint i; + grn_obj *column; + uint n_columns = table_share->fields; + char create_info_buff[2048], *create_info; + String create_info_str(create_info_buff, sizeof(create_info_buff), + system_charset_info); + MRN_DBUG_ENTER_METHOD(); + create_info_str.length(0); + for (i = 0; i < n_columns; ++i) { + Field *field = table_share->field[i]; + const char *column_name = field->field_name; + uint column_name_size = strlen(column_name); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + + column = grn_obj_column(ctx, grn_table, + column_name, column_name_size); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + if (ref_table->header.type != GRN_TABLE_NO_KEY && + ref_table->header.type != GRN_TABLE_HASH_KEY && + ref_table->header.type != GRN_TABLE_PAT_KEY && + ref_table->header.type != GRN_TABLE_DAT_KEY) { + continue; + } + char ref_table_buff[NAME_LEN + 1]; + int ref_table_name_length = grn_obj_name(ctx, ref_table, ref_table_buff, + NAME_LEN); + ref_table_buff[ref_table_name_length] = '\0'; + + if (create_info_str.reserve(15)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(",\n CONSTRAINT ", 15); + append_identifier(ha_thd(), &create_info_str, column_name, + column_name_size); + if (create_info_str.reserve(14)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(" FOREIGN KEY (", 14); + append_identifier(ha_thd(), &create_info_str, column_name, + column_name_size); + if (create_info_str.reserve(13)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(") REFERENCES ", 13); + append_identifier(ha_thd(), &create_info_str, table_share->db.str, + table_share->db.length); + if (create_info_str.reserve(1)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(".", 1); + append_identifier(ha_thd(), &create_info_str, ref_table_buff, + ref_table_name_length); + if (create_info_str.reserve(2)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(" (", 2); + + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table_share->db.str, ref_table_buff, "", 0); + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(table_share->db.str, + table_share->db.length, + ref_table_buff, + ref_table_name_length, + ref_table_buff, TL_WRITE); +#else + table_list.init_one_table(table_share->db.str, + ref_table_buff, + TL_WRITE); +#endif + mrn_open_mutex_lock(table_share); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table_share); + if (!tmp_ref_table_share) { + DBUG_RETURN(NULL); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + Field *ref_field = &ref_key_info->key_part->field[0]; + append_identifier(ha_thd(), &create_info_str, ref_field->field_name, + strlen(ref_field->field_name)); + mrn_open_mutex_lock(table_share); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table_share); + if (create_info_str.reserve(39)) { + DBUG_RETURN(NULL); + } + create_info_str.q_append(") ON DELETE RESTRICT ON UPDATE RESTRICT", 39); + } + if (!(create_info = (char *) my_malloc(create_info_str.length() + 1, + MYF(MY_WME)))) { + DBUG_RETURN(NULL); + } + memcpy(create_info, create_info_str.ptr(), create_info_str.length()); + create_info[create_info_str.length()] = '\0'; + DBUG_RETURN(create_info); +} +#else +char *ha_mroonga::storage_get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res = handler::get_foreign_key_create_info(); + DBUG_RETURN(res); +} +#endif + +char *ha_mroonga::get_foreign_key_create_info() +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + if (share->wrapper_mode) + { + res = wrapper_get_foreign_key_create_info(); + } else { + res = storage_get_foreign_key_create_info(); + } + DBUG_RETURN(res); +} + +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME +char *ha_mroonga::wrapper_get_tablespace_name(THD *thd, char *name, + uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_tablespace_name(thd, name, name_len); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +char *ha_mroonga::storage_get_tablespace_name(THD *thd, char *name, + uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res = handler::get_tablespace_name(thd, name, name_len); + DBUG_RETURN(res); +} + +char *ha_mroonga::get_tablespace_name(THD *thd, char *name, uint name_len) +{ + MRN_DBUG_ENTER_METHOD(); + char *res; + if (share->wrapper_mode) + { + res = wrapper_get_tablespace_name(thd, name, name_len); + } else { + res = storage_get_tablespace_name(thd, name, name_len); + } + DBUG_RETURN(res); +} +#endif + +bool ha_mroonga::wrapper_can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->can_switch_engines(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +bool ha_mroonga::storage_can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res = handler::can_switch_engines(); + DBUG_RETURN(res); +} + +bool ha_mroonga::can_switch_engines() +{ + MRN_DBUG_ENTER_METHOD(); + bool res; + if (share->wrapper_mode) + { + res = wrapper_can_switch_engines(); + } else { + res = storage_can_switch_engines(); + } + DBUG_RETURN(res); +} + +int ha_mroonga::wrapper_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_foreign_key_list(thd, f_key_list); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +int ha_mroonga::storage_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + int error; + uint i; + grn_obj *column; + uint n_columns = table_share->fields; + MRN_DBUG_ENTER_METHOD(); + for (i = 0; i < n_columns; ++i) { + Field *field = table_share->field[i]; + const char *column_name = field->field_name; + uint column_name_size = strlen(column_name); + + if (strcmp(MRN_COLUMN_NAME_ID, column_name) == 0) { + continue; + } + + column = grn_obj_column(ctx, grn_table, + column_name, column_name_size); + if (!column) { + continue; + } + grn_id ref_table_id = grn_obj_get_range(ctx, column); + grn_obj *ref_table = grn_ctx_at(ctx, ref_table_id); + if (ref_table->header.type != GRN_TABLE_NO_KEY && + ref_table->header.type != GRN_TABLE_HASH_KEY && + ref_table->header.type != GRN_TABLE_PAT_KEY && + ref_table->header.type != GRN_TABLE_DAT_KEY) { + continue; + } + FOREIGN_KEY_INFO f_key_info; + f_key_info.foreign_id = thd_make_lex_string(thd, NULL, column_name, + column_name_size, TRUE); + f_key_info.foreign_db = thd_make_lex_string(thd, NULL, + table_share->db.str, + table_share->db.length, + TRUE); + f_key_info.foreign_table = thd_make_lex_string(thd, NULL, + table_share->table_name.str, + table_share->table_name.length, + TRUE); + f_key_info.referenced_db = f_key_info.foreign_db; + + char ref_table_buff[NAME_LEN + 1]; + int ref_table_name_length = grn_obj_name(ctx, ref_table, ref_table_buff, + NAME_LEN); + ref_table_buff[ref_table_name_length] = '\0'; + DBUG_PRINT("info", ("mroonga: ref_table_buff=%s", ref_table_buff)); + DBUG_PRINT("info", ("mroonga: ref_table_name_length=%d", ref_table_name_length)); + f_key_info.referenced_table = thd_make_lex_string(thd, NULL, + ref_table_buff, + ref_table_name_length, + TRUE); + f_key_info.update_method = thd_make_lex_string(thd, NULL, "RESTRICT", + 8, TRUE); + f_key_info.delete_method = thd_make_lex_string(thd, NULL, "RESTRICT", + 8, TRUE); + f_key_info.referenced_key_name = thd_make_lex_string(thd, NULL, "PRIMARY", + 7, TRUE); + LEX_STRING *field_name = thd_make_lex_string(thd, NULL, column_name, + column_name_size, TRUE); + f_key_info.foreign_fields.push_back(field_name); + + char ref_path[FN_REFLEN + 1]; + TABLE_LIST table_list; + TABLE_SHARE *tmp_ref_table_share; + build_table_filename(ref_path, sizeof(ref_path) - 1, + table_share->db.str, ref_table_buff, "", 0); + DBUG_PRINT("info", ("mroonga: ref_path=%s", ref_path)); +#ifdef MRN_TABLE_LIST_INIT_REQUIRE_ALIAS + table_list.init_one_table(table_share->db.str, + table_share->db.length, + ref_table_buff, + ref_table_name_length, + ref_table_buff, TL_WRITE); +#else + table_list.init_one_table(table_share->db.str, + ref_table_buff, + TL_WRITE); +#endif + mrn_open_mutex_lock(table_share); + tmp_ref_table_share = + mrn_create_tmp_table_share(&table_list, ref_path, &error); + mrn_open_mutex_unlock(table_share); + if (!tmp_ref_table_share) { + DBUG_RETURN(error); + } + uint ref_pkey_nr = tmp_ref_table_share->primary_key; + KEY *ref_key_info = &tmp_ref_table_share->key_info[ref_pkey_nr]; + Field *ref_field = &ref_key_info->key_part->field[0]; + LEX_STRING *ref_col_name = thd_make_lex_string(thd, NULL, + ref_field->field_name, + strlen(ref_field->field_name), + TRUE); + f_key_info.referenced_fields.push_back(ref_col_name); + mrn_open_mutex_lock(table_share); + mrn_free_tmp_table_share(tmp_ref_table_share); + mrn_open_mutex_unlock(table_share); + FOREIGN_KEY_INFO *p_f_key_info = + (FOREIGN_KEY_INFO *) thd_memdup(thd, &f_key_info, + sizeof(FOREIGN_KEY_INFO)); + if (!p_f_key_info) { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } + f_key_list->push_back(p_f_key_info); + } + DBUG_RETURN(0); +} +#else +int ha_mroonga::storage_get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::get_foreign_key_list(thd, f_key_list); + DBUG_RETURN(res); +} +#endif + +int ha_mroonga::get_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_get_foreign_key_list(thd, f_key_list); + } else { + res = storage_get_foreign_key_list(thd, f_key_list); + } + DBUG_RETURN(res); +} + +#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST +int ha_mroonga::wrapper_get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->get_parent_foreign_key_list(thd, f_key_list); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +int ha_mroonga::storage_get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res = handler::get_parent_foreign_key_list(thd, f_key_list); + DBUG_RETURN(res); +} + +int ha_mroonga::get_parent_foreign_key_list(THD *thd, + List *f_key_list) +{ + MRN_DBUG_ENTER_METHOD(); + int res; + if (share->wrapper_mode) + { + res = wrapper_get_parent_foreign_key_list(thd, f_key_list); + } else { + res = storage_get_parent_foreign_key_list(thd, f_key_list); + } + DBUG_RETURN(res); +} +#endif + +uint ha_mroonga::wrapper_referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->referenced_by_foreign_key(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +uint ha_mroonga::storage_referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res = handler::referenced_by_foreign_key(); + DBUG_RETURN(res); +} + +uint ha_mroonga::referenced_by_foreign_key() +{ + MRN_DBUG_ENTER_METHOD(); + uint res; + if (share->wrapper_mode) + { + res = wrapper_referenced_by_foreign_key(); + } else { + res = storage_referenced_by_foreign_key(); + } + DBUG_RETURN(res); +} + +void ha_mroonga::wrapper_init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->init_table_handle_for_HANDLER(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + handler::init_table_handle_for_HANDLER(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::init_table_handle_for_HANDLER() +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_init_table_handle_for_HANDLER(); + } else { + storage_init_table_handle_for_HANDLER(); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->free_foreign_key_create_info(str); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +#ifdef MRN_SUPPORT_FOREIGN_KEYS +void ha_mroonga::storage_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + my_free(str, MYF(0)); + DBUG_VOID_RETURN; +} +#else +void ha_mroonga::storage_free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + handler::free_foreign_key_create_info(str); + DBUG_VOID_RETURN; +} +#endif + +void ha_mroonga::free_foreign_key_create_info(char* str) +{ + MRN_DBUG_ENTER_METHOD(); + if (share->wrapper_mode) + { + wrapper_free_foreign_key_create_info(str); + } else { + storage_free_foreign_key_create_info(str); + } + DBUG_VOID_RETURN; +} + +bool ha_mroonga::check_written_by_row_based_binlog() +{ + MRN_DBUG_ENTER_METHOD(); + THD *thd = ha_thd(); + + int current_stmt_binlog_row; +#ifdef MRN_ROW_BASED_CHECK_IS_METHOD + current_stmt_binlog_row = thd->is_current_stmt_binlog_format_row(); +#else + current_stmt_binlog_row = thd->current_stmt_binlog_row_based; +#endif + if (!current_stmt_binlog_row) { + DBUG_RETURN(false); + } + + if (table->s->tmp_table != NO_TMP_TABLE) { + DBUG_RETURN(false); + } + + if (!mrn_binlog_filter->db_ok(table->s->db.str)) { + DBUG_RETURN(false); + } + + if (!thd_test_options(thd, OPTION_BIN_LOG)) { + DBUG_RETURN(false); + } + + if (!mysql_bin_log.is_open()) { + DBUG_RETURN(false); + } + + DBUG_RETURN(true); +} + +#ifdef MRN_HAVE_HA_REBIND_PSI +void ha_mroonga::wrapper_unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->unbind_psi(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::unbind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + handler::unbind_psi(); + if (share->wrapper_mode) + { + wrapper_unbind_psi(); + } else { + storage_unbind_psi(); + } + DBUG_VOID_RETURN; +} + +void ha_mroonga::wrapper_rebind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + wrap_handler->rebind_psi(); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_VOID_RETURN; +} + +void ha_mroonga::storage_rebind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + DBUG_VOID_RETURN; +} + +void ha_mroonga::rebind_psi() +{ + MRN_DBUG_ENTER_METHOD(); + handler::rebind_psi(); + if (share->wrapper_mode) + { + wrapper_rebind_psi(); + } else { + storage_rebind_psi(); + } + DBUG_VOID_RETURN; +} +#endif + +my_bool ha_mroonga::wrapper_register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res; + MRN_SET_WRAP_SHARE_KEY(share, table->s); + MRN_SET_WRAP_TABLE_KEY(this, table); + res = wrap_handler->register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + MRN_SET_BASE_SHARE_KEY(share, table->s); + MRN_SET_BASE_TABLE_KEY(this, table); + DBUG_RETURN(res); +} + +my_bool ha_mroonga::storage_register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res = handler::register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + DBUG_RETURN(res); +} + +my_bool ha_mroonga::register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data) +{ + MRN_DBUG_ENTER_METHOD(); + my_bool res; + if (share->wrapper_mode) + { + res = wrapper_register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + } else { + res = storage_register_query_cache_table(thd, + table_key, + key_length, + engine_callback, + engine_data); + } + DBUG_RETURN(res); +} + +#ifdef __cplusplus +} +#endif diff --git a/storage/mroonga/ha_mroonga.def b/storage/mroonga/ha_mroonga.def new file mode 100644 index 00000000000..5770cde72e7 --- /dev/null +++ b/storage/mroonga/ha_mroonga.def @@ -0,0 +1,15 @@ +LIBRARY ha_mroonga +VERSION 1.0 +EXPORTS + last_insert_grn_id + last_insert_grn_id_init + last_insert_grn_id_deinit + mroonga_snippet + mroonga_snippet_init + mroonga_snippet_deinit + mroonga_command + mroonga_command_init + mroonga_command_deinit + mroonga_escape + mroonga_escape_init + mroonga_escape_deinit diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp new file mode 100644 index 00000000000..224abb09732 --- /dev/null +++ b/storage/mroonga/ha_mroonga.hpp @@ -0,0 +1,1195 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef HA_MROONGA_HPP_ +#define HA_MROONGA_HPP_ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "mrn_mysql_compat.h" + +#if (MYSQL_VERSION_ID >= 50603) || \ + (MYSQL_VERSION_ID >= 50513 && MYSQL_VERSION_ID < 50600) || \ + (MYSQL_VERSION_ID >= 50158 && MYSQL_VERSION_ID < 50500) +# define MRN_HANDLER_CLONE_NEED_NAME 1 +#endif + +#if (MYSQL_VERSION_ID >= 50514 && MYSQL_VERSION_ID < 50600) +# define MRN_HANDLER_HAVE_FINAL_ADD_INDEX 1 +#endif + +#if (MYSQL_VERSION_ID >= 50603) || \ + (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50209) +# define MRN_HANDLER_HAVE_HA_RND_NEXT 1 +# define MRN_HANDLER_HAVE_HA_RND_POS 1 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_MAP 1 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP 1 +# define MRN_HANDLER_HAVE_HA_INDEX_NEXT 1 +# define MRN_HANDLER_HAVE_HA_INDEX_PREV 1 +# define MRN_HANDLER_HAVE_HA_INDEX_FIRST 1 +# define MRN_HANDLER_HAVE_HA_INDEX_LAST 1 +# define MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME 1 +#endif + +#if (MYSQL_VERSION_ID >= 50604) || \ + (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302) +# define MRN_HANDLER_HAVE_HA_CLOSE 1 +# define MRN_HANDLER_HAVE_MULTI_RANGE_READ 1 +#endif + +#if (MYSQL_VERSION_ID >= 50607) +# define MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER 1 +# define MRN_HANDLER_HAVE_HA_PREPARE_INPLACE_ALTER_TABLE 1 +# define MRN_HANDLER_HAVE_HA_INPLACE_ALTER_TABLE 1 +# define MRN_HANDLER_HAVE_HA_COMMIT_INPLACE_ALTER_TABLE 1 +# define MRN_SUPPORT_FOREIGN_KEYS 1 +#endif + +#ifndef MRN_MARIADB_P +# define MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP +# if MYSQL_VERSION_ID >= 50611 +# define MRN_HANDLER_HAVE_HA_INDEX_READ_LAST_MAP +# endif +#endif + +#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302) +# define MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS +#endif + +#if MYSQL_VERSION_ID >= 50500 +# define MRN_HANDLER_HAVE_TRUNCATE +# define MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST +#endif + +#if MYSQL_VERSION_ID < 50600 +# define MRN_HANDLER_HAVE_GET_TABLESPACE_NAME +#endif + +#if MYSQL_VERSION_ID >= 50607 +# define MRN_HANDLER_HAVE_SET_HA_SHARE_REF +#endif + +#if MYSQL_VERSION_ID >= 50500 +# define MRN_TABLE_LIST_INIT_REQUIRE_ALIAS +#endif + +#ifdef BIG_TABLES +# define MRN_HA_ROWS_FORMAT "llu" +#else +# define MRN_HA_ROWS_FORMAT "lu" +#endif + +#if (MYSQL_VERSION_ID < 50519) || \ + defined(MRN_MARIADB_P) || \ + (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID < 50604) +# define MRN_NEED_FREE_STRING_MEMALLOC_PLUGIN_VAR +#endif + +#if MYSQL_VERSION_ID >= 50500 +# define MRN_HAVE_HA_EXTRA_ADD_CHILDREN_LIST +# define MRN_HAVE_HA_EXTRA_IS_ATTACHED_CHILDREN +#endif + +#ifdef MRN_MARIADB_P +# define MRN_HAVE_HA_EXTRA_DETACH_CHILD +# define MRN_HAVE_HA_EXTRA_PREPARE_FOR_FORCED_CLOSE +#endif + +#if MYSQL_VERSION_ID >= 50607 && \ + (!defined(MRN_MARIADB_P) || MYSQL_VERSION_ID < 100008) +# define MRN_HAVE_HA_EXTRA_EXPORT +#endif + +#if MYSQL_VERSION_ID >= 50617 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_HA_EXTRA_SECONDARY_SORT_ROWID +#endif + +#if MYSQL_VERSION_ID >= 50604 && !defined(MRN_MARIADB_P) +# define MRN_TIMESTAMP_USE_TIMEVAL +#elif defined(MRN_MARIADB_P) +# define MRN_TIMESTAMP_USE_MY_TIME_T +#else +# define MRN_TIMESTAMP_USE_LONG +#endif + +#if MYSQL_VERSION_ID < 50600 && !defined(MRN_MARIADB_P) +# define MRN_FIELD_STORE_TIME_NEED_TYPE +#endif + +#if MYSQL_VERSION_ID < 50500 +# define MRN_HAVE_TL_WRITE_ALLOW_READ +#endif + +#if (defined(MRN_MARIADB_P) && \ + ((MYSQL_VERSION_ID >= 50306 && MYSQL_VERSION_ID < 50500) || \ + MYSQL_VERSION_ID >= 50523)) +# define MRN_HANDLER_AUTO_REPAIR_HAVE_ERROR +#endif + +#if MYSQL_VERSION_ID >= 50604 +# define MRN_JOIN_TAB_HAVE_CONDITION +#endif + +#if MYSQL_VERSION_ID < 50600 +# define MRN_RBR_UPDATE_NEED_ALL_COLUMNS +#endif + +#if MYSQL_VERSION_ID >= 50500 +# define MRN_ROW_BASED_CHECK_IS_METHOD +#endif + +#if MYSQL_VERSION_ID >= 50600 +# define MRN_HAVE_HA_REBIND_PSI +#endif + +#if MYSQL_VERSION_ID >= 50612 && !defined(MRN_MARIADB_P) +# define MRN_HAVE_POINT_XY +#endif + +#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100000) +# define MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS +#endif + +#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100010) +# define MRN_HAVE_TDC_LOCK_TABLE_SHARE +#endif + +class ha_mroonga; + +/* structs */ +struct st_mrn_ft_info +{ + struct _ft_vft *please; +#ifdef HA_CAN_FULLTEXT_EXT + struct _ft_vft_ext *could_you; +#endif + grn_ctx *ctx; + grn_encoding encoding; + grn_obj *table; + grn_obj *result; + grn_obj *score_column; + grn_obj key; + grn_obj score; + uint active_index; + KEY *key_info; + KEY *primary_key_info; + grn_obj *cursor; + grn_obj *id_accessor; + grn_obj *key_accessor; + ha_mroonga *mroonga; +}; + +/* handler class */ +class ha_mroonga: public handler +{ +public: + handler *wrap_handler; + bool is_clone; + ha_mroonga *parent_for_clone; + MEM_ROOT *mem_root_for_clone; + grn_obj key_buffer; + grn_id record_id; + grn_id *key_id; + grn_id *del_key_id; + MY_BITMAP multiple_column_key_bitmap; + +private: + THR_LOCK_DATA thr_lock_data; + + // for wrapper mode (TODO: need to be confirmed) + uint wrap_ft_init_count; + MRN_SHARE *share; + KEY *wrap_key_info; + KEY *base_key_info; + key_part_map pk_keypart_map; + MEM_ROOT mem_root; + /// for create table and alter table + mutable bool analyzed_for_create; + mutable TABLE table_for_create; + mutable MRN_SHARE share_for_create; + mutable TABLE_SHARE table_share_for_create; + mutable MEM_ROOT mem_root_for_create; + mutable handler *wrap_handler_for_create; +#ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + handler_add_index *hnd_add_index; +#endif +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + Alter_inplace_info::HA_ALTER_FLAGS alter_handler_flags; + KEY *alter_key_info_buffer; + uint alter_key_count; + uint alter_index_drop_count; + KEY *alter_index_drop_buffer; + uint alter_index_add_count; + uint *alter_index_add_buffer; + TABLE *wrap_altered_table; + KEY *wrap_altered_table_key_info; + TABLE_SHARE *wrap_altered_table_share; + KEY *wrap_altered_table_share_key_info; +#else + KEY *wrap_alter_key_info; +#endif + int mrn_lock_type; + + // for groonga objects + grn_ctx ctx_entity_; + grn_ctx *ctx; + grn_obj *grn_table; + grn_obj **grn_columns; + grn_obj **grn_column_ranges; + grn_obj **grn_index_tables; + grn_obj **grn_index_columns; + bool grn_table_is_referenced; + + // buffers + grn_obj encoded_key_buffer; + grn_obj old_value_buffer; + grn_obj new_value_buffer; + grn_obj top_left_point; + grn_obj bottom_right_point; + grn_obj source_point; + double top_left_longitude_in_degree; + double bottom_right_longitude_in_degree; + double bottom_right_latitude_in_degree; + double top_left_latitude_in_degree; + + // for search + grn_obj *grn_source_column_geo; + grn_obj *cursor_geo; + grn_table_cursor *cursor; + grn_table_cursor *index_table_cursor; + grn_obj *empty_value_records; + grn_table_cursor *empty_value_records_cursor; + grn_obj *sorted_result; + grn_obj *matched_record_keys; + String *blob_buffers; + + // for error report + uint dup_key; + + // for optimization + bool count_skip; + bool fast_order_limit; + bool fast_order_limit_with_index; + + // for context + bool ignoring_duplicated_key; + bool inserting_with_update; + bool fulltext_searching; + bool ignoring_no_key_columns; + bool replacing_; + uint written_by_row_based_binlog; + + // for ft in where clause test + Item_func_match *current_ft_item; + +public: + ha_mroonga(handlerton *hton, TABLE_SHARE *share_arg); + ~ha_mroonga(); + const char *table_type() const; // required + const char *index_type(uint inx); + const char **bas_ext() const; // required + + ulonglong table_flags() const; // required + ulong index_flags(uint idx, uint part, bool all_parts) const; // required + + int create(const char *name, TABLE *form, HA_CREATE_INFO *info); // required + int open(const char *name, int mode, uint test_if_locked); // required +#ifndef MRN_HANDLER_HAVE_HA_CLOSE + int close(); // required +#endif + int info(uint flag); // required + + uint lock_count() const; + THR_LOCK_DATA **store_lock(THD *thd, // required + THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + int external_lock(THD *thd, int lock_type); + + int rnd_init(bool scan); // required + int rnd_end(); +#ifndef MRN_HANDLER_HAVE_HA_RND_NEXT + int rnd_next(uchar *buf); // required +#endif +#ifndef MRN_HANDLER_HAVE_HA_RND_POS + int rnd_pos(uchar *buf, uchar *pos); // required +#endif + void position(const uchar *record); // required + int extra(enum ha_extra_function operation); + int extra_opt(enum ha_extra_function operation, ulong cache_size); + + int delete_table(const char *name); + int write_row(uchar *buf); + int update_row(const uchar *old_data, uchar *new_data); + int delete_row(const uchar *buf); + + uint max_supported_record_length() const; + uint max_supported_keys() const; + uint max_supported_key_parts(); + uint max_supported_key_length() const; + uint max_supported_key_part_length() const; + + ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); + int index_init(uint idx, bool sorted); + int index_end(); +#ifndef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + int index_read_map(uchar * buf, const uchar * key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); +#endif +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP + int index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_NEXT + int index_next(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_PREV + int index_prev(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_FIRST + int index_first(uchar *buf); +#endif +#ifndef MRN_HANDLER_HAVE_HA_INDEX_LAST + int index_last(uchar *buf); +#endif + int index_next_same(uchar *buf, const uchar *key, uint keylen); + + int read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted); + int read_range_next(); + + int ft_init(); + FT_INFO *ft_init_ext(uint flags, uint inx, String *key); + int ft_read(uchar *buf); + + const Item *cond_push(const Item *cond); + void cond_pop(); + + bool get_error_message(int error, String *buf); + + int reset(); + +#ifdef MRN_HANDLER_CLONE_NEED_NAME + handler *clone(const char *name, MEM_ROOT *mem_root); +#else + handler *clone(MEM_ROOT *mem_root); +#endif + uint8 table_cache_type(); +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ + ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, uint *bufsz, + uint *flags, Cost_estimate *cost); + ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, Cost_estimate *cost); + int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + int multi_range_read_next(range_id_t *range_info); +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + void start_bulk_insert(ha_rows rows, uint flags); +#else + void start_bulk_insert(ha_rows rows); +#endif + int end_bulk_insert(); + int delete_all_rows(); +#ifdef MRN_HANDLER_HAVE_TRUNCATE + int truncate(); +#endif // MRN_HANDLER_HAVE_TRUNCATE + double scan_time(); + double read_time(uint index, uint ranges, ha_rows rows); + const key_map *keys_to_use_for_scanning(); + ha_rows estimate_rows_upper_bound(); + void update_create_info(HA_CREATE_INFO* create_info); + int rename_table(const char *from, const char *to); + bool is_crashed() const; + bool auto_repair(int error) const; + bool auto_repair() const; + int disable_indexes(uint mode); + int enable_indexes(uint mode); + int check(THD* thd, HA_CHECK_OPT* check_opt); + int repair(THD* thd, HA_CHECK_OPT* check_opt); + bool check_and_repair(THD *thd); + int analyze(THD* thd, HA_CHECK_OPT* check_opt); + int optimize(THD* thd, HA_CHECK_OPT* check_opt); + bool is_fatal_error(int error_num, uint flags); + bool check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + enum_alter_inplace_result + check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); +#else + uint alter_table_flags(uint flags); +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); + int final_add_index(handler_add_index *add, bool commit); +# else + int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); +# endif + int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys); + int final_drop_index(TABLE *table_arg); +#endif + int update_auto_increment(); + void set_next_insert_id(ulonglong id); + void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, + ulonglong *first_value, ulonglong *nb_reserved_values); + void restore_auto_increment(ulonglong prev_insert_id); + void release_auto_increment(); + int check_for_upgrade(HA_CHECK_OPT *check_opt); + int reset_auto_increment(ulonglong value); + bool was_semi_consistent_read(); + void try_semi_consistent_read(bool yes); + void unlock_row(); + int start_stmt(THD *thd, thr_lock_type lock_type); + +protected: +#ifdef MRN_HANDLER_HAVE_HA_RND_NEXT + int rnd_next(uchar *buf); +#endif +#ifdef MRN_HANDLER_HAVE_HA_RND_POS + int rnd_pos(uchar *buf, uchar *pos); +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP + int index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT + int index_next(uchar *buf); +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_PREV + int index_prev(uchar *buf); +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_FIRST + int index_first(uchar *buf); +#endif +#ifdef MRN_HANDLER_HAVE_HA_INDEX_LAST + int index_last(uchar *buf); +#endif + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg); + bool primary_key_is_clustered(); + bool is_fk_defined_on_table_or_index(uint index); + char *get_foreign_key_create_info(); +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME + char *get_tablespace_name(THD *thd, char *name, uint name_len); +#endif + bool can_switch_engines(); + int get_foreign_key_list(THD *thd, List *f_key_list); +#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST + int get_parent_foreign_key_list(THD *thd, List *f_key_list); +#endif + uint referenced_by_foreign_key(); + void init_table_handle_for_HANDLER(); + void free_foreign_key_create_info(char* str); +#ifdef MRN_HAVE_HA_REBIND_PSI + void unbind_psi(); + void rebind_psi(); +#endif + my_bool register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback *engine_callback, + ulonglong *engine_data); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + bool prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit); + void notify_table_changed(); +#endif + +private: + void mkdir_p(const char *directory); + ulonglong file_size(const char *path); + + void push_warning_unsupported_spatial_index_search(enum ha_rkey_function flag); + void clear_cursor(); + void clear_cursor_geo(); + void clear_empty_value_records(); + void clear_search_result(); + void clear_search_result_geo(); + void clear_indexes(); + int alter_share_add(const char *path, TABLE_SHARE *table_share); + void remove_related_files(const char *base_path); + void remove_grn_obj_force(const char *name); + int drop_index(MRN_SHARE *target_share, uint key_index); + grn_obj *find_tokenizer(const char *name, int name_length); + grn_obj *find_normalizer(KEY *key_info); + bool find_token_filters(KEY *key_info, grn_obj *token_filters); + bool find_token_filters_put(grn_obj *token_filters, + const char *token_filter_name, + int token_filter_name_length); + bool find_token_filters_fill(grn_obj *token_filters, + const char *token_filter_names, + int token_filter_name_length); + int wrapper_get_record(uchar *buf, const uchar *key); + int wrapper_get_next_geo_record(uchar *buf); + int storage_get_next_record(uchar *buf); + void geo_store_rectangle(const uchar *rectangle); + int generic_geo_open_cursor(const uchar *key, enum ha_rkey_function find_flag); + +#ifdef MRN_HANDLER_HAVE_HA_CLOSE + int close(); +#endif + bool is_dry_write(); + bool is_enable_optimization(); + bool should_normalize(Field *field) const; + bool is_temporary_table_name(const char *name) const; + void check_count_skip(key_part_map start_key_part_map, + key_part_map end_key_part_map, bool fulltext); + bool is_grn_zero_column_value(grn_obj *column, grn_obj *value); + void check_fast_order_limit(grn_table_sort_key **sort_keys, int *n_sort_keys, + longlong *limit); + + long long int get_grn_time_from_timestamp_field(Field_timestamp *field); + + int generic_store_bulk_fixed_size_string(Field *field, grn_obj *buf); + int generic_store_bulk_variable_size_string(Field *field, grn_obj *buf); + int generic_store_bulk_integer(Field *field, grn_obj *buf); + int generic_store_bulk_unsigned_integer(Field *field, grn_obj *buf); + int generic_store_bulk_float(Field *field, grn_obj *buf); + int generic_store_bulk_timestamp(Field *field, grn_obj *buf); + int generic_store_bulk_date(Field *field, grn_obj *buf); + int generic_store_bulk_time(Field *field, grn_obj *buf); + int generic_store_bulk_datetime(Field *field, grn_obj *buf); + int generic_store_bulk_year(Field *field, grn_obj *buf); + int generic_store_bulk_new_date(Field *field, grn_obj *buf); +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + int generic_store_bulk_datetime2(Field *field, grn_obj *buf); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + int generic_store_bulk_time2(Field *field, grn_obj *buf); +#endif + int generic_store_bulk_new_decimal(Field *field, grn_obj *buf); + int generic_store_bulk_blob(Field *field, grn_obj *buf); + int generic_store_bulk_geometry(Field *field, grn_obj *buf); + int generic_store_bulk(Field *field, grn_obj *buf); + + void storage_store_field_string(Field *field, + const char *value, uint value_length); + void storage_store_field_integer(Field *field, + const char *value, uint value_length); + void storage_store_field_unsigned_integer(Field *field, + const char *value, + uint value_length); + void storage_store_field_float(Field *field, + const char *value, uint value_length); + void storage_store_field_timestamp(Field *field, + const char *value, uint value_length); + void storage_store_field_date(Field *field, + const char *value, uint value_length); + void storage_store_field_time(Field *field, + const char *value, uint value_length); + void storage_store_field_datetime(Field *field, + const char *value, uint value_length); + void storage_store_field_year(Field *field, + const char *value, uint value_length); + void storage_store_field_new_date(Field *field, + const char *value, uint value_length); +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + void storage_store_field_datetime2(Field *field, + const char *value, uint value_length); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + void storage_store_field_time2(Field *field, + const char *value, uint value_length); +#endif + void storage_store_field_blob(Field *field, + const char *value, uint value_length); + void storage_store_field_geometry(Field *field, + const char *value, uint value_length); + void storage_store_field(Field *field, const char *value, uint value_length); + void storage_store_field_column(Field *field, + int nth_column, grn_id record_id); + void storage_store_fields(uchar *buf, grn_id record_id); + void storage_store_fields_for_prep_update(const uchar *old_data, + uchar *new_data, + grn_id record_id); + void storage_store_fields_by_index(uchar *buf); + + int storage_encode_key_normalize_min_sort_chars(Field *field, + uchar *buf, + uint size); + int storage_encode_key_fixed_size_string(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_variable_size_string(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_timestamp(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_time(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_year(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_datetime(Field *field, const uchar *key, + uchar *buf, uint *size); +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + int storage_encode_key_timestamp2(Field *field, const uchar *key, + uchar *buf, uint *size); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + int storage_encode_key_datetime2(Field *field, const uchar *key, + uchar *buf, uint *size); +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + int storage_encode_key_time2(Field *field, const uchar *key, + uchar *buf, uint *size); +#endif + int storage_encode_key_enum(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key_set(Field *field, const uchar *key, + uchar *buf, uint *size); + int storage_encode_key(Field *field, const uchar *key, uchar *buf, uint *size); + int storage_encode_multiple_column_key(KEY *key_info, + const uchar *key, uint key_length, + uchar *buffer, uint *encoded_length); + int storage_encode_multiple_column_key_range(KEY *key_info, + const key_range *start, + const key_range *end, + uchar *min_buffer, + uint *min_encoded_size, + uchar *max_buffer, + uint *max_encoded_size); + + void set_pk_bitmap(); + int create_share_for_create() const; + int wrapper_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share); + int storage_create(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share); + int wrapper_create_index_fulltext_validate(KEY *key_info); + int wrapper_create_index_fulltext(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share); + int wrapper_create_index_geo(const char *grn_table_name, + int i, + KEY *key_info, + grn_obj **index_tables, + grn_obj **index_columns, + MRN_SHARE *tmp_share); + int wrapper_create_index(const char *name, TABLE *table, + HA_CREATE_INFO *info, MRN_SHARE *tmp_share, + const char *grn_table_name); + int storage_create_validate_pseudo_column(TABLE *table); +#ifdef MRN_SUPPORT_FOREIGN_KEYS + bool storage_create_foreign_key(TABLE *table, const char *grn_table_name, + Field *field, grn_obj *table_obj, int &error); +#endif + int storage_create_validate_index(TABLE *table); + int storage_create_index_table(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + uint i); + int storage_create_index(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share, + KEY *key_info, grn_obj **index_tables, + grn_obj **index_columns, uint i); + int storage_create_indexes(TABLE *table, const char *grn_table_name, + grn_obj *grn_table, MRN_SHARE *tmp_share); + int close_databases(); + int ensure_database_open(const char *name); + int ensure_database_remove(const char *name); + int wrapper_delete_table(const char *name, MRN_SHARE *tmp_share, + const char *table_name); + int wrapper_delete_index(const char *name, MRN_SHARE *tmp_share, + const char *table_name); + int storage_delete_table(const char *name, MRN_SHARE *tmp_share, + const char *table_name); + int wrapper_open(const char *name, int mode, uint test_if_locked); + int wrapper_open_indexes(const char *name); + int storage_open(const char *name, int mode, uint test_if_locked); + void update_grn_table_is_referenced(); + int open_table(const char *name); + int storage_open_columns(void); + int storage_open_indexes(const char *name); + void wrapper_overwrite_index_bits(); + int wrapper_close(); + int storage_close(); + int generic_extra(enum ha_extra_function operation); + int wrapper_extra(enum ha_extra_function operation); + int storage_extra(enum ha_extra_function operation); + int wrapper_extra_opt(enum ha_extra_function operation, ulong cache_size); + int storage_extra_opt(enum ha_extra_function operation, ulong cache_size); + int generic_reset(); + int wrapper_reset(); + int storage_reset(); + uint wrapper_lock_count() const; + uint storage_lock_count() const; + THR_LOCK_DATA **wrapper_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + THR_LOCK_DATA **storage_store_lock(THD *thd, THR_LOCK_DATA **to, + enum thr_lock_type lock_type); + int wrapper_external_lock(THD *thd, int lock_type); + int storage_external_lock(THD *thd, int lock_type); +#ifdef MRN_HANDLER_START_BULK_INSERT_HAS_FLAGS + void wrapper_start_bulk_insert(ha_rows rows, uint flags); + void storage_start_bulk_insert(ha_rows rows, uint flags); +#else + void wrapper_start_bulk_insert(ha_rows rows); + void storage_start_bulk_insert(ha_rows rows); +#endif + int wrapper_end_bulk_insert(); + int storage_end_bulk_insert(); + bool wrapper_is_target_index(KEY *key_info); + bool wrapper_have_target_index(); + int wrapper_write_row(uchar *buf); + int wrapper_write_row_index(uchar *buf); + int storage_write_row(uchar *buf); + int storage_write_row_multiple_column_index(uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_column); + int storage_write_row_multiple_column_indexes(uchar *buf, grn_id record_id); + int storage_write_row_unique_index(uchar *buf, + KEY *key_info, grn_obj *index_table, + grn_id *key_id); + int storage_write_row_unique_indexes(uchar *buf); + int wrapper_get_record_id(uchar *data, grn_id *record_id, const char *context); + int wrapper_update_row(const uchar *old_data, uchar *new_data); + int wrapper_update_row_index(const uchar *old_data, uchar *new_data); + int storage_update_row(const uchar *old_data, uchar *new_data); + int storage_update_row_index(const uchar *old_data, uchar *new_data); + int storage_update_row_unique_indexes(uchar *new_data); + int wrapper_delete_row(const uchar *buf); + int wrapper_delete_row_index(const uchar *buf); + int storage_delete_row(const uchar *buf); + int storage_delete_row_index(const uchar *buf); + int storage_delete_row_unique_index(grn_obj *index_table, grn_id del_key_id); + int storage_delete_row_unique_indexes(); + int storage_prepare_delete_row_unique_index(const uchar *buf, + grn_id record_id, + KEY *key_info, + grn_obj *index_table, + grn_obj *index_column, + grn_id *del_key_id); + int storage_prepare_delete_row_unique_indexes(const uchar *buf, + grn_id record_id); + uint wrapper_max_supported_record_length() const; + uint storage_max_supported_record_length() const; + uint wrapper_max_supported_keys() const; + uint storage_max_supported_keys() const; + uint wrapper_max_supported_key_parts(); + uint storage_max_supported_key_parts(); + uint wrapper_max_supported_key_length() const; + uint storage_max_supported_key_length() const; + uint wrapper_max_supported_key_part_length() const; + uint storage_max_supported_key_part_length() const; + ulonglong wrapper_table_flags() const; + ulonglong storage_table_flags() const; + ulong wrapper_index_flags(uint idx, uint part, bool all_parts) const; + ulong storage_index_flags(uint idx, uint part, bool all_parts) const; + int wrapper_info(uint flag); + int storage_info(uint flag); + void storage_info_variable(); + void storage_info_variable_records(); + void storage_info_variable_data_file_length(); + int wrapper_rnd_init(bool scan); + int storage_rnd_init(bool scan); + int wrapper_rnd_end(); + int storage_rnd_end(); + int wrapper_rnd_next(uchar *buf); + int storage_rnd_next(uchar *buf); + int wrapper_rnd_pos(uchar *buf, uchar *pos); + int storage_rnd_pos(uchar *buf, uchar *pos); + void wrapper_position(const uchar *record); + void storage_position(const uchar *record); + ha_rows wrapper_records_in_range(uint key_nr, key_range *range_min, + key_range *range_max); + ha_rows storage_records_in_range(uint key_nr, key_range *range_min, + key_range *range_max); + ha_rows generic_records_in_range_geo(uint key_nr, key_range *range_min, + key_range *range_max); + int wrapper_index_init(uint idx, bool sorted); + int storage_index_init(uint idx, bool sorted); + int wrapper_index_end(); + int storage_index_end(); + int wrapper_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); + int storage_index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); +#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP + int wrapper_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); + int storage_index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map); +#endif + int wrapper_index_next(uchar *buf); + int storage_index_next(uchar *buf); + int wrapper_index_prev(uchar *buf); + int storage_index_prev(uchar *buf); + int wrapper_index_first(uchar *buf); + int storage_index_first(uchar *buf); + int wrapper_index_last(uchar *buf); + int storage_index_last(uchar *buf); + int wrapper_index_next_same(uchar *buf, const uchar *key, uint keylen); + int storage_index_next_same(uchar *buf, const uchar *key, uint keylen); + int wrapper_read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted); + int storage_read_range_first(const key_range *start_key, + const key_range *end_key, + bool eq_range, bool sorted); + int wrapper_read_range_next(); + int storage_read_range_next(); + int generic_ft_init(); + int wrapper_ft_init(); + int storage_ft_init(); + FT_INFO *wrapper_ft_init_ext(uint flags, uint key_nr, String *key); + FT_INFO *storage_ft_init_ext(uint flags, uint key_nr, String *key); + void generic_ft_init_ext_add_conditions_fast_order_limit( + struct st_mrn_ft_info *info, grn_obj *expression); + bool generic_ft_init_ext_parse_pragma_d(struct st_mrn_ft_info *info, + const char *keyword, + uint keyword_length, + grn_operator *default_operator, + uint *consumed_keyword_length); + void generic_ft_init_ext_parse_pragma_w_append_section( + struct st_mrn_ft_info *info, + grn_obj *index_column, + grn_obj *match_columns, + uint section, + grn_obj *section_value_buffer, + int weight, + uint n_weights); + bool generic_ft_init_ext_parse_pragma_w(struct st_mrn_ft_info *info, + const char *keyword, + uint keyword_length, + grn_obj *index_column, + grn_obj *match_columns, + uint *consumed_keyword_length, + grn_obj *tmp_objects); + grn_rc generic_ft_init_ext_prepare_expression_in_boolean_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression, + grn_obj *tmp_objects); + grn_rc generic_ft_init_ext_prepare_expression_in_normal_mode( + struct st_mrn_ft_info *info, + String *key, + grn_obj *index_column, + grn_obj *match_columns, + grn_obj *expression, + grn_obj *tmp_objects); + struct st_mrn_ft_info *generic_ft_init_ext_select(uint flags, + uint key_nr, + String *key); + FT_INFO *generic_ft_init_ext(uint flags, uint key_nr, String *key); + int wrapper_ft_read(uchar *buf); + int storage_ft_read(uchar *buf); + const Item *wrapper_cond_push(const Item *cond); + const Item *storage_cond_push(const Item *cond); + void wrapper_cond_pop(); + void storage_cond_pop(); + bool wrapper_get_error_message(int error, String *buf); + bool storage_get_error_message(int error, String *buf); +#ifdef MRN_HANDLER_CLONE_NEED_NAME + handler *wrapper_clone(const char *name, MEM_ROOT *mem_root); + handler *storage_clone(const char *name, MEM_ROOT *mem_root); +#else + handler *wrapper_clone(MEM_ROOT *mem_root); + handler *storage_clone(MEM_ROOT *mem_root); +#endif + uint8 wrapper_table_cache_type(); + uint8 storage_table_cache_type(); +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ + ha_rows wrapper_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost); + ha_rows storage_multi_range_read_info_const(uint keyno, + RANGE_SEQ_IF *seq, + void *seq_init_param, + uint n_ranges, + uint *bufsz, + uint *flags, + Cost_estimate *cost); + ha_rows wrapper_multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost); + ha_rows storage_multi_range_read_info(uint keyno, uint n_ranges, uint keys, +#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS + uint key_parts, +#endif + uint *bufsz, uint *flags, + Cost_estimate *cost); + int wrapper_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + int storage_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, + uint n_ranges, uint mode, + HANDLER_BUFFER *buf); + int wrapper_multi_range_read_next(range_id_t *range_info); + int storage_multi_range_read_next(range_id_t *range_info); +#else // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int storage_read_multi_range_first(KEY_MULTI_RANGE **found_range_p, + KEY_MULTI_RANGE *ranges, + uint range_count, + bool sorted, + HANDLER_BUFFER *buffer); + int wrapper_read_multi_range_next(KEY_MULTI_RANGE **found_range_p); + int storage_read_multi_range_next(KEY_MULTI_RANGE **found_range_p); +#endif // MRN_HANDLER_HAVE_MULTI_RANGE_READ + int generic_delete_all_rows(grn_obj *target_grn_table, + const char *function_name); + int wrapper_delete_all_rows(); + int storage_delete_all_rows(); +#ifdef MRN_HANDLER_HAVE_TRUNCATE + int wrapper_truncate(); +#endif // MRN_HANDLER_HAVE_TRUNCATE + int wrapper_truncate_index(); + int storage_truncate(); + int storage_truncate_index(); + double wrapper_scan_time(); + double storage_scan_time(); + double wrapper_read_time(uint index, uint ranges, ha_rows rows); + double storage_read_time(uint index, uint ranges, ha_rows rows); + const key_map *wrapper_keys_to_use_for_scanning(); + const key_map *storage_keys_to_use_for_scanning(); + ha_rows wrapper_estimate_rows_upper_bound(); + ha_rows storage_estimate_rows_upper_bound(); + void wrapper_update_create_info(HA_CREATE_INFO* create_info); + void storage_update_create_info(HA_CREATE_INFO* create_info); + int wrapper_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); + int wrapper_rename_index(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); + int storage_rename_table(const char *from, const char *to, + MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); +#ifdef MRN_SUPPORT_FOREIGN_KEYS + int storage_rename_foreign_key(MRN_SHARE *tmp_share, + const char *from_table_name, + const char *to_table_name); +#endif + bool wrapper_is_crashed() const; + bool storage_is_crashed() const; + bool wrapper_auto_repair(int error) const; + bool storage_auto_repair(int error) const; + int wrapper_disable_indexes(uint mode); + int storage_disable_indexes(uint mode); + int wrapper_enable_indexes(uint mode); + int storage_enable_indexes(uint mode); + int wrapper_check(THD* thd, HA_CHECK_OPT* check_opt); + int storage_check(THD* thd, HA_CHECK_OPT* check_opt); + int wrapper_fill_indexes(THD *thd, KEY *key_info, + grn_obj **index_columns, uint n_keys); + int wrapper_recreate_indexes(THD *thd); + int wrapper_repair(THD* thd, HA_CHECK_OPT* check_opt); + int storage_repair(THD* thd, HA_CHECK_OPT* check_opt); + bool wrapper_check_and_repair(THD *thd); + bool storage_check_and_repair(THD *thd); + int wrapper_analyze(THD* thd, HA_CHECK_OPT* check_opt); + int storage_analyze(THD* thd, HA_CHECK_OPT* check_opt); + int wrapper_optimize(THD* thd, HA_CHECK_OPT* check_opt); + int storage_optimize(THD* thd, HA_CHECK_OPT* check_opt); + bool wrapper_is_fatal_error(int error_num, uint flags); + bool storage_is_fatal_error(int error_num, uint flags); + bool wrapper_is_comment_changed(TABLE *table1, TABLE *table2); + bool wrapper_check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); + bool storage_check_if_incompatible_data(HA_CREATE_INFO *create_info, + uint table_changes); + int storage_add_index_multiple_columns(KEY *key_info, uint num_of_keys, + grn_obj **index_tables, + grn_obj **index_columns, + bool skip_unique_key); +#ifdef MRN_HANDLER_HAVE_CHECK_IF_SUPPORTED_INPLACE_ALTER + enum_alter_inplace_result + wrapper_check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + enum_alter_inplace_result + storage_check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_prepare_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_index(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_add_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_drop_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table_rename_column(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool storage_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info); + bool wrapper_commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit); + bool storage_commit_inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info, + bool commit); + void wrapper_notify_table_changed(); + void storage_notify_table_changed(); +#else + uint wrapper_alter_table_flags(uint flags); + uint storage_alter_table_flags(uint flags); +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int wrapper_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); + int storage_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, + handler_add_index **add); +# else + int wrapper_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); + int storage_add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys); +# endif +# ifdef MRN_HANDLER_HAVE_FINAL_ADD_INDEX + int wrapper_final_add_index(handler_add_index *add, bool commit); + int storage_final_add_index(handler_add_index *add, bool commit); +# endif + int wrapper_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys); + int storage_prepare_drop_index(TABLE *table_arg, uint *key_num, + uint num_of_keys); + int wrapper_final_drop_index(TABLE *table_arg); + int storage_final_drop_index(TABLE *table_arg); +#endif + int wrapper_update_auto_increment(); + int storage_update_auto_increment(); + void wrapper_set_next_insert_id(ulonglong id); + void storage_set_next_insert_id(ulonglong id); + void wrapper_get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values); + void storage_get_auto_increment(ulonglong offset, ulonglong increment, + ulonglong nb_desired_values, + ulonglong *first_value, + ulonglong *nb_reserved_values); + void wrapper_restore_auto_increment(ulonglong prev_insert_id); + void storage_restore_auto_increment(ulonglong prev_insert_id); + void wrapper_release_auto_increment(); + void storage_release_auto_increment(); + int wrapper_check_for_upgrade(HA_CHECK_OPT *check_opt); + int storage_check_for_upgrade(HA_CHECK_OPT *check_opt); + int wrapper_reset_auto_increment(ulonglong value); + int storage_reset_auto_increment(ulonglong value); + bool wrapper_was_semi_consistent_read(); + bool storage_was_semi_consistent_read(); + void wrapper_try_semi_consistent_read(bool yes); + void storage_try_semi_consistent_read(bool yes); + void wrapper_unlock_row(); + void storage_unlock_row(); + int wrapper_start_stmt(THD *thd, thr_lock_type lock_type); + int storage_start_stmt(THD *thd, thr_lock_type lock_type); + void wrapper_change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg); + void storage_change_table_ptr(TABLE *table_arg, TABLE_SHARE *share_arg); + bool wrapper_primary_key_is_clustered(); + bool storage_primary_key_is_clustered(); + bool wrapper_is_fk_defined_on_table_or_index(uint index); + bool storage_is_fk_defined_on_table_or_index(uint index); + char *wrapper_get_foreign_key_create_info(); + char *storage_get_foreign_key_create_info(); +#ifdef MRN_HANDLER_HAVE_GET_TABLESPACE_NAME + char *wrapper_get_tablespace_name(THD *thd, char *name, uint name_len); + char *storage_get_tablespace_name(THD *thd, char *name, uint name_len); +#endif + bool wrapper_can_switch_engines(); + bool storage_can_switch_engines(); + int wrapper_get_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_foreign_key_list(THD *thd, List *f_key_list); +#ifdef MRN_HANDLER_HAVE_GET_PARENT_FOREIGN_KEY_LIST + int wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list); + int storage_get_parent_foreign_key_list(THD *thd, List *f_key_list); +#endif + uint wrapper_referenced_by_foreign_key(); + uint storage_referenced_by_foreign_key(); + void wrapper_init_table_handle_for_HANDLER(); + void storage_init_table_handle_for_HANDLER(); + void wrapper_free_foreign_key_create_info(char* str); + void storage_free_foreign_key_create_info(char* str); + void wrapper_set_keys_in_use(); + void storage_set_keys_in_use(); + bool check_written_by_row_based_binlog(); +#ifdef MRN_HAVE_HA_REBIND_PSI + void wrapper_unbind_psi(); + void storage_unbind_psi(); + void wrapper_rebind_psi(); + void storage_rebind_psi(); +#endif + my_bool wrapper_register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data); + my_bool storage_register_query_cache_table(THD *thd, + char *table_key, + uint key_length, + qc_engine_callback + *engine_callback, + ulonglong *engine_data); +}; + +#ifdef __cplusplus +} +#endif + +#endif /* HA_MROONGA_HPP_ */ diff --git a/storage/mroonga/lib/Makefile.am b/storage/mroonga/lib/Makefile.am new file mode 100644 index 00000000000..300131db70a --- /dev/null +++ b/storage/mroonga/lib/Makefile.am @@ -0,0 +1,23 @@ +AM_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + $(MYSQL_INCLUDES) \ + $(GROONGA_CFLAGS) \ + $(MYSQL_VERSION_CFLAGS) + +libmrn_need_mysql_la_CXXFLAGS = $(AM_CXXFLAGS) $(MYSQL_CFLAGS) + +if WITH_LIBMYSQLSERVICES_COMPAT +LIBMYSQLSERVICES_COMPAT = libmysqlservices.la +endif + +noinst_LTLIBRARIES = \ + $(LIBMYSQLSERVICES_COMPAT) \ + libmrn_no_mysql.la \ + libmrn_need_mysql.la + +include libmrn_no_mysql_sources.am +include libmrn_need_mysql_sources.am +if WITH_LIBMYSQLSERVICES_COMPAT +include libmysqlservices_compat_sources.am +endif diff --git a/storage/mroonga/lib/libmrn_need_mysql_sources.am b/storage/mroonga/lib/libmrn_need_mysql_sources.am new file mode 100644 index 00000000000..bd852829467 --- /dev/null +++ b/storage/mroonga/lib/libmrn_need_mysql_sources.am @@ -0,0 +1,27 @@ +libmrn_need_mysql_la_SOURCES = \ + mrn_index_table_name.cpp \ + mrn_index_table_name.hpp \ + mrn_index_column_name.cpp \ + mrn_index_column_name.hpp \ + mrn_debug_column_access.cpp \ + mrn_debug_column_access.hpp \ + mrn_auto_increment_value_lock.cpp \ + mrn_auto_increment_value_lock.hpp \ + mrn_external_lock.cpp \ + mrn_external_lock.hpp \ + mrn_multiple_column_key_codec.cpp \ + mrn_multiple_column_key_codec.hpp \ + mrn_field_normalizer.cpp \ + mrn_field_normalizer.hpp \ + mrn_encoding.cpp \ + mrn_encoding.hpp \ + mrn_parameters_parser.cpp \ + mrn_parameters_parser.hpp \ + mrn_lock.cpp \ + mrn_lock.hpp \ + mrn_condition_converter.cpp \ + mrn_condition_converter.hpp \ + mrn_time_converter.cpp \ + mrn_time_converter.hpp \ + mrn_database_manager.cpp \ + mrn_database_manager.hpp diff --git a/storage/mroonga/lib/libmrn_no_mysql_sources.am b/storage/mroonga/lib/libmrn_no_mysql_sources.am new file mode 100644 index 00000000000..fd2d942d345 --- /dev/null +++ b/storage/mroonga/lib/libmrn_no_mysql_sources.am @@ -0,0 +1,9 @@ +libmrn_no_mysql_la_SOURCES = \ + mrn_match_escalation_threshold_scope.cpp \ + mrn_match_escalation_threshold_scope.hpp \ + mrn_path_mapper.cpp \ + mrn_path_mapper.hpp \ + mrn_windows.hpp \ + mrn_smart_grn_obj.cpp \ + mrn_smart_grn_obj.hpp \ + mrn_grn.hpp diff --git a/storage/mroonga/lib/libmysqlservices_compat_sources.am b/storage/mroonga/lib/libmysqlservices_compat_sources.am new file mode 100644 index 00000000000..bb0712a4add --- /dev/null +++ b/storage/mroonga/lib/libmysqlservices_compat_sources.am @@ -0,0 +1,2 @@ +libmysqlservices_la_SOURCES = \ + mrn_mysqlservices.cpp diff --git a/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp b/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp new file mode 100644 index 00000000000..3bac5e31c6c --- /dev/null +++ b/storage/mroonga/lib/mrn_auto_increment_value_lock.cpp @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_auto_increment_value_lock.hpp" + +#if MYSQL_VERSION_ID >= 50500 +# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->LOCK_ha_data)) +#else +# define AUTO_INCREMENT_VALUE_MUTEX(table_share) (&(table_share->mutex)) +#endif + +namespace mrn { + AutoIncrementValueLock::AutoIncrementValueLock(TABLE_SHARE *table_share) + : table_share_(table_share), + need_lock_(table_share_->tmp_table == NO_TMP_TABLE) { + if (need_lock_) { + mysql_mutex_lock(AUTO_INCREMENT_VALUE_MUTEX(table_share_)); + } + } + + AutoIncrementValueLock::~AutoIncrementValueLock() { + if (need_lock_) { + mysql_mutex_unlock(AUTO_INCREMENT_VALUE_MUTEX(table_share_)); + } + } +} diff --git a/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp b/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp new file mode 100644 index 00000000000..8aabe6a8a7f --- /dev/null +++ b/storage/mroonga/lib/mrn_auto_increment_value_lock.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ +#define MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ + +#include +#include + +namespace mrn { + class AutoIncrementValueLock { + TABLE_SHARE *table_share_; + bool need_lock_; + public: + AutoIncrementValueLock(TABLE_SHARE *table_share); + ~AutoIncrementValueLock(); + }; +} + +#endif // MRN_AUTO_INCREMENT_VALUE_LOCK_HPP_ diff --git a/storage/mroonga/lib/mrn_condition_converter.cpp b/storage/mroonga/lib/mrn_condition_converter.cpp new file mode 100644 index 00000000000..1bfae1d4f8a --- /dev/null +++ b/storage/mroonga/lib/mrn_condition_converter.cpp @@ -0,0 +1,608 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013-2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "mrn_condition_converter.hpp" +#include "mrn_time_converter.hpp" +#include "mrn_smart_grn_obj.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::ConditionConverter" + +#ifdef MRN_ITEM_HAVE_ITEM_NAME +# define MRN_ITEM_FIELD_GET_NAME(item) ((item)->item_name.ptr()) +# define MRN_ITEM_FIELD_GET_NAME_LENGTH(item) ((item)->item_name.length()) +#else +# define MRN_ITEM_FIELD_GET_NAME(item) ((item)->name) +# define MRN_ITEM_FIELD_GET_NAME_LENGTH(item) (strlen((item)->name)) +#endif + +namespace mrn { + ConditionConverter::ConditionConverter(grn_ctx *ctx, grn_obj *table, + bool is_storage_mode) + : ctx_(ctx), + table_(table), + is_storage_mode_(is_storage_mode) { + GRN_TEXT_INIT(&column_name_, 0); + GRN_VOID_INIT(&value_); + } + + ConditionConverter::~ConditionConverter() { + grn_obj_unlink(ctx_, &column_name_); + grn_obj_unlink(ctx_, &value_); + } + + bool ConditionConverter::is_convertable(const Item *item) { + MRN_DBUG_ENTER_METHOD(); + + if (!item) { + DBUG_RETURN(false); + } + + switch (item->type()) { + case Item::COND_ITEM: + { + const Item_cond *cond_item = reinterpret_cast(item); + bool convertable = is_convertable(cond_item); + DBUG_RETURN(convertable); + } + break; + case Item::FUNC_ITEM: + { + const Item_func *func_item = reinterpret_cast(item); + bool convertable = is_convertable(func_item); + DBUG_RETURN(convertable); + } + break; + default: + DBUG_RETURN(false); + break; + } + + DBUG_RETURN(false); + } + + bool ConditionConverter::is_convertable(const Item_cond *cond_item) { + MRN_DBUG_ENTER_METHOD(); + + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + + if (cond_item->functype() != Item_func::COND_AND_FUNC) { + DBUG_RETURN(false); + } + + List *argument_list = + const_cast(cond_item)->argument_list(); + List_iterator iterator(*argument_list); + const Item *sub_item; + while ((sub_item = iterator++)) { + if (!is_convertable(sub_item)) { + DBUG_RETURN(false); + } + } + + DBUG_RETURN(true); + } + + bool ConditionConverter::is_convertable(const Item_func *func_item) { + MRN_DBUG_ENTER_METHOD(); + + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + case Item_func::LT_FUNC: + case Item_func::LE_FUNC: + case Item_func::GE_FUNC: + case Item_func::GT_FUNC: + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + Item *right_item = arguments[1]; + if (left_item->type() != Item::FIELD_ITEM) { + DBUG_RETURN(false); + } + if (!right_item->basic_const_item()) { + DBUG_RETURN(false); + } + + bool convertable = + is_convertable_binary_operation(static_cast(left_item), + right_item, + func_item->functype()); + DBUG_RETURN(convertable); + } + break; + case Item_func::FT_FUNC: + DBUG_RETURN(true); + break; + case Item_func::BETWEEN: + if (!is_storage_mode_) { + DBUG_RETURN(false); + } + { + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + Item *min_item = arguments[1]; + Item *max_item = arguments[2]; + if (target_item->type() != Item::FIELD_ITEM) { + DBUG_RETURN(false); + } + if (!min_item->basic_const_item()) { + DBUG_RETURN(false); + } + if (!max_item->basic_const_item()) { + DBUG_RETURN(false); + } + + bool convertable = + is_convertable_between(static_cast(target_item), + min_item, + max_item); + DBUG_RETURN(convertable); + } + default: + DBUG_RETURN(false); + break; + } + + DBUG_RETURN(true); + } + + bool ConditionConverter::is_convertable_binary_operation( + const Item_field *field_item, + Item *value_item, + Item_func::Functype func_type) { + MRN_DBUG_ENTER_METHOD(); + + bool convertable = false; + + enum_field_types field_type = field_item->field_type(); + NormalizedType normalized_type = normalize_field_type(field_type); + switch (normalized_type) { + case STRING_TYPE: + if (value_item->type() == Item::STRING_ITEM && + func_type == Item_func::EQ_FUNC) { + convertable = have_index(field_item, GRN_OP_EQUAL); + } + break; + case INT_TYPE: + convertable = value_item->type() == Item::INT_ITEM; + break; + case TIME_TYPE: + if (is_valid_time_value(field_item, value_item)) { + convertable = have_index(field_item, func_type); + } + break; + case UNSUPPORTED_TYPE: + break; + } + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::is_convertable_between(const Item_field *field_item, + Item *min_item, + Item *max_item) { + MRN_DBUG_ENTER_METHOD(); + + bool convertable = false; + + enum_field_types field_type = field_item->field_type(); + NormalizedType normalized_type = normalize_field_type(field_type); + switch (normalized_type) { + case STRING_TYPE: + if (min_item->type() == Item::STRING_ITEM && + max_item->type() == Item::STRING_ITEM) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case INT_TYPE: + if (min_item->type() == Item::INT_ITEM && + max_item->type() == Item::INT_ITEM) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case TIME_TYPE: + if (is_valid_time_value(field_item, min_item) && + is_valid_time_value(field_item, max_item)) { + convertable = have_index(field_item, GRN_OP_LESS); + } + break; + case UNSUPPORTED_TYPE: + break; + } + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::is_valid_time_value(const Item_field *field_item, + Item *value_item) { + MRN_DBUG_ENTER_METHOD(); + + MYSQL_TIME mysql_time; + bool error = get_time_value(field_item, value_item, &mysql_time); + + DBUG_RETURN(!error); + } + + bool ConditionConverter::get_time_value(const Item_field *field_item, + Item *value_item, + MYSQL_TIME *mysql_time) { + MRN_DBUG_ENTER_METHOD(); + + bool error; + Item *real_value_item = value_item->real_item(); + switch (field_item->field_type()) { + case MYSQL_TYPE_TIME: + error = real_value_item->get_time(mysql_time); + break; + case MYSQL_TYPE_YEAR: + mysql_time->year = static_cast(value_item->val_int()); + mysql_time->month = 1; + mysql_time->day = 1; + mysql_time->hour = 0; + mysql_time->hour = 0; + mysql_time->minute = 0; + mysql_time->second_part = 0; + mysql_time->neg = false; + mysql_time->time_type = MYSQL_TIMESTAMP_DATE; + error = false; + break; + default: + error = real_value_item->get_date(mysql_time, TIME_FUZZY_DATE); + break; + } + + DBUG_RETURN(error); + } + + ConditionConverter::NormalizedType + ConditionConverter::normalize_field_type(enum_field_types field_type) { + MRN_DBUG_ENTER_METHOD(); + + NormalizedType type = UNSUPPORTED_TYPE; + + switch (field_type) { + case MYSQL_TYPE_DECIMAL: + type = STRING_TYPE; + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + type = INT_TYPE; + break; + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + type = UNSUPPORTED_TYPE; + break; + case MYSQL_TYPE_NULL: + type = UNSUPPORTED_TYPE; + break; + case MYSQL_TYPE_TIMESTAMP: + type = TIME_TYPE; + break; + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + type = INT_TYPE; + break; + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_TIME: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_YEAR: + case MYSQL_TYPE_NEWDATE: + type = TIME_TYPE; + break; + case MYSQL_TYPE_VARCHAR: + type = STRING_TYPE; + break; + case MYSQL_TYPE_BIT: + type = INT_TYPE; + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + type = TIME_TYPE; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + type = TIME_TYPE; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + type = TIME_TYPE; + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + type = STRING_TYPE; + break; + case MYSQL_TYPE_ENUM: + type = INT_TYPE; + break; + case MYSQL_TYPE_SET: + type = INT_TYPE; + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + type = STRING_TYPE; + break; + case MYSQL_TYPE_GEOMETRY: + type = UNSUPPORTED_TYPE; + break; + } + + DBUG_RETURN(type); + } + + bool ConditionConverter::have_index(const Item_field *field_item, + grn_operator _operator) { + MRN_DBUG_ENTER_METHOD(); + + grn_obj *column; + column = grn_obj_column(ctx_, table_, + MRN_ITEM_FIELD_GET_NAME(field_item), + MRN_ITEM_FIELD_GET_NAME_LENGTH(field_item)); + if (!column) { + DBUG_RETURN(false); + } + mrn::SmartGrnObj smart_column(ctx_, column); + + int n_indexes = grn_column_index(ctx_, column, _operator, NULL, 0, NULL); + bool convertable = (n_indexes > 0); + + DBUG_RETURN(convertable); + } + + bool ConditionConverter::have_index(const Item_field *field_item, + Item_func::Functype func_type) { + MRN_DBUG_ENTER_METHOD(); + + bool have = false; + switch (func_type) { + case Item_func::EQ_FUNC: + have = have_index(field_item, GRN_OP_EQUAL); + break; + case Item_func::LT_FUNC: + have = have_index(field_item, GRN_OP_LESS); + break; + case Item_func::LE_FUNC: + have = have_index(field_item, GRN_OP_LESS_EQUAL); + break; + case Item_func::GE_FUNC: + have = have_index(field_item, GRN_OP_GREATER_EQUAL); + break; + case Item_func::GT_FUNC: + have = have_index(field_item, GRN_OP_GREATER); + break; + default: + break; + } + + DBUG_RETURN(have); + } + + const Item_func *ConditionConverter::find_match_against(const Item *item) { + MRN_DBUG_ENTER_METHOD(); + + if (!item) { + DBUG_RETURN(NULL); + } + + switch (item->type()) { + case Item::COND_ITEM: + if (is_storage_mode_) { + Item_cond *cond_item = (Item_cond *)item; + if (cond_item->functype() == Item_func::COND_AND_FUNC) { + List_iterator iterator(*((cond_item)->argument_list())); + const Item *sub_item; + while ((sub_item = iterator++)) { + const Item_func *match_against = find_match_against(sub_item); + if (match_against) { + DBUG_RETURN(match_against); + } + } + } + } + break; + case Item::FUNC_ITEM: + { + const Item_func *func_item = (const Item_func *)item; + switch (func_item->functype()) { + case Item_func::FT_FUNC: + DBUG_RETURN(func_item); + break; + default: + break; + } + } + break; + default: + break; + } + + DBUG_RETURN(NULL); + } + + void ConditionConverter::convert(const Item *where, grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + if (!where || where->type() != Item::COND_ITEM) { + DBUG_VOID_RETURN; + } + + Item_cond *cond_item = (Item_cond *)where; + List_iterator iterator(*((cond_item)->argument_list())); + const Item *sub_item; + while ((sub_item = iterator++)) { + switch (sub_item->type()) { + case Item::FUNC_ITEM: + { + const Item_func *func_item = (const Item_func *)sub_item; + switch (func_item->functype()) { + case Item_func::EQ_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_EQUAL); + break; + case Item_func::LT_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_LESS); + break; + case Item_func::LE_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_LESS_EQUAL); + break; + case Item_func::GE_FUNC: + convert_binary_operation(func_item, expression, + GRN_OP_GREATER_EQUAL); + break; + case Item_func::GT_FUNC: + convert_binary_operation(func_item, expression, GRN_OP_GREATER); + break; + case Item_func::BETWEEN: + convert_between(func_item, expression); + break; + default: + break; + } + } + break; + default: + break; + } + } + + DBUG_VOID_RETURN; + } + + void ConditionConverter::convert_binary_operation(const Item_func *func_item, + grn_obj *expression, + grn_operator _operator) { + Item **arguments = func_item->arguments(); + Item *left_item = arguments[0]; + Item *right_item = arguments[1]; + if (left_item->type() == Item::FIELD_ITEM) { + const Item_field *field_item = static_cast(left_item); + append_field_value(field_item, expression); + append_const_item(field_item, right_item, expression); + grn_expr_append_op(ctx_, expression, _operator, 2); + grn_expr_append_op(ctx_, expression, GRN_OP_AND, 2); + } + } + + void ConditionConverter::convert_between(const Item_func *func_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + Item **arguments = func_item->arguments(); + Item *target_item = arguments[0]; + Item *min_item = arguments[1]; + Item *max_item = arguments[2]; + + grn_obj *between_func = grn_ctx_get(ctx_, "between", strlen("between")); + grn_expr_append_obj(ctx_, expression, between_func, GRN_OP_PUSH, 1); + + const Item_field *field_item = static_cast(target_item); + append_field_value(field_item, expression); + + grn_obj include; + mrn::SmartGrnObj smart_include(ctx_, &include); + GRN_TEXT_INIT(&include, 0); + GRN_TEXT_PUTS(ctx_, &include, "include"); + append_const_item(field_item, min_item, expression); + grn_expr_append_const(ctx_, expression, &include, GRN_OP_PUSH, 1); + append_const_item(field_item, max_item, expression); + grn_expr_append_const(ctx_, expression, &include, GRN_OP_PUSH, 1); + + grn_expr_append_op(ctx_, expression, GRN_OP_CALL, 5); + + grn_expr_append_op(ctx_, expression, GRN_OP_AND, 2); + + DBUG_VOID_RETURN; + } + + void ConditionConverter::append_field_value(const Item_field *field_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + GRN_BULK_REWIND(&column_name_); + GRN_TEXT_PUT(ctx_, &column_name_, + MRN_ITEM_FIELD_GET_NAME(field_item), + MRN_ITEM_FIELD_GET_NAME_LENGTH(field_item)); + grn_expr_append_const(ctx_, expression, &column_name_, + GRN_OP_PUSH, 1); + grn_expr_append_op(ctx_, expression, GRN_OP_GET_VALUE, 1); + + DBUG_VOID_RETURN; + } + + void ConditionConverter::append_const_item(const Item_field *field_item, + Item *const_item, + grn_obj *expression) { + MRN_DBUG_ENTER_METHOD(); + + enum_field_types field_type = field_item->field_type(); + NormalizedType normalized_type = normalize_field_type(field_type); + + switch (normalized_type) { + case STRING_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_TEXT, 0); + { + String *string; + string = const_item->val_str(NULL); + GRN_TEXT_SET(ctx_, &value_, string->ptr(), string->length()); + } + break; + case INT_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_INT64, 0); + GRN_INT64_SET(ctx_, &value_, const_item->val_int()); + break; + case TIME_TYPE: + grn_obj_reinit(ctx_, &value_, GRN_DB_TIME, 0); + { + MYSQL_TIME mysql_time; + get_time_value(field_item, const_item, &mysql_time); + bool truncated = false; + TimeConverter time_converter; + long long int time = + time_converter.mysql_time_to_grn_time(&mysql_time, &truncated); + GRN_TIME_SET(ctx_, &value_, time); + } + break; + case UNSUPPORTED_TYPE: + // Should not be occurred. + DBUG_PRINT("error", + ("mroonga: append_const_item: unsupported type: <%d> " + "This case should not be occurred.", + field_type)); + grn_obj_reinit(ctx_, &value_, GRN_DB_VOID, 0); + break; + } + grn_expr_append_const(ctx_, expression, &value_, GRN_OP_PUSH, 1); + + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_condition_converter.hpp b/storage/mroonga/lib/mrn_condition_converter.hpp new file mode 100644 index 00000000000..3cf97c62bbe --- /dev/null +++ b/storage/mroonga/lib/mrn_condition_converter.hpp @@ -0,0 +1,82 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_CONDITION_CONVERTER_HPP_ +#define MRN_CONDITION_CONVERTER_HPP_ + +#include +#include + +namespace mrn { + class ConditionConverter { + public: + ConditionConverter(grn_ctx *ctx, grn_obj *table, bool is_storage_mode); + ~ConditionConverter(); + + bool is_convertable(const Item *item); + const Item_func *find_match_against(const Item *item); + // caller must check "where" can be convertable by + // is_convertable(). This method doesn't validate "where". + void convert(const Item *where, grn_obj *expression); + + private: + enum NormalizedType { + STRING_TYPE, + INT_TYPE, + TIME_TYPE, + UNSUPPORTED_TYPE, + }; + + grn_ctx *ctx_; + grn_obj *table_; + bool is_storage_mode_; + grn_obj column_name_; + grn_obj value_; + + bool is_convertable(const Item_cond *cond_item); + bool is_convertable(const Item_func *func_item); + bool is_convertable_binary_operation(const Item_field *field_item, + Item *value_item, + Item_func::Functype func_type); + bool is_convertable_between(const Item_field *field_item, + Item *min_item, + Item *max_item); + bool is_valid_time_value(const Item_field *field_item, + Item *value_item); + bool get_time_value(const Item_field *field_item, + Item *value_item, + MYSQL_TIME *mysql_time); + bool have_index(const Item_field *field_item, grn_operator _operator); + bool have_index(const Item_field *field_item, Item_func::Functype func_type); + + NormalizedType normalize_field_type(enum_field_types field_type); + + void convert_binary_operation(const Item_func *func_item, + grn_obj *expression, + grn_operator _operator); + void convert_between(const Item_func *func_item, grn_obj *expression); + void append_field_value(const Item_field *field_item, + grn_obj *expression); + void append_const_item(const Item_field *field_item, + Item *const_item, + grn_obj *expression); + }; +} + +#endif /* MRN_CONDITION_CONVERTER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_database_manager.cpp b/storage/mroonga/lib/mrn_database_manager.cpp new file mode 100644 index 00000000000..52ec78fccc0 --- /dev/null +++ b/storage/mroonga/lib/mrn_database_manager.cpp @@ -0,0 +1,341 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_database_manager.hpp" +#include "mrn_encoding.hpp" +#include "mrn_lock.hpp" +#include "mrn_path_mapper.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::DatabaseManager" + +#ifdef WIN32 +# include +# define MRN_MKDIR(pathname, mode) _mkdir((pathname)) +#else +# include +# include +# define MRN_MKDIR(pathname, mode) mkdir((pathname), (mode)) +#endif + +namespace mrn { + DatabaseManager::DatabaseManager(grn_ctx *ctx) + : ctx_(ctx), + cache_(NULL), + mutex_(), + mutex_initialized_(false) { + } + + DatabaseManager::~DatabaseManager(void) { + if (mutex_initialized_) { + pthread_mutex_destroy(&mutex_); + } + + if (cache_) { + void *db_address; + GRN_HASH_EACH(ctx_, cache_, id, NULL, 0, &db_address, { + grn_obj *db; + memcpy(&db, db_address, sizeof(grn_obj *)); + grn_obj_unlink(ctx_, db); + }); + grn_hash_close(ctx_, cache_); + } + } + + bool DatabaseManager::init(void) { + MRN_DBUG_ENTER_METHOD(); + cache_ = grn_hash_create(ctx_, + NULL, + GRN_TABLE_MAX_KEY_SIZE, + sizeof(grn_obj *), + GRN_OBJ_KEY_VAR_SIZE); + if (!cache_) { + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to initialize hash table for caching opened databases"); + DBUG_RETURN(false); + } + + if (pthread_mutex_init(&mutex_, NULL) != 0) { + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to initialize mutex for opened database cache hash table"); + DBUG_RETURN(false); + } + + mutex_initialized_ = true; + DBUG_RETURN(true); + } + + int DatabaseManager::open(const char *path, grn_obj **db) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + *db = NULL; + + mrn::PathMapper mapper(path); + mrn::Lock lock(&mutex_); + + error = mrn::encoding::set(ctx_, system_charset_info); + if (error) { + DBUG_RETURN(error); + } + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + if (id == GRN_ID_NIL) { + struct stat db_stat; + if (stat(mapper.db_path(), &db_stat)) { + GRN_LOG(ctx_, GRN_LOG_INFO, + "database not found. creating...: <%s>", mapper.db_path()); + if (path[0] == FN_CURLIB && + (path[1] == FN_LIBCHAR || path[1] == FN_LIBCHAR2)) { + ensure_database_directory(); + } + *db = grn_db_create(ctx_, mapper.db_path(), NULL); + if (ctx_->rc) { + error = ER_CANT_CREATE_TABLE; + my_message(error, ctx_->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } else { + *db = grn_db_open(ctx_, mapper.db_path()); + if (ctx_->rc) { + error = ER_CANT_OPEN_FILE; + my_message(error, ctx_->errbuf, MYF(0)); + DBUG_RETURN(error); + } + } + grn_hash_add(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address, NULL); + memcpy(db_address, db, sizeof(grn_obj *)); + } else { + memcpy(db, db_address, sizeof(grn_obj *)); + grn_ctx_use(ctx_, *db); + } + + error = ensure_normalizers_registered(*db); + + DBUG_RETURN(error); + } + + void DatabaseManager::close(const char *path) { + MRN_DBUG_ENTER_METHOD(); + + mrn::PathMapper mapper(path); + mrn::Lock lock(&mutex_); + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + if (id == GRN_ID_NIL) { + DBUG_VOID_RETURN; + } + + grn_obj *db = NULL; + memcpy(&db, db_address, sizeof(grn_obj *)); + if (db) { + grn_obj_close(ctx_, db); + } + + grn_hash_delete_by_id(ctx_, cache_, id, NULL); + + DBUG_VOID_RETURN; + } + + bool DatabaseManager::drop(const char *path) { + MRN_DBUG_ENTER_METHOD(); + + mrn::PathMapper mapper(path); + mrn::Lock lock(&mutex_); + + grn_id id; + void *db_address; + id = grn_hash_get(ctx_, cache_, + mapper.db_name(), strlen(mapper.db_name()), + &db_address); + + grn_obj *db = NULL; + if (id == GRN_ID_NIL) { + struct stat dummy; + if (stat(mapper.db_path(), &dummy) == 0) { + db = grn_db_open(ctx_, mapper.db_path()); + } + } else { + memcpy(&db, db_address, sizeof(grn_obj *)); + } + + if (!db) { + DBUG_RETURN(false); + } + + if (grn_obj_remove(ctx_, db) == GRN_SUCCESS) { + if (id != GRN_ID_NIL) { + grn_hash_delete_by_id(ctx_, cache_, id, NULL); + } + DBUG_RETURN(true); + } else { + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to drop database: <%s>: <%s>", + mapper.db_path(), ctx_->errbuf); + DBUG_RETURN(false); + } + } + + int DatabaseManager::clear(void) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; + + mrn::Lock lock(&mutex_); + + grn_hash_cursor *cursor; + cursor = grn_hash_cursor_open(ctx_, cache_, + NULL, 0, NULL, 0, + 0, -1, 0); + if (ctx_->rc) { + my_message(ER_ERROR_ON_READ, ctx_->errbuf, MYF(0)); + DBUG_RETURN(ER_ERROR_ON_READ); + } + + while (grn_hash_cursor_next(ctx_, cursor) != GRN_ID_NIL) { + if (ctx_->rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx_->errbuf, MYF(0)); + break; + } + void *db_address; + grn_obj *db; + grn_hash_cursor_get_value(ctx_, cursor, &db_address); + memcpy(&db, db_address, sizeof(grn_obj *)); + grn_rc rc = grn_hash_cursor_delete(ctx_, cursor, NULL); + if (rc) { + error = ER_ERROR_ON_READ; + my_message(error, ctx_->errbuf, MYF(0)); + break; + } + grn_obj_close(ctx_, db); + } + grn_hash_cursor_close(ctx_, cursor); + + DBUG_RETURN(error); + } + + void DatabaseManager::mkdir_p(const char *directory) { + MRN_DBUG_ENTER_METHOD(); + + int i = 0; + char sub_directory[MRN_MAX_PATH_SIZE]; + sub_directory[0] = '\0'; + while (true) { + if (directory[i] == FN_LIBCHAR || + directory[i] == FN_LIBCHAR2 || + directory[i] == '\0') { + sub_directory[i] = '\0'; + struct stat directory_status; + if (stat(sub_directory, &directory_status) != 0) { + DBUG_PRINT("info", ("mroonga: creating directory: <%s>", sub_directory)); + GRN_LOG(ctx_, GRN_LOG_INFO, "creating directory: <%s>", sub_directory); + if (MRN_MKDIR(sub_directory, S_IRWXU) == 0) { + DBUG_PRINT("info", + ("mroonga: created directory: <%s>", sub_directory)); + GRN_LOG(ctx_, GRN_LOG_INFO, "created directory: <%s>", sub_directory); + } else { + DBUG_PRINT("error", + ("mroonga: failed to create directory: <%s>: <%s>", + sub_directory, strerror(errno))); + GRN_LOG(ctx_, GRN_LOG_ERROR, + "failed to create directory: <%s>: <%s>", + sub_directory, strerror(errno)); + DBUG_VOID_RETURN; + } + } + } + + if (directory[i] == '\0') { + break; + } + + sub_directory[i] = directory[i]; + ++i; + } + + DBUG_VOID_RETURN; + } + + void DatabaseManager::ensure_database_directory(void) { + MRN_DBUG_ENTER_METHOD(); + + const char *path_prefix = mrn::PathMapper::default_path_prefix; + if (!path_prefix) + DBUG_VOID_RETURN; + + const char *last_path_separator; + last_path_separator = strrchr(path_prefix, FN_LIBCHAR); + if (!last_path_separator) + last_path_separator = strrchr(path_prefix, FN_LIBCHAR2); + if (!last_path_separator) + DBUG_VOID_RETURN; + if (path_prefix == last_path_separator) + DBUG_VOID_RETURN; + + char database_directory[MRN_MAX_PATH_SIZE]; + size_t database_directory_length = last_path_separator - path_prefix; + strncpy(database_directory, path_prefix, database_directory_length); + database_directory[database_directory_length] = '\0'; + mkdir_p(database_directory); + + DBUG_VOID_RETURN; + } + + int DatabaseManager::ensure_normalizers_registered(grn_obj *db) { + MRN_DBUG_ENTER_METHOD(); + + int error = 0; +#ifdef WITH_GROONGA_NORMALIZER_MYSQL + { + grn_obj *mysql_normalizer; + mysql_normalizer = grn_ctx_get(ctx_, "NormalizerMySQLGeneralCI", -1); + if (mysql_normalizer) { + grn_obj_unlink(ctx_, mysql_normalizer); + } else { +#ifdef GROONGA_NORMALIZER_MYSQL_PLUGIN_IS_BUNDLED_STATIC + char ref_path[FN_REFLEN + 1], *tmp; + tmp = strmov(ref_path, opt_plugin_dir); + tmp = strmov(tmp, "/ha_mroonga"); + strcpy(tmp, SO_EXT); + grn_plugin_register_by_path(ctx_, ref_path); +#else + grn_plugin_register(ctx_, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME); +#endif + } + } +#endif + + DBUG_RETURN(error); + } +} diff --git a/storage/mroonga/lib/mrn_database_manager.hpp b/storage/mroonga/lib/mrn_database_manager.hpp new file mode 100644 index 00000000000..46bce7ab1a5 --- /dev/null +++ b/storage/mroonga/lib/mrn_database_manager.hpp @@ -0,0 +1,50 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_DATABASE_MANAGER_HPP_ +#define MRN_DATABASE_MANAGER_HPP_ + +#include + +namespace mrn { + class DatabaseManager { + public: + DatabaseManager(grn_ctx *ctx); + ~DatabaseManager(void); + bool init(void); + int open(const char *path, grn_obj **db); + void close(const char *path); + bool drop(const char *path); + int clear(void); + + private: + grn_ctx *ctx_; + grn_hash *cache_; + pthread_mutex_t mutex_; + bool mutex_initialized_; + + void mkdir_p(const char *directory); + void ensure_database_directory(void); + int ensure_normalizers_registered(grn_obj *db); + }; +} + +#endif /* MRN_DATABASE_MANAGER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_debug_column_access.cpp b/storage/mroonga/lib/mrn_debug_column_access.cpp new file mode 100644 index 00000000000..ed7cacae90f --- /dev/null +++ b/storage/mroonga/lib/mrn_debug_column_access.cpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_debug_column_access.hpp" + +namespace mrn { + DebugColumnAccess::DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap) + : table_(table), + bitmap_(bitmap) { +#ifndef DBUG_OFF + map_ = dbug_tmp_use_all_columns(table_, bitmap_); +#endif + } + + DebugColumnAccess::~DebugColumnAccess() { +#ifndef DBUG_OFF + dbug_tmp_restore_column_map(bitmap_, map_); +#endif + } +} diff --git a/storage/mroonga/lib/mrn_debug_column_access.hpp b/storage/mroonga/lib/mrn_debug_column_access.hpp new file mode 100644 index 00000000000..1548b4d8459 --- /dev/null +++ b/storage/mroonga/lib/mrn_debug_column_access.hpp @@ -0,0 +1,38 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_DEBUG_COLUMN_ACCESS_HPP_ +#define MRN_DEBUG_COLUMN_ACCESS_HPP_ + +#include + +namespace mrn { + class DebugColumnAccess { + TABLE *table_; + MY_BITMAP *bitmap_; +#ifndef DBUG_OFF + my_bitmap_map *map_; +#endif + public: + DebugColumnAccess(TABLE *table, MY_BITMAP *bitmap); + ~DebugColumnAccess(); + }; +} + +#endif // MRN_DEBUG_COLUMN_ACCESS_HPP_ diff --git a/storage/mroonga/lib/mrn_encoding.cpp b/storage/mroonga/lib/mrn_encoding.cpp new file mode 100644 index 00000000000..f6f66758b2f --- /dev/null +++ b/storage/mroonga/lib/mrn_encoding.cpp @@ -0,0 +1,242 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + Copyright(C) 2011-2013 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include "mrn_encoding.hpp" + +namespace mrn { + namespace encoding { + CHARSET_INFO *mrn_charset_utf8 = NULL; + CHARSET_INFO *mrn_charset_utf8mb4 = NULL; + CHARSET_INFO *mrn_charset_binary = NULL; + CHARSET_INFO *mrn_charset_ascii = NULL; + CHARSET_INFO *mrn_charset_latin1_1 = NULL; + CHARSET_INFO *mrn_charset_latin1_2 = NULL; + CHARSET_INFO *mrn_charset_cp932 = NULL; + CHARSET_INFO *mrn_charset_sjis = NULL; + CHARSET_INFO *mrn_charset_eucjpms = NULL; + CHARSET_INFO *mrn_charset_ujis = NULL; + CHARSET_INFO *mrn_charset_koi8r = NULL; + + void init(void) { + CHARSET_INFO **cs; + MRN_DBUG_ENTER_FUNCTION(); + for (cs = all_charsets; cs < all_charsets + MY_ALL_CHARSETS_SIZE; cs++) + { + if (!cs[0]) + continue; + if (!strcmp(cs[0]->csname, "utf8")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_utf8) + mrn_charset_utf8 = cs[0]; + else if (mrn_charset_utf8->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "utf8mb4")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_utf8mb4) + mrn_charset_utf8mb4 = cs[0]; + else if (mrn_charset_utf8mb4->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "binary")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_binary) + mrn_charset_binary = cs[0]; + else if (mrn_charset_binary->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "ascii")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_ascii) + mrn_charset_ascii = cs[0]; + else if (mrn_charset_ascii->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "latin1")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_latin1_1) + mrn_charset_latin1_1 = cs[0]; + else if (mrn_charset_latin1_1->cset != cs[0]->cset) + { + if (!mrn_charset_latin1_2) + mrn_charset_latin1_2 = cs[0]; + else if (mrn_charset_latin1_2->cset != cs[0]->cset) + DBUG_ASSERT(0); + } + continue; + } + if (!strcmp(cs[0]->csname, "cp932")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_cp932) + mrn_charset_cp932 = cs[0]; + else if (mrn_charset_cp932->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "sjis")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_sjis) + mrn_charset_sjis = cs[0]; + else if (mrn_charset_sjis->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "eucjpms")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_eucjpms) + mrn_charset_eucjpms = cs[0]; + else if (mrn_charset_eucjpms->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "ujis")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_ujis) + mrn_charset_ujis = cs[0]; + else if (mrn_charset_ujis->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + if (!strcmp(cs[0]->csname, "koi8r")) + { + DBUG_PRINT("info", ("mroonga: %s is %s [%p]", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + if (!mrn_charset_koi8r) + mrn_charset_koi8r = cs[0]; + else if (mrn_charset_koi8r->cset != cs[0]->cset) + DBUG_ASSERT(0); + continue; + } + DBUG_PRINT("info", ("mroonga: %s[%s][%p] is not supported", + cs[0]->name, cs[0]->csname, cs[0]->cset)); + } + DBUG_VOID_RETURN; + } + + int set(grn_ctx *ctx, const CHARSET_INFO *charset) { + MRN_DBUG_ENTER_FUNCTION(); + int error = 0; + + if (!set_raw(ctx, charset)) { + const char *name = ""; + const char *csname = ""; + if (charset) { + name = charset->name; + csname = charset->csname; + } + error = ER_MRN_CHARSET_NOT_SUPPORT_NUM; + my_printf_error(error, + ER_MRN_CHARSET_NOT_SUPPORT_STR, + MYF(0), name, csname); + } + + DBUG_RETURN(error); + } + + bool set_raw(grn_ctx *ctx, const CHARSET_INFO *charset) { + MRN_DBUG_ENTER_FUNCTION(); + if (!charset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_utf8->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (mrn_charset_utf8mb4 && charset->cset == mrn_charset_utf8mb4->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_cp932->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_eucjpms->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_latin1_1->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_latin1_2->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_LATIN1); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_koi8r->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_KOI8R); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_binary->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_ascii->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_UTF8); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_sjis->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_SJIS); + DBUG_RETURN(true); + } + if (charset->cset == mrn_charset_ujis->cset) + { + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_EUC_JP); + DBUG_RETURN(true); + } + GRN_CTX_SET_ENCODING(ctx, GRN_ENC_NONE); + DBUG_RETURN(false); + } + } +} diff --git a/storage/mroonga/lib/mrn_encoding.hpp b/storage/mroonga/lib/mrn_encoding.hpp new file mode 100644 index 00000000000..b29b44d967e --- /dev/null +++ b/storage/mroonga/lib/mrn_encoding.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_ENCODING_HPP_ +#define MRN_ENCODING_HPP_ + +#include + +#include +#include + +namespace mrn { + namespace encoding { + void init(void); + int set(grn_ctx *ctx, const CHARSET_INFO *charset); + bool set_raw(grn_ctx *ctx, const CHARSET_INFO *charset); + } +} + +#endif // MRN_ENCODING_HPP_ diff --git a/storage/mroonga/lib/mrn_external_lock.cpp b/storage/mroonga/lib/mrn_external_lock.cpp new file mode 100644 index 00000000000..b266b6594ca --- /dev/null +++ b/storage/mroonga/lib/mrn_external_lock.cpp @@ -0,0 +1,43 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_external_lock.hpp" + +namespace mrn { + ExternalLock::ExternalLock(THD *thd, handler *handler, int lock_type) + : thd_(thd), + handler_(handler), + lock_type_(lock_type) { + if (lock_type_ != F_UNLCK) { + error_ = handler_->ha_external_lock(thd_, lock_type); + } else { + error_ = 0; + } + } + + ExternalLock::~ExternalLock() { + if (lock_type_ != F_UNLCK) { + handler_->ha_external_lock(thd_, F_UNLCK); + } + } + + int ExternalLock::error() { + return error_; + } +} diff --git a/storage/mroonga/lib/mrn_external_lock.hpp b/storage/mroonga/lib/mrn_external_lock.hpp new file mode 100644 index 00000000000..f78b436f6e8 --- /dev/null +++ b/storage/mroonga/lib/mrn_external_lock.hpp @@ -0,0 +1,38 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_EXTERNAL_LOCK_HPP_ +#define MRN_EXTERNAL_LOCK_HPP_ + +#include + +namespace mrn { + class ExternalLock { + THD *thd_; + handler *handler_; + int lock_type_; + int error_; + public: + ExternalLock(THD *thd, handler *handler, int lock_type); + ~ExternalLock(); + int error(); + }; +} + +#endif // MRN_EXTERNAL_LOCK_HPP_ diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp new file mode 100644 index 00000000000..c34f9975e37 --- /dev/null +++ b/storage/mroonga/lib/mrn_field_normalizer.cpp @@ -0,0 +1,142 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_field_normalizer.hpp" +#include "mrn_encoding.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::FieldNormalizer" + +namespace mrn { + FieldNormalizer::FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field) + : ctx_(ctx), + thread_(thread), + field_(field) { + } + + FieldNormalizer::~FieldNormalizer() { + } + + bool FieldNormalizer::should_normalize() { + MRN_DBUG_ENTER_METHOD(); + + DBUG_PRINT("info", + ("mroonga: result_type = %u", field_->result_type())); + DBUG_PRINT("info", + ("mroonga: charset->name = %s", field_->charset()->name)); + DBUG_PRINT("info", + ("mroonga: charset->csname = %s", field_->charset()->csname)); + DBUG_PRINT("info", + ("mroonga: charset->state = %u", field_->charset()->state)); + bool need_normalize_p; + if (field_->charset()->state & (MY_CS_BINSORT | MY_CS_CSSORT)) { + need_normalize_p = false; + DBUG_PRINT("info", + ("mroonga: should_normalize: false: sort is required")); + } else { + if (is_text_type()) { + need_normalize_p = true; + DBUG_PRINT("info", ("mroonga: should_normalize: true: text type")); + } else { + need_normalize_p = false; + DBUG_PRINT("info", ("mroonga: should_normalize: false: no text type")); + } + } + + DBUG_RETURN(need_normalize_p); + } + + bool FieldNormalizer::is_text_type() { + MRN_DBUG_ENTER_METHOD(); + bool text_type_p; + switch (field_->type()) { + case MYSQL_TYPE_VARCHAR: + case MYSQL_TYPE_BLOB: + case MYSQL_TYPE_VAR_STRING: + text_type_p = true; + break; + case MYSQL_TYPE_STRING: + switch (field_->real_type()) { + case MYSQL_TYPE_ENUM: + case MYSQL_TYPE_SET: + text_type_p = false; + break; + default: + text_type_p = true; + break; + } + break; + default: + text_type_p = false; + break; + } + DBUG_RETURN(text_type_p); + } + + grn_obj *FieldNormalizer::normalize(const char *string, + unsigned int string_length) { + MRN_DBUG_ENTER_METHOD(); + grn_obj *normalizer = find_grn_normalizer(); + int flags = 0; + grn_encoding original_encoding = GRN_CTX_GET_ENCODING(ctx_); + encoding::set_raw(ctx_, field_->charset()); + grn_obj *grn_string = grn_string_open(ctx_, string, string_length, + normalizer, flags); + GRN_CTX_SET_ENCODING(ctx_, original_encoding); + DBUG_RETURN(grn_string); + } + + grn_obj *FieldNormalizer::find_grn_normalizer() { + MRN_DBUG_ENTER_METHOD(); + + const CHARSET_INFO *charset_info = field_->charset(); + const char *normalizer_name = NULL; + const char *default_normalizer_name = "NormalizerAuto"; + if ((strcmp(charset_info->name, "utf8_general_ci") == 0) || + (strcmp(charset_info->name, "utf8mb4_general_ci") == 0)) { + normalizer_name = "NormalizerMySQLGeneralCI"; + } else if ((strcmp(charset_info->name, "utf8_unicode_ci") == 0) || + (strcmp(charset_info->name, "utf8mb4_unicode_ci") == 0)) { + normalizer_name = "NormalizerMySQLUnicodeCI"; + } + + grn_obj *normalizer = NULL; + if (normalizer_name) { + normalizer = grn_ctx_get(ctx_, normalizer_name, -1); + if (!normalizer) { + char error_message[MRN_MESSAGE_BUFFER_SIZE]; + snprintf(error_message, MRN_MESSAGE_BUFFER_SIZE, + "%s normalizer isn't found for %s. " + "Install groonga-normalizer-mysql normalizer. " + "%s is used as fallback.", + normalizer_name, + charset_info->name, + default_normalizer_name); + push_warning(thread_, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, error_message); + } + } + + if (!normalizer) { + normalizer = grn_ctx_get(ctx_, default_normalizer_name, -1); + } + + DBUG_RETURN(normalizer); + } +} diff --git a/storage/mroonga/lib/mrn_field_normalizer.hpp b/storage/mroonga/lib/mrn_field_normalizer.hpp new file mode 100644 index 00000000000..5fd8974ce5b --- /dev/null +++ b/storage/mroonga/lib/mrn_field_normalizer.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_FIELD_NORMALIZER_HPP_ +#define MRN_FIELD_NORMALIZER_HPP_ + +#include + +#include +#include + +namespace mrn { + class FieldNormalizer { + public: + FieldNormalizer(grn_ctx *ctx, THD *thread, Field *field); + ~FieldNormalizer(); + + bool should_normalize(); + grn_obj *normalize(const char *string, unsigned int string_length); + grn_obj *find_grn_normalizer(); + + private: + grn_ctx *ctx_; + THD *thread_; + Field *field_; + + bool is_text_type(); + }; +} + +#endif // MRN_FIELD_NORMALIZER_HPP_ diff --git a/storage/mroonga/lib/mrn_grn.hpp b/storage/mroonga/lib/mrn_grn.hpp new file mode 100644 index 00000000000..f60fb7b616e --- /dev/null +++ b/storage/mroonga/lib/mrn_grn.hpp @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_GRN_HPP_ +#define MRN_GRN_HPP_ + +#include + +namespace mrn { + namespace grn { + bool is_table(grn_obj *obj) { + grn_id type = obj->header.type; + return GRN_TABLE_HASH_KEY <= type && obj->header.type <= GRN_DB; + } + + bool is_vector_column(grn_obj *column) { + int column_type = (column->header.flags & GRN_OBJ_COLUMN_TYPE_MASK); + return column_type == GRN_OBJ_COLUMN_VECTOR; + } + } +} + +#endif // MRN_GRN_HPP_ diff --git a/storage/mroonga/lib/mrn_index_column_name.cpp b/storage/mroonga/lib/mrn_index_column_name.cpp new file mode 100644 index 00000000000..14e83ec8e34 --- /dev/null +++ b/storage/mroonga/lib/mrn_index_column_name.cpp @@ -0,0 +1,96 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_index_column_name.hpp" + +#define MRN_MIN_INDEX_COLUMN_NAME_LENGTH 65 + +// for debug +#define MRN_CLASS_NAME "mrn::IndexColumnName" + +namespace mrn { + IndexColumnName::IndexColumnName(const char *table_name, + const char *mysql_column_name) + : table_name_(table_name), + mysql_column_name_(mysql_column_name) { + uchar encoded_mysql_column_name_multibyte[MRN_MAX_KEY_SIZE]; + const uchar *mysql_column_name_multibyte = + reinterpret_cast(mysql_column_name_); + encode(encoded_mysql_column_name_multibyte, + encoded_mysql_column_name_multibyte + MRN_MAX_KEY_SIZE, + mysql_column_name_multibyte, + mysql_column_name_multibyte + strlen(mysql_column_name_)); + snprintf(name_, MRN_MAX_KEY_SIZE, + "%s-%s", table_name_, encoded_mysql_column_name_multibyte); + length_ = strlen(name_); + if (length_ < MRN_MIN_INDEX_COLUMN_NAME_LENGTH) { + memset(name_ + length_, '-', MRN_MIN_INDEX_COLUMN_NAME_LENGTH - length_); + length_ = MRN_MIN_INDEX_COLUMN_NAME_LENGTH; + name_[length_] = '\0'; + } + } + + const char *IndexColumnName::c_str() { + return name_; + } + + size_t IndexColumnName::length() { + return length_; + } + + uint IndexColumnName::encode(uchar *encoded_start, + uchar *encoded_end, + const uchar *mysql_string_start, + const uchar *mysql_string_end) { + MRN_DBUG_ENTER_METHOD(); + my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc; + my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb; + DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start)); + encoded_end--; + uchar *encoded = encoded_start; + const uchar *mysql_string = mysql_string_start; + while (mysql_string < mysql_string_end && encoded < encoded_end) { + my_wc_t wc; + int mb_wc_converted_length; + int wc_mb_converted_length; + mb_wc_converted_length = + (*mb_wc)(NULL, &wc, mysql_string, mysql_string_end); + if (mb_wc_converted_length > 0) { + wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end); + if (wc_mb_converted_length <= 0) { + break; + } + } else if (mb_wc_converted_length == MY_CS_ILSEQ) { + *encoded = *mysql_string; + mb_wc_converted_length = 1; + wc_mb_converted_length = 1; + } else { + break; + } + mysql_string += mb_wc_converted_length; + encoded += wc_mb_converted_length; + } + *encoded = '\0'; + DBUG_PRINT("info", ("mroonga: out=%s", encoded_start)); + DBUG_RETURN(encoded - encoded_start); + } +} diff --git a/storage/mroonga/lib/mrn_index_column_name.hpp b/storage/mroonga/lib/mrn_index_column_name.hpp new file mode 100644 index 00000000000..5cd24623abd --- /dev/null +++ b/storage/mroonga/lib/mrn_index_column_name.hpp @@ -0,0 +1,43 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_INDEX_COLUMN_NAME_HPP_ +#define MRN_INDEX_COLUMN_NAME_HPP_ + +#include + +namespace mrn { + class IndexColumnName { + public: + IndexColumnName(const char *table_name, const char *mysql_column_name); + const char *c_str(); + size_t length(); + private: + const char *table_name_; + const char *mysql_column_name_; + char name_[MRN_MAX_KEY_SIZE]; + size_t length_; + + uint encode(uchar *encoded_start, uchar *encoded_end, + const uchar *mysql_string_start, const uchar *mysql_string_end); + }; +} + +#endif /* MRN_INDEX_COLUMN_NAME_HPP_ */ diff --git a/storage/mroonga/lib/mrn_index_table_name.cpp b/storage/mroonga/lib/mrn_index_table_name.cpp new file mode 100644 index 00000000000..93f4ff8f8fd --- /dev/null +++ b/storage/mroonga/lib/mrn_index_table_name.cpp @@ -0,0 +1,89 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_index_table_name.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::IndexTableName" + +namespace mrn { + IndexTableName::IndexTableName(const char *table_name, + const char *mysql_index_name) + : table_name_(table_name), + mysql_index_name_(mysql_index_name) { + uchar encoded_mysql_index_name_multibyte[MRN_MAX_KEY_SIZE]; + const uchar *mysql_index_name_multibyte = + reinterpret_cast(mysql_index_name_); + encode(encoded_mysql_index_name_multibyte, + encoded_mysql_index_name_multibyte + MRN_MAX_KEY_SIZE, + mysql_index_name_multibyte, + mysql_index_name_multibyte + strlen(mysql_index_name_)); + snprintf(name_, MRN_MAX_KEY_SIZE, + "%s-%s", table_name_, encoded_mysql_index_name_multibyte); + length_ = strlen(name_); + } + + const char *IndexTableName::c_str() { + return name_; + } + + size_t IndexTableName::length() { + return length_; + } + + uint IndexTableName::encode(uchar *encoded_start, + uchar *encoded_end, + const uchar *mysql_string_start, + const uchar *mysql_string_end) { + MRN_DBUG_ENTER_METHOD(); + my_charset_conv_mb_wc mb_wc = system_charset_info->cset->mb_wc; + my_charset_conv_wc_mb wc_mb = my_charset_filename.cset->wc_mb; + DBUG_PRINT("info", ("mroonga: in=%s", mysql_string_start)); + encoded_end--; + uchar *encoded = encoded_start; + const uchar *mysql_string = mysql_string_start; + while (mysql_string < mysql_string_end && encoded < encoded_end) { + my_wc_t wc; + int mb_wc_converted_length; + int wc_mb_converted_length; + mb_wc_converted_length = + (*mb_wc)(NULL, &wc, mysql_string, mysql_string_end); + if (mb_wc_converted_length > 0) { + wc_mb_converted_length = (*wc_mb)(NULL, wc, encoded, encoded_end); + if (wc_mb_converted_length <= 0) { + break; + } + } else if (mb_wc_converted_length == MY_CS_ILSEQ) { + *encoded = *mysql_string; + mb_wc_converted_length = 1; + wc_mb_converted_length = 1; + } else { + break; + } + mysql_string += mb_wc_converted_length; + encoded += wc_mb_converted_length; + } + *encoded = '\0'; + DBUG_PRINT("info", ("mroonga: out=%s", encoded_start)); + DBUG_RETURN(encoded - encoded_start); + } +} diff --git a/storage/mroonga/lib/mrn_index_table_name.hpp b/storage/mroonga/lib/mrn_index_table_name.hpp new file mode 100644 index 00000000000..4ac4bfe087b --- /dev/null +++ b/storage/mroonga/lib/mrn_index_table_name.hpp @@ -0,0 +1,43 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_INDEX_TABLE_NAME_HPP_ +#define MRN_INDEX_TABLE_NAME_HPP_ + +#include + +namespace mrn { + class IndexTableName { + public: + IndexTableName(const char *table_name, const char *mysql_index_name); + const char *c_str(); + size_t length(); + private: + const char *table_name_; + const char *mysql_index_name_; + char name_[MRN_MAX_KEY_SIZE]; + size_t length_; + + uint encode(uchar *encoded_start, uchar *encoded_end, + const uchar *mysql_string_start, const uchar *mysql_string_end); + }; +} + +#endif /* MRN_INDEX_TABLE_NAME_HPP_ */ diff --git a/storage/mroonga/lib/mrn_lock.cpp b/storage/mroonga/lib/mrn_lock.cpp new file mode 100644 index 00000000000..94f8a4774af --- /dev/null +++ b/storage/mroonga/lib/mrn_lock.cpp @@ -0,0 +1,31 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_lock.hpp" + +namespace mrn { + Lock::Lock(pthread_mutex_t *mutex) + : mutex_(mutex) { + pthread_mutex_lock(mutex_); + } + + Lock::~Lock() { + pthread_mutex_unlock(mutex_); + } +} diff --git a/storage/mroonga/lib/mrn_lock.hpp b/storage/mroonga/lib/mrn_lock.hpp new file mode 100644 index 00000000000..31dd7b3e53b --- /dev/null +++ b/storage/mroonga/lib/mrn_lock.hpp @@ -0,0 +1,36 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_LOCK_HPP_ +#define MRN_LOCK_HPP_ + +#include +#include + +namespace mrn { + class Lock { + public: + Lock(pthread_mutex_t *mutex); + ~Lock(); + private: + pthread_mutex_t *mutex_; + }; +} + +#endif /* MRN_LOCK_HPP_ */ diff --git a/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp new file mode 100644 index 00000000000..c944b4a4bc0 --- /dev/null +++ b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.cpp @@ -0,0 +1,33 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_match_escalation_threshold_scope.hpp" + +namespace mrn { + MatchEscalationThresholdScope::MatchEscalationThresholdScope( + grn_ctx *ctx, long long int threshold) + : ctx_(ctx), + original_threshold_(grn_ctx_get_match_escalation_threshold(ctx_)) { + grn_ctx_set_match_escalation_threshold(ctx_, threshold); + } + + MatchEscalationThresholdScope::~MatchEscalationThresholdScope() { + grn_ctx_set_match_escalation_threshold(ctx_, original_threshold_); + } +} diff --git a/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp new file mode 100644 index 00000000000..352e6589f0d --- /dev/null +++ b/storage/mroonga/lib/mrn_match_escalation_threshold_scope.hpp @@ -0,0 +1,35 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ +#define MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ + +#include + +namespace mrn { + class MatchEscalationThresholdScope { + grn_ctx *ctx_; + long long int original_threshold_; + public: + MatchEscalationThresholdScope(grn_ctx *ctx, long long int threshold); + ~MatchEscalationThresholdScope(); + }; +} + +#endif // MRN_MATCH_ESCALATION_THRESHOLD_SCOPE_HPP_ diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp new file mode 100644 index 00000000000..5ce736a49b8 --- /dev/null +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -0,0 +1,548 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012-2014 Kouhei Sutou + Copyright(C) 2013 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_multiple_column_key_codec.hpp" +#include "mrn_field_normalizer.hpp" +#include "mrn_smart_grn_obj.hpp" + +// for debug +#define MRN_CLASS_NAME "mrn::MultipleColumnKeyCodec" + +#ifdef WORDS_BIGENDIAN +#define mrn_byte_order_host_to_network(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key); \ + while (size_--) { *buf_++ = *key_++; } \ +} +#else /* WORDS_BIGENDIAN */ +#define mrn_byte_order_host_to_network(buf, key, size) \ +{ \ + uint32 size_ = (uint32)(size); \ + uint8 *buf_ = (uint8 *)(buf); \ + uint8 *key_ = (uint8 *)(key) + size_; \ + while (size_--) { *buf_++ = *(--key_); } \ +} +#endif /* WORDS_BIGENDIAN */ + +namespace mrn { + MultipleColumnKeyCodec::MultipleColumnKeyCodec(grn_ctx *ctx, + THD *thread, + KEY *key_info) + : ctx_(ctx), + thread_(thread), + key_info_(key_info) { + } + + MultipleColumnKeyCodec::~MultipleColumnKeyCodec() { + } + + int MultipleColumnKeyCodec::encode(const uchar *mysql_key, + uint mysql_key_length, + uchar *grn_key, + uint *grn_key_length) { + MRN_DBUG_ENTER_METHOD(); + int error = 0; + const uchar *current_mysql_key = mysql_key; + const uchar *mysql_key_end = mysql_key + mysql_key_length; + uchar *current_grn_key = grn_key; + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + *grn_key_length = 0; + for (int i = 0; i < n_key_parts && current_mysql_key < mysql_key_end; i++) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + *current_grn_key = 0; + current_mysql_key += 1; + current_grn_key += 1; + (*grn_key_length)++; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + + switch (data_type) { + case TYPE_UNKNOWN: + // TODO: This will not be happen. This is just for + // suppressing warnings by gcc -O2. :< + error = HA_ERR_UNSUPPORTED; + break; + case TYPE_LONG_LONG_NUMBER: + { + long long int long_long_value = 0; + switch (data_size) { + case 3: + long_long_value = (long long int)sint3korr(current_mysql_key); + break; + case 8: + long_long_value = (long long int)sint8korr(current_mysql_key); + break; + } + mrn_byte_order_host_to_network(current_grn_key, &long_long_value, + data_size); + *((uint8 *)(current_grn_key)) ^= 0x80; + } + break; + case TYPE_NUMBER: + mrn_byte_order_host_to_network(current_grn_key, current_mysql_key, data_size); + { + Field_num *number_field = (Field_num *)field; + if (!number_field->unsigned_flag) { + *((uint8 *)(current_grn_key)) ^= 0x80; + } + } + break; + case TYPE_FLOAT: + { + float value; + float4get(value, current_mysql_key); + encode_float(value, data_size, current_grn_key); + } + break; + case TYPE_DOUBLE: + { + double value; + float8get(value, current_mysql_key); + encode_double(value, data_size, current_grn_key); + } + break; + case TYPE_BYTE_SEQUENCE: + memcpy(current_grn_key, current_mysql_key, data_size); + break; + case TYPE_BYTE_REVERSE: + encode_reverse(current_mysql_key, data_size, current_grn_key); + break; + case TYPE_BYTE_BLOB: + encode_blob(field, current_mysql_key, current_grn_key, &data_size); + break; + } + + if (error) { + break; + } + + current_mysql_key += data_size; + current_grn_key += data_size; + *grn_key_length += data_size; + } + + DBUG_RETURN(error); + } + + int MultipleColumnKeyCodec::decode(const uchar *grn_key, + uint grn_key_length, + uchar *mysql_key, + uint *mysql_key_length) { + MRN_DBUG_ENTER_METHOD(); + int error = 0; + const uchar *current_grn_key = grn_key; + const uchar *grn_key_end = grn_key + grn_key_length; + uchar *current_mysql_key = mysql_key; + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + *mysql_key_length = 0; + for (int i = 0; i < n_key_parts && current_grn_key < grn_key_end; i++) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + *current_mysql_key = 0; + current_grn_key += 1; + current_mysql_key += 1; + (*mysql_key_length)++; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + + switch (data_type) { + case TYPE_UNKNOWN: + // TODO: This will not be happen. This is just for + // suppressing warnings by gcc -O2. :< + error = HA_ERR_UNSUPPORTED; + break; + case TYPE_LONG_LONG_NUMBER: + { + long long int long_long_value = 0; + switch (data_size) { + case 3: + long_long_value = (long long int)sint3korr(current_grn_key); + break; + case 8: + long_long_value = (long long int)sint8korr(current_grn_key); + break; + } + *((uint8 *)(&long_long_value)) ^= 0x80; + mrn_byte_order_host_to_network(current_mysql_key, &long_long_value, + data_size); + } + break; + case TYPE_NUMBER: + { + uchar buffer[8]; + memcpy(buffer, current_grn_key, data_size); + Field_num *number_field = (Field_num *)field; + if (!number_field->unsigned_flag) { + buffer[0] ^= 0x80; + } + mrn_byte_order_host_to_network(current_mysql_key, buffer, + data_size); + } + break; + case TYPE_FLOAT: + decode_float(current_grn_key, current_mysql_key, data_size); + break; + case TYPE_DOUBLE: + decode_double(current_grn_key, current_mysql_key, data_size); + break; + case TYPE_BYTE_SEQUENCE: + memcpy(current_mysql_key, current_grn_key, data_size); + break; + case TYPE_BYTE_REVERSE: + decode_reverse(current_grn_key, current_mysql_key, data_size); + break; + case TYPE_BYTE_BLOB: + memcpy(current_mysql_key, + current_grn_key + data_size, + HA_KEY_BLOB_LENGTH); + memcpy(current_mysql_key + HA_KEY_BLOB_LENGTH, + current_grn_key, + data_size); + data_size += HA_KEY_BLOB_LENGTH; + break; + } + + if (error) { + break; + } + + current_grn_key += data_size; + current_mysql_key += data_size; + *mysql_key_length += data_size; + } + + DBUG_RETURN(error); + } + + uint MultipleColumnKeyCodec::size() { + MRN_DBUG_ENTER_METHOD(); + + int n_key_parts = KEY_N_KEY_PARTS(key_info_); + DBUG_PRINT("info", ("mroonga: n_key_parts=%d", n_key_parts)); + + uint total_size = 0; + for (int i = 0; i < n_key_parts; ++i) { + KEY_PART_INFO *key_part = &(key_info_->key_part[i]); + Field *field = key_part->field; + DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); + + if (field->null_bit) { + DBUG_PRINT("info", ("mroonga: field has null bit")); + ++total_size; + } + + DataType data_type = TYPE_UNKNOWN; + uint data_size = 0; + get_key_info(key_part, &data_type, &data_size); + total_size += data_size; + if (data_type == TYPE_BYTE_BLOB) { + total_size += HA_KEY_BLOB_LENGTH; + } + } + + DBUG_RETURN(total_size); + } + + void MultipleColumnKeyCodec::get_key_info(KEY_PART_INFO *key_part, + DataType *data_type, + uint *data_size) { + MRN_DBUG_ENTER_METHOD(); + + *data_type = TYPE_UNKNOWN; + *data_size = 0; + + Field *field = key_part->field; + switch (field->real_type()) { + case MYSQL_TYPE_DECIMAL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DECIMAL")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_YEAR: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TINY")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_SHORT: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_SHORT")); + *data_type = TYPE_NUMBER; + *data_size = 2; + break; + case MYSQL_TYPE_LONG: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_LONG")); + *data_type = TYPE_NUMBER; + *data_size = 4; + break; + case MYSQL_TYPE_FLOAT: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_FLOAT")); + *data_type = TYPE_FLOAT; + *data_size = 4; + break; + case MYSQL_TYPE_DOUBLE: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DOUBLE")); + *data_type = TYPE_DOUBLE; + *data_size = 8; + break; + case MYSQL_TYPE_NULL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NULL")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_TIMESTAMP: + case MYSQL_TYPE_DATE: + case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_NEWDATE: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME")); + *data_type = TYPE_BYTE_REVERSE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_LONGLONG: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_LONGLONG")); + *data_type = TYPE_NUMBER; + *data_size = 8; + break; + case MYSQL_TYPE_INT24: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_INT24")); + *data_type = TYPE_NUMBER; + *data_size = 3; + break; + case MYSQL_TYPE_TIME: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIME")); + *data_type = TYPE_LONG_LONG_NUMBER; + *data_size = 3; + break; + case MYSQL_TYPE_VARCHAR: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_VARCHAR")); + *data_type = TYPE_BYTE_BLOB; + *data_size = key_part->length; + break; + case MYSQL_TYPE_BIT: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_BIT")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; +#ifdef MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 + case MYSQL_TYPE_TIMESTAMP2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIMESTAMP2")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 + case MYSQL_TYPE_DATETIME2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_DATETIME2")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif +#ifdef MRN_HAVE_MYSQL_TYPE_TIME2 + case MYSQL_TYPE_TIME2: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_TIME2")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; +#endif + case MYSQL_TYPE_NEWDECIMAL: + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_NEWDECIMAL")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_ENUM: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_ENUM")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_SET: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_SET")); + *data_type = TYPE_NUMBER; + *data_size = 1; + break; + case MYSQL_TYPE_TINY_BLOB: + case MYSQL_TYPE_MEDIUM_BLOB: + case MYSQL_TYPE_LONG_BLOB: + case MYSQL_TYPE_BLOB: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_BLOB")); + *data_type = TYPE_BYTE_BLOB; + *data_size = key_part->length; + break; + case MYSQL_TYPE_VAR_STRING: + case MYSQL_TYPE_STRING: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_STRING")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + case MYSQL_TYPE_GEOMETRY: + // TODO + DBUG_PRINT("info", ("mroonga: MYSQL_TYPE_GEOMETRY")); + *data_type = TYPE_BYTE_SEQUENCE; + *data_size = key_part->length; + break; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_float(volatile float value, uint data_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + int n_bits = (data_size * 8 - 1); + volatile int *int_value_pointer = (int *)(&value); + int int_value = *int_value_pointer; + int_value ^= ((int_value >> n_bits) | (1 << n_bits)); + mrn_byte_order_host_to_network(grn_key, &int_value, data_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_float(const uchar *grn_key, + uchar *mysql_key, + uint data_size) { + MRN_DBUG_ENTER_METHOD(); + int int_value; + mrn_byte_order_host_to_network(&int_value, grn_key, data_size); + int max_bit = (data_size * 8 - 1); + *((int *)mysql_key) = + int_value ^ (((int_value ^ (1 << max_bit)) >> max_bit) | + (1 << max_bit)); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_double(volatile double value, uint data_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + int n_bits = (data_size * 8 - 1); + volatile long long int *long_long_value_pointer = (long long int *)(&value); + volatile long long int long_long_value = *long_long_value_pointer; + long_long_value ^= ((long_long_value >> n_bits) | (1LL << n_bits)); + mrn_byte_order_host_to_network(grn_key, &long_long_value, data_size); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_double(const uchar *grn_key, + uchar *mysql_key, + uint data_size) { + MRN_DBUG_ENTER_METHOD(); + long long int long_long_value; + mrn_byte_order_host_to_network(&long_long_value, grn_key, data_size); + int max_bit = (data_size * 8 - 1); + *((long long int *)mysql_key) = + long_long_value ^ (((long_long_value ^ (1LL << max_bit)) >> max_bit) | + (1LL << max_bit)); + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_reverse(const uchar *mysql_key, uint data_size, + uchar *grn_key) { + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < data_size; i++) { + grn_key[i] = mysql_key[data_size - i - 1]; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::decode_reverse(const uchar *grn_key, + uchar *mysql_key, + uint data_size) { + MRN_DBUG_ENTER_METHOD(); + for (uint i = 0; i < data_size; i++) { + mysql_key[i] = grn_key[data_size - i - 1]; + } + DBUG_VOID_RETURN; + } + + void MultipleColumnKeyCodec::encode_blob(Field *field, + const uchar *mysql_key, + uchar *grn_key, + uint *data_size) { + FieldNormalizer normalizer(ctx_, thread_, field); + if (normalizer.should_normalize()) { +#if HA_KEY_BLOB_LENGTH != 2 +# error "TODO: support HA_KEY_BLOB_LENGTH != 2 case if it is needed" +#endif + const char *blob_data = + reinterpret_cast(mysql_key + HA_KEY_BLOB_LENGTH); + uint16 blob_data_length = *((uint16 *)(mysql_key)); + grn_obj *grn_string = normalizer.normalize(blob_data, + blob_data_length); + mrn::SmartGrnObj smart_grn_string(ctx_, grn_string); + const char *normalized; + unsigned int normalized_length = 0; + grn_string_get_normalized(ctx_, grn_string, + &normalized, &normalized_length, NULL); + uint16 new_blob_data_length; + if (normalized_length <= UINT_MAX16) { + memcpy(grn_key, normalized, normalized_length); + if (normalized_length < *data_size) { + memset(grn_key + normalized_length, + '\0', *data_size - normalized_length); + } + new_blob_data_length = normalized_length; + } else { + push_warning_printf(thread_, + Sql_condition::WARN_LEVEL_WARN, + WARN_DATA_TRUNCATED, + "normalized data truncated " + "for multiple column index: " + "normalized-data-size: <%u> " + "max-data-size: <%u> " + "column-name: <%s> " + "data: <%.*s>", + normalized_length, + UINT_MAX16, + field->field_name, + blob_data_length, blob_data); + memcpy(grn_key, normalized, blob_data_length); + new_blob_data_length = blob_data_length; + } + memcpy(grn_key + *data_size, &new_blob_data_length, HA_KEY_BLOB_LENGTH); + } else { + memcpy(grn_key + *data_size, mysql_key, HA_KEY_BLOB_LENGTH); + memcpy(grn_key, mysql_key + HA_KEY_BLOB_LENGTH, *data_size); + } + *data_size += HA_KEY_BLOB_LENGTH; + } +} diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp new file mode 100644 index 00000000000..fc6ae285357 --- /dev/null +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.hpp @@ -0,0 +1,70 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ +#define MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ + +#include + +#include +#include + +namespace mrn { + class MultipleColumnKeyCodec { + public: + MultipleColumnKeyCodec(grn_ctx *ctx, THD *thread, KEY *key_info); + ~MultipleColumnKeyCodec(); + + int encode(const uchar *mysql_key, uint mysql_key_length, + uchar *grn_key, uint *grn_key_length); + int decode(const uchar *grn_key, uint grn_key_length, + uchar *mysql_key, uint *mysql_key_length); + uint size(); + + private: + enum DataType { + TYPE_UNKNOWN, + TYPE_LONG_LONG_NUMBER, + TYPE_NUMBER, + TYPE_FLOAT, + TYPE_DOUBLE, + TYPE_BYTE_SEQUENCE, + TYPE_BYTE_REVERSE, + TYPE_BYTE_BLOB + }; + + grn_ctx *ctx_; + THD *thread_; + KEY *key_info_; + + void get_key_info(KEY_PART_INFO *key_part, + DataType *data_type, uint *data_size); + + void encode_float(volatile float value, uint data_size, uchar *grn_key); + void decode_float(const uchar *grn_key, uchar *mysql_key, uint data_size); + void encode_double(volatile double value, uint data_size, uchar *grn_key); + void decode_double(const uchar *grn_key, uchar *mysql_key, uint data_size); + void encode_reverse(const uchar *mysql_key, uint data_size, uchar *grn_key); + void decode_reverse(const uchar *grn_key, uchar *mysql_key, uint data_size); + void encode_blob(Field *field, + const uchar *mysql_key, uchar *grn_key, uint *data_size); + }; +} + +#endif // MRN_MULTIPLE_COLUMN_KEY_CODEC_HPP_ diff --git a/storage/mroonga/lib/mrn_mysqlservices.cpp b/storage/mroonga/lib/mrn_mysqlservices.cpp new file mode 100644 index 00000000000..9c7af9acfe0 --- /dev/null +++ b/storage/mroonga/lib/mrn_mysqlservices.cpp @@ -0,0 +1,32 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +/* +void *thd_alloc(MYSQL_THD thd, unsigned int size) +{ + return thd->alloc(size); +} +*/ diff --git a/storage/mroonga/lib/mrn_parameters_parser.cpp b/storage/mroonga/lib/mrn_parameters_parser.cpp new file mode 100644 index 00000000000..9a05097e548 --- /dev/null +++ b/storage/mroonga/lib/mrn_parameters_parser.cpp @@ -0,0 +1,176 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_parameters_parser.hpp" + +#include + +namespace mrn { + class Parameter { + public: + char *key_; + char *value_; + + Parameter(const char *key, unsigned int key_length, + const char *value, unsigned int value_length) + : key_(my_strndup(key, key_length, MYF(0))), + value_(my_strndup(value, value_length, MYF(0))) { + }; + ~Parameter() { + if (key_) { + my_free(key_, MYF(0)); + } + if (value_) { + my_free(value_, MYF(0)); + } + }; + }; + + ParametersParser::ParametersParser(const char *input, + unsigned int input_length) + : input_(input), + input_length_(input_length), + parameters_(NULL) { + } + + ParametersParser::~ParametersParser() { + for (LIST *next = parameters_; next; next = next->next) { + Parameter *parameter = static_cast(next->data); + delete parameter; + } + list_free(parameters_, false); + } + + void ParametersParser::parse() { + const char *current = input_; + const char *end = input_ + input_length_; + for (; current < end; ++current) { + if (is_white_space(current[0])) { + continue; + } + + const char *key = current; + unsigned int key_length = 0; + while (current < end && + !is_white_space(current[0]) && + current[0] != '\'' && current[0] != '"' && current[0] != ',') { + ++current; + ++key_length; + } + if (current == end) { + break; + } + + while (current < end && is_white_space(current[0])) { + ++current; + } + if (current == end) { + break; + } + current = parse_value(current, end, key, key_length); + if (!current) { + break; + } + + while (current < end && is_white_space(current[0])) { + ++current; + } + if (current == end) { + break; + } + if (current[0] != ',') { + // TODO: report error + break; + } + } + } + + const char *ParametersParser::parse_value(const char *current, + const char *end, + const char *key, + unsigned int key_length) { + char quote = current[0]; + if (quote != '\'' && quote != '"') { + // TODO: report error + return NULL; + } + ++current; + + bool found = false; + static const unsigned int max_value_length = 4096; + char value[max_value_length]; + unsigned int value_length = 0; + for (; current < end && value_length < max_value_length; ++current) { + if (current[0] == quote) { + Parameter *parameter = new Parameter(key, key_length, + value, value_length); + list_push(parameters_, parameter); + found = true; + ++current; + break; + } + + switch (current[0]) { + case '\\': + if (current + 1 == end) { + break; + } + switch (current[1]) { + case 'b': + value[value_length] = '\b'; + break; + case 'n': + value[value_length] = '\n'; + break; + case 'r': + value[value_length] = '\r'; + break; + case 't': + value[value_length] = '\t'; + break; + default: + value[value_length] = current[1]; + break; + } + break; + default: + value[value_length] = current[0]; + break; + } + ++value_length; + } + + if (!found) { + // TODO: report error + } + + return current; + } + + const char *ParametersParser::operator[](const char *key) { + for (LIST *next = parameters_; next; next = next->next) { + Parameter *parameter = static_cast(next->data); + if (strcasecmp(parameter->key_, key) == 0) { + return parameter->value_; + } + } + return NULL; + } +} diff --git a/storage/mroonga/lib/mrn_parameters_parser.hpp b/storage/mroonga/lib/mrn_parameters_parser.hpp new file mode 100644 index 00000000000..a15371ca72e --- /dev/null +++ b/storage/mroonga/lib/mrn_parameters_parser.hpp @@ -0,0 +1,59 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_PARAMETERS_PARSER_HPP_ +#define MRN_PARAMETERS_PARSER_HPP_ + +#include +#include + +namespace mrn { + class ParametersParser { + public: + ParametersParser(const char *input, unsigned int input_length); + ~ParametersParser(); + void parse(); + const char *operator[](const char *key); + + private: + const char *input_; + unsigned int input_length_; + + LIST *parameters_; + + bool is_white_space(char character) { + switch (character) { + case ' ': + case '\r': + case '\n': + case '\t': + return true; + break; + default: + return false; + break; + } + }; + const char *parse_value(const char *current, const char *end, + const char *key, unsigned int key_length); + }; +} + +#endif /* MRN_PARAMETERS_PARSER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_path_mapper.cpp b/storage/mroonga/lib/mrn_path_mapper.cpp new file mode 100644 index 00000000000..ee5432f16bb --- /dev/null +++ b/storage/mroonga/lib/mrn_path_mapper.cpp @@ -0,0 +1,192 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_path_mapper.hpp" + +#include + +namespace mrn { + char *PathMapper::default_path_prefix = NULL; + char *PathMapper::default_mysql_data_home_path = NULL; + + PathMapper::PathMapper(const char *mysql_path, + const char *path_prefix, + const char *mysql_data_home_path) + : mysql_path_(mysql_path), + path_prefix_(path_prefix), + mysql_data_home_path_(mysql_data_home_path) { + db_path_[0] = '\0'; + db_name_[0] = '\0'; + table_name_[0] = '\0'; + mysql_table_name_[0] = '\0'; + } + + /** + * "./${db}/${table}" ==> "${db}.mrn" + * "./${db}/" ==> "${db}.mrn" + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" ==> + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0.mrn" + */ + const char *PathMapper::db_path() { + if (db_path_[0] != '\0') { + return db_path_; + } + + if (mysql_path_[0] == FN_CURLIB && mysql_path_[1] == FN_LIBCHAR) { + if (path_prefix_) { + strcpy(db_path_, path_prefix_); + } + + int i = 2, j = strlen(db_path_), len; + len = strlen(mysql_path_); + while (mysql_path_[i] != FN_LIBCHAR && i < len) { + db_path_[j++] = mysql_path_[i++]; + } + db_path_[j] = '\0'; + } else if (mysql_data_home_path_) { + int len = strlen(mysql_path_); + int mysql_data_home_len = strlen(mysql_data_home_path_); + if (len > mysql_data_home_len && + !strncmp(mysql_path_, mysql_data_home_path_, mysql_data_home_len)) { + int i = mysql_data_home_len, j; + if (path_prefix_ && path_prefix_[0] == FN_LIBCHAR) { + strcpy(db_path_, path_prefix_); + j = strlen(db_path_); + } else { + memcpy(db_path_, mysql_data_home_path_, mysql_data_home_len); + if (path_prefix_) { + if (path_prefix_[0] == FN_CURLIB && + path_prefix_[1] == FN_LIBCHAR) { + strcpy(&db_path_[mysql_data_home_len], &path_prefix_[2]); + } else { + strcpy(&db_path_[mysql_data_home_len], path_prefix_); + } + j = strlen(db_path_); + } else { + j = mysql_data_home_len; + } + } + + while (mysql_path_[i] != FN_LIBCHAR && i < len) { + db_path_[j++] = mysql_path_[i++]; + } + if (i == len) { + memcpy(db_path_, mysql_path_, len); + } else { + db_path_[j] = '\0'; + } + } else { + strcpy(db_path_, mysql_path_); + } + } else { + strcpy(db_path_, mysql_path_); + } + strcat(db_path_, MRN_DB_FILE_SUFFIX); + return db_path_; + } + + /** + * "./${db}/${table}" ==> "${db}" + * "./${db}/" ==> "${db}" + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" ==> + * "/tmp/mysql-test/var/tmp/mysqld.1/#sql27c5_1_0" + */ + const char *PathMapper::db_name() { + if (db_name_[0] != '\0') { + return db_name_; + } + + if (mysql_path_[0] == FN_CURLIB && mysql_path_[1] == FN_LIBCHAR) { + int i = 2, j = 0, len; + len = strlen(mysql_path_); + while (mysql_path_[i] != FN_LIBCHAR && i < len) { + db_name_[j++] = mysql_path_[i++]; + } + db_name_[j] = '\0'; + } else if (mysql_data_home_path_) { + int len = strlen(mysql_path_); + int mysql_data_home_len = strlen(mysql_data_home_path_); + if (len > mysql_data_home_len && + !strncmp(mysql_path_, mysql_data_home_path_, mysql_data_home_len)) { + int i = mysql_data_home_len, j = 0; + while (mysql_path_[i] != FN_LIBCHAR && i < len) { + db_name_[j++] = mysql_path_[i++]; + } + if (i == len) { + memcpy(db_name_, mysql_path_, len); + } else { + db_name_[j] = '\0'; + } + } else { + strcpy(db_name_, mysql_path_); + } + } else { + strcpy(db_name_, mysql_path_); + } + return db_name_; + } + + /** + * "./${db}/${table}" ==> "${table}" (with encoding first '_') + */ + const char *PathMapper::table_name() { + if (table_name_[0] != '\0') { + return table_name_; + } + + int len = strlen(mysql_path_); + int i = len, j = 0; + for (; mysql_path_[--i] != FN_LIBCHAR ;) {} + if (mysql_path_[i + 1] == '_') { + table_name_[j++] = '@'; + table_name_[j++] = '0'; + table_name_[j++] = '0'; + table_name_[j++] = '5'; + table_name_[j++] = 'f'; + i++; + } + for (; i < len ;) { + table_name_[j++] = mysql_path_[++i]; + } + table_name_[j] = '\0'; + return table_name_; + } + + /** + * "./${db}/${table}" ==> "${table}" (without encoding first '_') + */ + const char *PathMapper::mysql_table_name() { + if (mysql_table_name_[0] != '\0') { + return mysql_table_name_; + } + + int len = strlen(mysql_path_); + int i = len, j = 0; + for (; mysql_path_[--i] != FN_LIBCHAR ;) {} + for (; i < len ;) { + mysql_table_name_[j++] = mysql_path_[++i]; + } + mysql_table_name_[j] = '\0'; + return mysql_table_name_; + } +} diff --git a/storage/mroonga/lib/mrn_path_mapper.hpp b/storage/mroonga/lib/mrn_path_mapper.hpp new file mode 100644 index 00000000000..f70cd7b5587 --- /dev/null +++ b/storage/mroonga/lib/mrn_path_mapper.hpp @@ -0,0 +1,51 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_PATH_MAPPER_HPP_ +#define MRN_PATH_MAPPER_HPP_ + +#include + +namespace mrn { + class PathMapper { + public: + static char *default_path_prefix; + static char *default_mysql_data_home_path; + + PathMapper(const char *mysql_path, + const char *path_prefix=default_path_prefix, + const char *mysql_data_home_path=default_mysql_data_home_path); + const char *db_path(); + const char *db_name(); + const char *table_name(); + const char *mysql_table_name(); + private: + const char *mysql_path_; + const char *path_prefix_; + const char *mysql_data_home_path_; + char db_path_[MRN_MAX_PATH_SIZE]; + char db_name_[MRN_MAX_PATH_SIZE]; + char table_name_[MRN_MAX_PATH_SIZE]; + char mysql_table_name_[MRN_MAX_PATH_SIZE]; + }; +} + +#endif /* MRN_PATH_MAPPER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.cpp b/storage/mroonga/lib/mrn_smart_grn_obj.cpp new file mode 100644 index 00000000000..9dbae6528f9 --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_grn_obj.cpp @@ -0,0 +1,53 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include "mrn_smart_grn_obj.hpp" + +namespace mrn { + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, grn_obj *obj) + : ctx_(ctx), + obj_(obj) { + } + + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, const char *name, int name_size) + : ctx_(ctx), + obj_(NULL) { + if (name_size < 0) { + name_size = strlen(name); + } + obj_ = grn_ctx_get(ctx_, name, name_size); + } + + SmartGrnObj::SmartGrnObj(grn_ctx *ctx, grn_id id) + : ctx_(ctx), + obj_(grn_ctx_at(ctx_, id)) { + } + + SmartGrnObj::~SmartGrnObj() { + if (obj_) { + grn_obj_unlink(ctx_, obj_); + } + } + + grn_obj *SmartGrnObj::get() { + return obj_; + } +} diff --git a/storage/mroonga/lib/mrn_smart_grn_obj.hpp b/storage/mroonga/lib/mrn_smart_grn_obj.hpp new file mode 100644 index 00000000000..c9c86f3e46e --- /dev/null +++ b/storage/mroonga/lib/mrn_smart_grn_obj.hpp @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_SMART_GRN_OBJ_HPP_ +#define MRN_SMART_GRN_OBJ_HPP_ + +#include + +namespace mrn { + class SmartGrnObj { + grn_ctx *ctx_; + grn_obj *obj_; + public: + SmartGrnObj(grn_ctx *ctx, grn_obj *obj); + SmartGrnObj(grn_ctx *ctx, const char *name, int name_size=-1); + SmartGrnObj(grn_ctx *ctx, grn_id id); + ~SmartGrnObj(); + + grn_obj *get(); + }; +} + +#endif // MRN_SMART_GRN_OBJ_HPP_ diff --git a/storage/mroonga/lib/mrn_time_converter.cpp b/storage/mroonga/lib/mrn_time_converter.cpp new file mode 100644 index 00000000000..63b2e53766d --- /dev/null +++ b/storage/mroonga/lib/mrn_time_converter.cpp @@ -0,0 +1,260 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "mrn_time_converter.hpp" + +#ifdef min +# undef min +#endif +#ifdef max +# undef max +#endif + +#include + +// for debug +#define MRN_CLASS_NAME "mrn::TimeConverter" + +namespace mrn { + TimeConverter::TimeConverter() { + } + + TimeConverter::~TimeConverter() { + } + + time_t TimeConverter::tm_to_time_gm(struct tm *time, bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + *truncated = true; + struct tm gmdate; + time->tm_yday = -1; + time->tm_isdst = -1; + time_t sec_t = mktime(time); + if (time->tm_yday == -1) { + DBUG_RETURN(-1); + } + if (!gmtime_r(&sec_t, &gmdate)) { + DBUG_RETURN(-1); + } + int32 mrn_utc_diff_in_seconds = + ( + time->tm_mday > 25 && gmdate.tm_mday == 1 ? -1 : + time->tm_mday == 1 && gmdate.tm_mday > 25 ? 1 : + time->tm_mday - gmdate.tm_mday + ) * 24 * 60 * 60 + + (time->tm_hour - gmdate.tm_hour) * 60 * 60 + + (time->tm_min - gmdate.tm_min) * 60 + + (time->tm_sec - gmdate.tm_sec); + DBUG_PRINT("info", ("mroonga: time->tm_year=%d", time->tm_year)); + DBUG_PRINT("info", ("mroonga: time->tm_mon=%d", time->tm_mon)); + DBUG_PRINT("info", ("mroonga: time->tm_mday=%d", time->tm_mday)); + DBUG_PRINT("info", ("mroonga: time->tm_hour=%d", time->tm_hour)); + DBUG_PRINT("info", ("mroonga: time->tm_min=%d", time->tm_min)); + DBUG_PRINT("info", ("mroonga: time->tm_sec=%d", time->tm_sec)); + DBUG_PRINT("info", ("mroonga: mrn_utc_diff_in_seconds=%d", + mrn_utc_diff_in_seconds)); + if (mrn_utc_diff_in_seconds > 0) { + if (sec_t > std::numeric_limits::max() - mrn_utc_diff_in_seconds) { + DBUG_RETURN(-1); + } + } else { + if (sec_t < std::numeric_limits::min() - mrn_utc_diff_in_seconds) { + DBUG_RETURN(-1); + } + } + *truncated = false; + DBUG_RETURN(sec_t + mrn_utc_diff_in_seconds); + } + + long long int TimeConverter::tm_to_grn_time(struct tm *time, int usec, + bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + + long long int sec = tm_to_time_gm(time, truncated); + + DBUG_PRINT("info", ("mroonga: sec=%lld", sec)); + DBUG_PRINT("info", ("mroonga: usec=%d", usec)); + + long long int grn_time = *truncated ? 0 : GRN_TIME_PACK(sec, usec); + + DBUG_RETURN(grn_time); + } + + long long int TimeConverter::mysql_time_to_grn_time(MYSQL_TIME *mysql_time, + bool *truncated) { + MRN_DBUG_ENTER_METHOD(); + + int usec = mysql_time->second_part; + long long int grn_time = 0; + + *truncated = false; + switch (mysql_time->time_type) { + case MYSQL_TIMESTAMP_DATE: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATE")); + struct tm date; + memset(&date, 0, sizeof(struct tm)); + date.tm_year = mysql_time->year - TM_YEAR_BASE; + if (mysql_time->month > 0) { + date.tm_mon = mysql_time->month - 1; + } else { + date.tm_mon = 0; + *truncated = true; + } + if (mysql_time->day > 0) { + date.tm_mday = mysql_time->day; + } else { + date.tm_mday = 1; + *truncated = true; + } + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + bool tm_truncated = false; + grn_time = tm_to_grn_time(&date, usec, &tm_truncated); + if (tm_truncated) { + *truncated = true; + } + } + break; + case MYSQL_TIMESTAMP_DATETIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATETIME")); + struct tm datetime; + memset(&datetime, 0, sizeof(struct tm)); + datetime.tm_year = mysql_time->year - TM_YEAR_BASE; + if (mysql_time->month > 0) { + datetime.tm_mon = mysql_time->month - 1; + } else { + datetime.tm_mon = 0; + *truncated = true; + } + if (mysql_time->day > 0) { + datetime.tm_mday = mysql_time->day; + } else { + datetime.tm_mday = 1; + *truncated = true; + } + datetime.tm_hour = mysql_time->hour; + datetime.tm_min = mysql_time->minute; + datetime.tm_sec = mysql_time->second; + DBUG_PRINT("info", ("mroonga: tm_year=%d", datetime.tm_year)); + DBUG_PRINT("info", ("mroonga: tm_mon=%d", datetime.tm_mon)); + DBUG_PRINT("info", ("mroonga: tm_mday=%d", datetime.tm_mday)); + DBUG_PRINT("info", ("mroonga: tm_hour=%d", datetime.tm_hour)); + DBUG_PRINT("info", ("mroonga: tm_min=%d", datetime.tm_min)); + DBUG_PRINT("info", ("mroonga: tm_sec=%d", datetime.tm_sec)); + bool tm_truncated = false; + grn_time = tm_to_grn_time(&datetime, usec, &tm_truncated); + if (tm_truncated) { + *truncated = true; + } + } + break; + case MYSQL_TIMESTAMP_TIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_TIME")); + int sec = + mysql_time->hour * 60 * 60 + + mysql_time->minute * 60 + + mysql_time->second; + DBUG_PRINT("info", ("mroonga: sec=%d", sec)); + grn_time = GRN_TIME_PACK(sec, usec); + if (mysql_time->neg) { + grn_time = -grn_time; + } + } + break; + default: + DBUG_PRINT("info", ("mroonga: default")); + grn_time = 0; + break; + } + + DBUG_RETURN(grn_time); + } + + void TimeConverter::grn_time_to_mysql_time(long long int grn_time, + MYSQL_TIME *mysql_time) { + MRN_DBUG_ENTER_METHOD(); + long long int sec; + int usec; + GRN_TIME_UNPACK(grn_time, sec, usec); + DBUG_PRINT("info", ("mroonga: sec=%lld", sec)); + DBUG_PRINT("info", ("mroonga: usec=%d", usec)); + switch (mysql_time->time_type) { + case MYSQL_TIMESTAMP_DATE: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATE")); + struct tm date; + time_t sec_t = sec; + // TODO: Add error check + gmtime_r(&sec_t, &date); + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + mysql_time->year = date.tm_year + TM_YEAR_BASE; + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + mysql_time->month = date.tm_mon + 1; + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + mysql_time->day = date.tm_mday; + } + break; + case MYSQL_TIMESTAMP_DATETIME: + { + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_DATETIME")); + struct tm date; + time_t sec_t = sec; + // TODO: Add error check + gmtime_r(&sec_t, &date); + DBUG_PRINT("info", ("mroonga: tm_year=%d", date.tm_year)); + mysql_time->year = date.tm_year + TM_YEAR_BASE; + DBUG_PRINT("info", ("mroonga: tm_mon=%d", date.tm_mon)); + mysql_time->month = date.tm_mon + 1; + DBUG_PRINT("info", ("mroonga: tm_mday=%d", date.tm_mday)); + mysql_time->day = date.tm_mday; + DBUG_PRINT("info", ("mroonga: tm_hour=%d", date.tm_hour)); + mysql_time->hour = date.tm_hour; + DBUG_PRINT("info", ("mroonga: tm_min=%d", date.tm_min)); + mysql_time->minute = date.tm_min; + DBUG_PRINT("info", ("mroonga: tm_sec=%d", date.tm_sec)); + mysql_time->second = date.tm_sec; + mysql_time->second_part = usec; + } + break; + case MYSQL_TIMESTAMP_TIME: + DBUG_PRINT("info", ("mroonga: MYSQL_TIMESTAMP_TIME")); + if (sec < 0) { + mysql_time->neg = true; + sec = -sec; + } + mysql_time->hour = static_cast(sec / 60 / 60); + mysql_time->minute = sec / 60 % 60; + mysql_time->second = sec % 60; + mysql_time->second_part = usec; + break; + default: + DBUG_PRINT("info", ("mroonga: default")); + break; + } + DBUG_VOID_RETURN; + } +} diff --git a/storage/mroonga/lib/mrn_time_converter.hpp b/storage/mroonga/lib/mrn_time_converter.hpp new file mode 100644 index 00000000000..c5c69a0a8ad --- /dev/null +++ b/storage/mroonga/lib/mrn_time_converter.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_TIME_CONVERTER_HPP_ +#define MRN_TIME_CONVERTER_HPP_ + +#include +#include + +namespace mrn { + class TimeConverter { + public: + static const long long int TM_YEAR_BASE = 1900; + + TimeConverter(); + ~TimeConverter(); + + long long int mysql_time_to_grn_time(MYSQL_TIME *mysql_time, + bool *truncated); + + long long int tm_to_grn_time(struct tm *time, int usec, bool *truncated); + + void grn_time_to_mysql_time(long long int grn_time, MYSQL_TIME *mysql_time); + + private: + time_t tm_to_time_gm(struct tm *time, bool *truncated); + }; +} + +#endif /* MRN_TIME_CONVERTER_HPP_ */ diff --git a/storage/mroonga/lib/mrn_windows.hpp b/storage/mroonga/lib/mrn_windows.hpp new file mode 100644 index 00000000000..f6ae4490254 --- /dev/null +++ b/storage/mroonga/lib/mrn_windows.hpp @@ -0,0 +1,31 @@ +/* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2010-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_WINDOWS_HPP_ +#define MRN_WINDOWS_HPP_ + +#if defined(_WIN32) || defined(_WIN64) +# define MRN_API __declspec(dllexport) +#else +# define MRN_API +#endif + +#endif /* MRN_WINDOWS_HPP_ */ diff --git a/storage/mroonga/mrn_constants.hpp b/storage/mroonga/mrn_constants.hpp new file mode 100644 index 00000000000..494e08721bd --- /dev/null +++ b/storage/mroonga/mrn_constants.hpp @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2010 Tetsuro IKEDA + Copyright(C) 2011 Kentoku SHIBA + Copyright(C) 2011-2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_CONSTANTS_HPP_ +#define MRN_CONSTANTS_HPP_ + +#include + +#define MRN_BUFFER_SIZE 1024 +#define MRN_MAX_KEY_SIZE GRN_TABLE_MAX_KEY_SIZE +#if defined(MAX_PATH) +# define MRN_MAX_PATH_SIZE (MAX_PATH + 1) +#elif defined(PATH_MAX) +# define MRN_MAX_PATH_SIZE (PATH_MAX) +#elif defined(MAXPATHLEN) +# define MRN_MAX_PATH_SIZE (MAXPATHLEN) +#else +# define MRN_MAX_PATH_SIZE (256) +#endif +#define MRN_DB_FILE_SUFFIX ".mrn" +#define MRN_LOG_FILE_PATH "groonga.log" +#define MRN_COLUMN_NAME_ID "_id" +#define MRN_COLUMN_NAME_KEY "_key" +#define MRN_COLUMN_NAME_SCORE "_score" +#ifndef MRN_PARSER_DEFAULT +# define MRN_PARSER_DEFAULT "TokenBigram" +#endif + +#endif /* MRN_CONSTANTS_HPP_ */ diff --git a/storage/mroonga/mrn_err.h b/storage/mroonga/mrn_err.h new file mode 100644 index 00000000000..c2ca885407a --- /dev/null +++ b/storage/mroonga/mrn_err.h @@ -0,0 +1,32 @@ +/* Copyright(C) 2011 Kentoku SHIBA + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_ERR_H_ +#define MRN_ERR_H_ + +#define ER_MRN_INVALID_TABLE_PARAM_NUM 16501 +#define ER_MRN_INVALID_TABLE_PARAM_STR "The table parameter '%-.64s' is invalid" +#define ER_MRN_CHARSET_NOT_SUPPORT_NUM 16502 +#define ER_MRN_CHARSET_NOT_SUPPORT_STR "The character set '%s[%s]' is not supported by groonga" +#define ER_MRN_GEOMETRY_NOT_SUPPORT_NUM 16503 +#define ER_MRN_GEOMETRY_NOT_SUPPORT_STR "This geometry type is not supported. Groonga is supported point only" +#define ER_MRN_ERROR_FROM_GROONGA_NUM 16504 +#define ER_MRN_ERROR_FROM_GROONGA_STR "Error from Groonga [%s]" +#define ER_MRN_INVALID_NULL_VALUE_NUM 16505 +#define ER_MRN_INVALID_NULL_VALUE_STR "NULL value can't be used for %s" + +#endif /* MRN_ERR_H_ */ diff --git a/storage/mroonga/mrn_macro.hpp b/storage/mroonga/mrn_macro.hpp new file mode 100644 index 00000000000..b20fdb4c140 --- /dev/null +++ b/storage/mroonga/mrn_macro.hpp @@ -0,0 +1,30 @@ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_MACRO_HPP_ +#define MRN_MACRO_HPP_ + +#ifdef __cplusplus +# define MRN_BEGIN_DECLS extern "C" { +# define MRN_END_DECLS } +#else +# define MRN_BEGIN_DECLS +# define MRN_END_DECLS +#endif + +#endif /* MRN_MACRO_HPP_ */ diff --git a/storage/mroonga/mrn_mysql.h b/storage/mroonga/mrn_mysql.h new file mode 100644 index 00000000000..cf2a54621bb --- /dev/null +++ b/storage/mroonga/mrn_mysql.h @@ -0,0 +1,83 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_MYSQL_H_ +#define MRN_MYSQL_H_ + +#ifdef HAVE_CONFIG_H +# include +/* We need to undefine them because my_config.h defines them. :< */ +# undef VERSION +# undef PACKAGE +# undef PACKAGE_BUGREPORT +# undef PACKAGE_NAME +# undef PACKAGE_STRING +# undef PACKAGE_TARNAME +# undef PACKAGE_VERSION +#endif + +#include + +#ifdef FORCE_FAST_MUTEX_DISABLED +# ifdef MY_PTHREAD_FASTMUTEX +# undef MY_PTHREAD_FASTMUTEX +# endif +#endif + +#define MYSQL_SERVER 1 +#include + +#if MYSQL_VERSION_ID < 50500 +# include +# include +#else +# include +# include +# include +# include +#endif +#include + +#ifdef MARIADB_BASE_VERSION +# define MRN_MARIADB_P 1 +#endif + +#if MYSQL_VERSION_ID >= 50607 +# if !defined(MRN_MARIADB_P) +# define MRN_HAVE_SQL_OPTIMIZER_H +# endif +#endif + +#define MRN_MESSAGE_BUFFER_SIZE 1024 + +#define MRN_DBUG_ENTER_FUNCTION() DBUG_ENTER(__FUNCTION__) + +#if !defined(DBUG_OFF) && !defined(_lint) +# define MRN_DBUG_ENTER_METHOD() \ + char method_name[MRN_MESSAGE_BUFFER_SIZE]; \ + method_name[0] = '\0'; \ + strcat(method_name, MRN_CLASS_NAME); \ + strcat(method_name, "::"); \ + strcat(method_name, __FUNCTION__); \ + DBUG_ENTER(method_name) +#else +# define MRN_DBUG_ENTER_METHOD() MRN_DBUG_ENTER_FUNCTION() +#endif + +#endif /* MRN_MYSQL_H_ */ diff --git a/storage/mroonga/mrn_mysql_compat.h b/storage/mroonga/mrn_mysql_compat.h new file mode 100644 index 00000000000..7312dd70827 --- /dev/null +++ b/storage/mroonga/mrn_mysql_compat.h @@ -0,0 +1,143 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_MYSQL_COMPAT_H_ +#define MRN_MYSQL_COMPAT_H_ + +#include "mrn_mysql.h" + +#if MYSQL_VERSION_ID >= 50500 +# define my_free(PTR, FLAG) my_free(PTR) +#endif + +#if MYSQL_VERSION_ID < 50500 +# define mysql_mutex_lock(mutex) pthread_mutex_lock(mutex) +# define mysql_mutex_unlock(mutex) pthread_mutex_unlock(mutex) +#endif + +#if MYSQL_VERSION_ID >= 50604 +# define MRN_HAVE_MYSQL_TYPE_TIMESTAMP2 +# define MRN_HAVE_MYSQL_TYPE_DATETIME2 +# define MRN_HAVE_MYSQL_TYPE_TIME2 +#endif + +#if MYSQL_VERSION_ID < 50603 + typedef MYSQL_ERROR Sql_condition; +#endif + +#if defined(MRN_MARIADB_P) +# if MYSQL_VERSION_ID >= 50302 && MYSQL_VERSION_ID < 100000 + typedef COST_VECT Cost_estimate; +# endif +#endif + +#if MYSQL_VERSION_ID >= 50516 +# define MRN_PLUGIN_HAVE_FLAGS 1 +#endif + +// for MySQL < 5.5 +#ifndef MY_ALL_CHARSETS_SIZE +# define MY_ALL_CHARSETS_SIZE 256 +#endif + +#ifndef MRN_MARIADB_P + typedef char *range_id_t; +#endif + +#if MYSQL_VERSION_ID >= 50609 +# define MRN_KEY_HAS_USER_DEFINED_KEYPARTS +#endif + +#ifdef MRN_KEY_HAS_USER_DEFINED_KEYPARTS +# define KEY_N_KEY_PARTS(key) (key)->user_defined_key_parts +#else +# define KEY_N_KEY_PARTS(key) (key)->key_parts +#endif + +#if MYSQL_VERSION_ID < 100000 || !defined(MRN_MARIADB_P) +# define init_alloc_root(PTR, SZ1, SZ2, FLAG) init_alloc_root(PTR, SZ1, SZ2) +#endif + +#if MYSQL_VERSION_ID < 100002 || !defined(MRN_MARIADB_P) +# define GTS_TABLE 0 +#endif + +/* For MySQL 5.1. MySQL 5.1 doesn't have FN_LIBCHAR2. */ +#ifndef FN_LIBCHAR2 +# define FN_LIBCHAR2 FN_LIBCHAR +#endif + +#if MYSQL_VERSION_ID >= 50607 +# if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P) +# define MRN_GET_ERROR_MESSAGE thd_get_error_message(current_thd) +# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd_get_error_row(thd) +# else +# define MRN_GET_ERROR_MESSAGE current_thd->get_stmt_da()->message() +# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->get_stmt_da()->current_row_for_warning() +# endif +#else +# if MYSQL_VERSION_ID >= 50500 +# define MRN_GET_ERROR_MESSAGE current_thd->stmt_da->message() +# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->warning_info->current_row_for_warning() +# else +# define MRN_GET_ERROR_MESSAGE current_thd->main_da.message() +# define MRN_GET_CURRENT_ROW_FOR_WARNING(thd) thd->row_count +# endif +#endif + +#if MYSQL_VERSION_ID >= 50607 && !defined(MRN_MARIADB_P) +# define MRN_ITEM_HAVE_ITEM_NAME +#endif + +#if MYSQL_VERSION_ID >= 50500 && MYSQL_VERSION_ID < 50700 +# define MRN_HAVE_TABLE_DEF_CACHE +#endif + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100009 +# define MRN_HAVE_TDC_ACQUIRE_SHARE +#endif + +#if MYSQL_VERSION_ID >= 50613 +# define MRN_HAVE_ALTER_INFO +#endif + +#if MYSQL_VERSION_ID >= 50603 +# define MRN_HAVE_GET_TABLE_DEF_KEY +#endif + +#if defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 100004 +# define MRN_TABLE_SHARE_HAVE_LOCK_SHARE +#endif + +#if MYSQL_VERSION_ID >= 50404 +# define MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA +#endif + +#ifndef TIME_FUZZY_DATE +/* For MariaDB 10. */ +# ifdef TIME_FUZZY_DATES +# define TIME_FUZZY_DATE TIME_FUZZY_DATES +# endif +#endif + +#if MYSQL_VERSION_ID >= 100007 && defined(MRN_MARIADB_P) +# define MRN_USE_MYSQL_DATA_HOME +#endif + +#endif /* MRN_MYSQL_COMPAT_H_ */ diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp new file mode 100644 index 00000000000..fd406ac2dcf --- /dev/null +++ b/storage/mroonga/mrn_table.cpp @@ -0,0 +1,1147 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2014 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "mrn_mysql.h" + +#if MYSQL_VERSION_ID >= 50500 +# include +# include +#endif +#include "mrn_err.h" +#include "mrn_table.hpp" +#include "mrn_mysql_compat.h" +#include + +#if MYSQL_VERSION_ID >= 50603 && !defined(MRN_MARIADB_P) +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name), TRUE) +#else +# define MRN_HA_RESOLVE_BY_NAME(name) ha_resolve_by_name(NULL, (name)) +#endif + +#define LEX_STRING_IS_EMPTY(string) \ + ((string).length == 0 || !(string).str || (string).str[0] == '\0') + +#define MRN_DEFAULT_STR "DEFAULT" +#define MRN_DEFAULT_LEN (sizeof(MRN_DEFAULT_STR) - 1) +#define MRN_GROONGA_STR "GROONGA" +#define MRN_GROONGA_LEN (sizeof(MRN_GROONGA_STR) - 1) + +#ifdef MRN_HAVE_TABLE_DEF_CACHE +extern HASH *mrn_table_def_cache; +#endif + +#ifdef WIN32 +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE +extern PSI_mutex_key *mrn_table_share_lock_share; +# endif +# ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA +extern PSI_mutex_key *mrn_table_share_lock_ha_data; +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern HASH mrn_open_tables; +extern pthread_mutex_t mrn_open_tables_mutex; +extern HASH mrn_long_term_share; +extern pthread_mutex_t mrn_long_term_share_mutex; +extern char *mrn_default_parser; +extern char *mrn_default_wrapper_engine; +extern handlerton *mrn_hton_ptr; +extern HASH mrn_allocated_thds; +extern pthread_mutex_t mrn_allocated_thds_mutex; + +static char *mrn_get_string_between_quote(const char *ptr) +{ + const char *start_ptr, *end_ptr, *tmp_ptr, *esc_ptr; + bool find_flg = FALSE, esc_flg = FALSE; + MRN_DBUG_ENTER_FUNCTION(); + + start_ptr = strchr(ptr, '\''); + end_ptr = strchr(ptr, '"'); + if (start_ptr && (!end_ptr || start_ptr < end_ptr)) + { + tmp_ptr = ++start_ptr; + while (!find_flg) + { + if (!(end_ptr = strchr(tmp_ptr, '\''))) + DBUG_RETURN(NULL); + esc_ptr = tmp_ptr; + while (!find_flg) + { + esc_ptr = strchr(esc_ptr, '\\'); + if (!esc_ptr || esc_ptr > end_ptr) + find_flg = TRUE; + else if (esc_ptr == end_ptr - 1) + { + esc_flg = TRUE; + tmp_ptr = end_ptr + 1; + break; + } else { + esc_flg = TRUE; + esc_ptr += 2; + } + } + } + } else if (end_ptr) + { + start_ptr = end_ptr; + tmp_ptr = ++start_ptr; + while (!find_flg) + { + if (!(end_ptr = strchr(tmp_ptr, '"'))) + DBUG_RETURN(NULL); + esc_ptr = tmp_ptr; + while (!find_flg) + { + esc_ptr = strchr(esc_ptr, '\\'); + if (!esc_ptr || esc_ptr > end_ptr) + find_flg = TRUE; + else if (esc_ptr == end_ptr - 1) + { + esc_flg = TRUE; + tmp_ptr = end_ptr + 1; + break; + } else { + esc_flg = TRUE; + esc_ptr += 2; + } + } + } + } else + DBUG_RETURN(NULL); + + size_t length = end_ptr - start_ptr; + char *extracted_string = (char *)my_malloc(length + 1, MYF(MY_WME)); + if (esc_flg) { + size_t extracted_index = 0; + const char *current_ptr = start_ptr; + while (current_ptr < end_ptr) { + if (*current_ptr != '\\') { + extracted_string[extracted_index] = *current_ptr; + ++extracted_index; + current_ptr++; + continue; + } + + if (current_ptr + 1 == end_ptr) { + break; + } + + switch (*(current_ptr + 1)) + { + case 'b': + extracted_string[extracted_index] = '\b'; + break; + case 'n': + extracted_string[extracted_index] = '\n'; + break; + case 'r': + extracted_string[extracted_index] = '\r'; + break; + case 't': + extracted_string[extracted_index] = '\t'; + break; + default: + extracted_string[extracted_index] = *(current_ptr + 1); + break; + } + ++extracted_index; + } + } else { + memcpy(extracted_string, start_ptr, length); + extracted_string[length] = '\0'; + } + + DBUG_RETURN(extracted_string); +} + +#ifdef WITH_PARTITION_STORAGE_ENGINE +void mrn_get_partition_info(const char *table_name, uint table_name_length, + const TABLE *table, partition_element **part_elem, + partition_element **sub_elem) +{ + char tmp_name[FN_LEN]; + partition_info *part_info = table->part_info; + partition_element *tmp_part_elem = NULL, *tmp_sub_elem = NULL; + bool tmp_flg = FALSE, tmp_find_flg = FALSE; + MRN_DBUG_ENTER_FUNCTION(); + *part_elem = NULL; + *sub_elem = NULL; + if (!part_info) + DBUG_VOID_RETURN; + + if (table_name && !memcmp(table_name + table_name_length - 5, "#TMP#", 5)) + tmp_flg = TRUE; + + DBUG_PRINT("info", ("mroonga table_name=%s", table_name)); + List_iterator part_it(part_info->partitions); + while ((*part_elem = part_it++)) + { + if ((*part_elem)->subpartitions.elements) + { + List_iterator sub_it((*part_elem)->subpartitions); + while ((*sub_elem = sub_it++)) + { + create_subpartition_name(tmp_name, table->s->path.str, + (*part_elem)->partition_name, (*sub_elem)->partition_name, + NORMAL_PART_NAME); + DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); + if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) + DBUG_VOID_RETURN; + if ( + tmp_flg && + table_name && + *(tmp_name + table_name_length - 5) == '\0' && + !memcmp(table_name, tmp_name, table_name_length - 5) + ) { + tmp_part_elem = *part_elem; + tmp_sub_elem = *sub_elem; + tmp_flg = FALSE; + tmp_find_flg = TRUE; + } + } + } else { + create_partition_name(tmp_name, table->s->path.str, + (*part_elem)->partition_name, NORMAL_PART_NAME, TRUE); + DBUG_PRINT("info", ("mroonga tmp_name=%s", tmp_name)); + if (table_name && !memcmp(table_name, tmp_name, table_name_length + 1)) + DBUG_VOID_RETURN; + if ( + tmp_flg && + table_name && + *(tmp_name + table_name_length - 5) == '\0' && + !memcmp(table_name, tmp_name, table_name_length - 5) + ) { + tmp_part_elem = *part_elem; + tmp_flg = FALSE; + tmp_find_flg = TRUE; + } + } + } + if (tmp_find_flg) + { + *part_elem = tmp_part_elem; + *sub_elem = tmp_sub_elem; + DBUG_PRINT("info", ("mroonga tmp find")); + DBUG_VOID_RETURN; + } + *part_elem = NULL; + *sub_elem = NULL; + DBUG_PRINT("info", ("mroonga no hit")); + DBUG_VOID_RETURN; +} +#endif + +#define MRN_PARAM_STR_LEN(name) name ## _length +#define MRN_PARAM_STR(title_name, param_name) \ + if (!strncasecmp(tmp_ptr, title_name, title_length)) \ + { \ + DBUG_PRINT("info", ("mroonga "title_name" start")); \ + if (!share->param_name) \ + { \ + if ((share->param_name = mrn_get_string_between_quote( \ + start_ptr))) \ + share->MRN_PARAM_STR_LEN(param_name) = strlen(share->param_name); \ + else { \ + error = ER_MRN_INVALID_TABLE_PARAM_NUM; \ + my_printf_error(error, ER_MRN_INVALID_TABLE_PARAM_STR, \ + MYF(0), tmp_ptr); \ + goto error; \ + } \ + DBUG_PRINT("info", ("mroonga "title_name"=%s", share->param_name)); \ + } \ + break; \ + } + +#define MRN_PARAM_STR_LIST(title_name, param_name, param_pos) \ + if (!strncasecmp(tmp_ptr, title_name, title_length)) \ + { \ + DBUG_PRINT("info", ("mroonga "title_name" start")); \ + if (share->param_name && !share->param_name[param_pos]) \ + { \ + if ((share->param_name[param_pos] = mrn_get_string_between_quote( \ + start_ptr))) \ + share->MRN_PARAM_STR_LEN(param_name)[param_pos] = \ + strlen(share->param_name[param_pos]); \ + else { \ + error = ER_MRN_INVALID_TABLE_PARAM_NUM; \ + my_printf_error(error, ER_MRN_INVALID_TABLE_PARAM_STR, \ + MYF(0), tmp_ptr); \ + goto error; \ + } \ + DBUG_PRINT("info", ("mroonga "title_name"[%d]=%s", param_pos, \ + share->param_name[param_pos])); \ + } \ + break; \ + } + +int mrn_parse_table_param(MRN_SHARE *share, TABLE *table) +{ + int i, error = 0; + int title_length; + const char *sprit_ptr[2]; + const char *tmp_ptr, *start_ptr; + char *params_string = NULL; +#ifdef WITH_PARTITION_STORAGE_ENGINE + partition_element *part_elem; + partition_element *sub_elem; +#endif + MRN_DBUG_ENTER_FUNCTION(); +#ifdef WITH_PARTITION_STORAGE_ENGINE + mrn_get_partition_info(share->table_name, share->table_name_length, table, + &part_elem, &sub_elem); +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE + for (i = 4; i > 0; i--) +#else + for (i = 2; i > 0; i--) +#endif + { + const char *params_string_value; + uint params_string_length; + switch (i) + { +#ifdef WITH_PARTITION_STORAGE_ENGINE + case 4: + if (!sub_elem || !sub_elem->part_comment) + continue; + DBUG_PRINT("info", ("mroonga create sub comment string")); + params_string_value = sub_elem->part_comment; + params_string_length = strlen(params_string_value); + DBUG_PRINT("info", + ("mroonga sub comment string=%s", params_string_value)); + break; + case 3: + if (!part_elem || !part_elem->part_comment) + continue; + DBUG_PRINT("info", ("mroonga create part comment string")); + params_string_value = part_elem->part_comment; + params_string_length = strlen(params_string_value); + DBUG_PRINT("info", + ("mroonga part comment string=%s", params_string_value)); + break; +#endif + case 2: + if (LEX_STRING_IS_EMPTY(table->s->comment)) + continue; + DBUG_PRINT("info", ("mroonga create comment string")); + params_string_value = table->s->comment.str; + params_string_length = table->s->comment.length; + DBUG_PRINT("info", + ("mroonga comment string=%.*s", + params_string_length, params_string_value)); + break; + default: + if (LEX_STRING_IS_EMPTY(table->s->connect_string)) + continue; + DBUG_PRINT("info", ("mroonga create connect_string string")); + params_string_value = table->s->connect_string.str; + params_string_length = table->s->connect_string.length; + DBUG_PRINT("info", + ("mroonga connect_string=%.*s", + params_string_length, params_string_value)); + break; + } + + if (!params_string_value) { + continue; + } + + { + params_string = my_strndup(params_string_value, + params_string_length, + MYF(MY_WME)); + if (!params_string) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + + sprit_ptr[0] = params_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + DBUG_PRINT("info", ("mroonga title_str=%s", tmp_ptr)); + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t' && *start_ptr != ',') + { + title_length++; + start_ptr++; + } + DBUG_PRINT("info", ("mroonga title_length=%u", title_length)); + + switch (title_length) + { + case 6: + MRN_PARAM_STR("engine", engine); + break; + case 10: + MRN_PARAM_STR("normalizer", normalizer); + break; + case 13: + MRN_PARAM_STR("token_filters", token_filters); + break; + case 17: + MRN_PARAM_STR("default_tokenizer", default_tokenizer); + break; + default: + break; + } + } + + my_free(params_string, MYF(0)); + params_string = NULL; + } + } + + if (!share->engine && mrn_default_wrapper_engine) + { + share->engine_length = strlen(mrn_default_wrapper_engine); + if ( + !(share->engine = my_strndup(mrn_default_wrapper_engine, + share->engine_length, + MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + } + + if (share->engine) + { + LEX_STRING engine_name; + if ( + ( + share->engine_length == MRN_DEFAULT_LEN && + !strncasecmp(share->engine, MRN_DEFAULT_STR, MRN_DEFAULT_LEN) + ) || + ( + share->engine_length == MRN_GROONGA_LEN && + !strncasecmp(share->engine, MRN_GROONGA_STR, MRN_GROONGA_LEN) + ) + ) { + my_free(share->engine, MYF(0)); + share->engine = NULL; + share->engine_length = 0; + } else { + engine_name.str = share->engine; + engine_name.length = share->engine_length; + if (!(share->plugin = MRN_HA_RESOLVE_BY_NAME(&engine_name))) + { + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), share->engine); + error = ER_UNKNOWN_STORAGE_ENGINE; + goto error; + } + share->hton = plugin_data(share->plugin, handlerton *); + share->wrapper_mode = TRUE; + } + } + +error: + if (params_string) + my_free(params_string, MYF(0)); + DBUG_RETURN(error); +} + +bool mrn_is_geo_key(const KEY *key_info) +{ + return key_info->algorithm == HA_KEY_ALG_UNDEF && + KEY_N_KEY_PARTS(key_info) == 1 && + key_info->key_part[0].field->type() == MYSQL_TYPE_GEOMETRY; +} + +int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i) +{ + int error; + char *param_string = NULL; +#if MYSQL_VERSION_ID >= 50500 + int title_length; + char *sprit_ptr[2]; + char *tmp_ptr, *start_ptr; +#endif + MRN_DBUG_ENTER_FUNCTION(); + +#if MYSQL_VERSION_ID >= 50500 + if (key_info->comment.length == 0) + { + if (share->key_parser[i]) { + my_free(share->key_parser[i], MYF(0)); + } + if ( + !(share->key_parser[i] = my_strdup(mrn_default_parser, MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + share->key_parser_length[i] = strlen(share->key_parser[i]); + DBUG_RETURN(0); + } + DBUG_PRINT("info", ("mroonga create comment string")); + if ( + !(param_string = my_strndup(key_info->comment.str, + key_info->comment.length, + MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error_alloc_param_string; + } + DBUG_PRINT("info", ("mroonga comment string=%s", param_string)); + + sprit_ptr[0] = param_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + *sprit_ptr[1] = '\0'; + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t') + { + title_length++; + start_ptr++; + } + + switch (title_length) + { + case 5: + MRN_PARAM_STR_LIST("table", index_table, i); + break; + case 6: + MRN_PARAM_STR_LIST("parser", key_parser, i); + break; + default: + break; + } + } +#endif + if (!share->key_parser[i]) { + if ( + !(share->key_parser[i] = my_strdup(mrn_default_parser, MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error; + } + share->key_parser_length[i] = strlen(share->key_parser[i]); + } + + if (param_string) + my_free(param_string, MYF(0)); + DBUG_RETURN(0); + +error: + if (param_string) + my_free(param_string, MYF(0)); +#if MYSQL_VERSION_ID >= 50500 +error_alloc_param_string: +#endif + DBUG_RETURN(error); +} + +int mrn_parse_index_param(MRN_SHARE *share, TABLE *table) +{ + int error; + MRN_DBUG_ENTER_FUNCTION(); + for (uint i = 0; i < table->s->keys; i++) + { + KEY *key_info = &table->s->key_info[i]; + bool is_wrapper_mode = share->engine != NULL; + + if (is_wrapper_mode) { + if (!(key_info->flags & HA_FULLTEXT) && !mrn_is_geo_key(key_info)) { + continue; + } + } + + if ((error = mrn_add_index_param(share, key_info, i))) + goto error; + } + DBUG_RETURN(0); + +error: + DBUG_RETURN(error); +} + +int mrn_add_column_param(MRN_SHARE *share, Field *field, int i) +{ + int error; + char *param_string = NULL; + int title_length; + char *sprit_ptr[2]; + char *tmp_ptr, *start_ptr; + + MRN_DBUG_ENTER_FUNCTION(); + + if (share->wrapper_mode) { + DBUG_RETURN(0); + } + + DBUG_PRINT("info", ("mroonga create comment string")); + if ( + !(param_string = my_strndup(field->comment.str, + field->comment.length, + MYF(MY_WME))) + ) { + error = HA_ERR_OUT_OF_MEM; + goto error_alloc_param_string; + } + DBUG_PRINT("info", ("mroonga comment string=%s", param_string)); + + sprit_ptr[0] = param_string; + while (sprit_ptr[0]) + { + if ((sprit_ptr[1] = strchr(sprit_ptr[0], ','))) + { + *sprit_ptr[1] = '\0'; + sprit_ptr[1]++; + } + tmp_ptr = sprit_ptr[0]; + sprit_ptr[0] = sprit_ptr[1]; + while (*tmp_ptr == ' ' || *tmp_ptr == '\r' || + *tmp_ptr == '\n' || *tmp_ptr == '\t') + tmp_ptr++; + + if (*tmp_ptr == '\0') + continue; + + title_length = 0; + start_ptr = tmp_ptr; + while (*start_ptr != ' ' && *start_ptr != '\'' && + *start_ptr != '"' && *start_ptr != '\0' && + *start_ptr != '\r' && *start_ptr != '\n' && + *start_ptr != '\t') + { + title_length++; + start_ptr++; + } + + switch (title_length) + { + case 4: + MRN_PARAM_STR_LIST("type", col_type, i); + break; + case 5: + MRN_PARAM_STR_LIST("flags", col_flags, i); + break; + default: + break; + } + } + + if (param_string) + my_free(param_string, MYF(0)); + DBUG_RETURN(0); + +error: + if (param_string) + my_free(param_string, MYF(0)); +error_alloc_param_string: + DBUG_RETURN(error); +} + +int mrn_parse_column_param(MRN_SHARE *share, TABLE *table) +{ + int error; + MRN_DBUG_ENTER_FUNCTION(); + for (uint i = 0; i < table->s->fields; i++) + { + Field *field = table->s->field[i]; + + if (LEX_STRING_IS_EMPTY(field->comment)) { + continue; + } + + if ((error = mrn_add_column_param(share, field, i))) + goto error; + } + DBUG_RETURN(0); + +error: + DBUG_RETURN(error); +} + +int mrn_free_share_alloc( + MRN_SHARE *share +) { + uint i; + MRN_DBUG_ENTER_FUNCTION(); + if (share->engine) + my_free(share->engine, MYF(0)); + if (share->default_tokenizer) + my_free(share->default_tokenizer, MYF(0)); + if (share->normalizer) + my_free(share->normalizer, MYF(0)); + if (share->token_filters) + my_free(share->token_filters, MYF(0)); + for (i = 0; i < share->table_share->keys; i++) + { + if (share->index_table && share->index_table[i]) + my_free(share->index_table[i], MYF(0)); + if (share->key_parser[i]) + my_free(share->key_parser[i], MYF(0)); + } + for (i = 0; i < share->table_share->fields; i++) + { + if (share->col_flags && share->col_flags[i]) + my_free(share->col_flags[i], MYF(0)); + if (share->col_type && share->col_type[i]) + my_free(share->col_type[i], MYF(0)); + } + DBUG_RETURN(0); +} + +void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share) +{ + MRN_DBUG_ENTER_FUNCTION(); + { + mrn::Lock lock(&mrn_long_term_share_mutex); + my_hash_delete(&mrn_long_term_share, (uchar*) long_term_share); + } + pthread_mutex_destroy(&long_term_share->auto_inc_mutex); + my_free(long_term_share, MYF(0)); + DBUG_VOID_RETURN; +} + +MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name, + uint table_name_length, + int *error) +{ + MRN_LONG_TERM_SHARE *long_term_share; + char *tmp_name; + MRN_DBUG_ENTER_FUNCTION(); + DBUG_PRINT("info", ("mroonga: table_name=%s", table_name)); + mrn::Lock lock(&mrn_long_term_share_mutex); + if (!(long_term_share = (MRN_LONG_TERM_SHARE*) + my_hash_search(&mrn_long_term_share, (uchar*) table_name, + table_name_length))) + { + if (!(long_term_share = (MRN_LONG_TERM_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &long_term_share, sizeof(*long_term_share), + &tmp_name, table_name_length + 1, + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + goto error_alloc_long_term_share; + } + long_term_share->table_name = tmp_name; + long_term_share->table_name_length = table_name_length; + memcpy(long_term_share->table_name, table_name, table_name_length); + if (pthread_mutex_init(&long_term_share->auto_inc_mutex, + MY_MUTEX_INIT_FAST)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_init_auto_inc_mutex; + } + if (my_hash_insert(&mrn_long_term_share, (uchar*) long_term_share)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_hash_insert; + } + } + DBUG_RETURN(long_term_share); + +error_hash_insert: + pthread_mutex_destroy(&long_term_share->auto_inc_mutex); +error_init_auto_inc_mutex: + my_free(long_term_share, MYF(0)); +error_alloc_long_term_share: + DBUG_RETURN(NULL); +} + +MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error) +{ + MRN_SHARE *share; + char *tmp_name, **index_table, **key_parser, **col_flags, **col_type; + uint length, *wrap_key_nr, *index_table_length; + uint *key_parser_length, *col_flags_length, *col_type_length, i, j; + KEY *wrap_key_info; + TABLE_SHARE *wrap_table_share; + MRN_DBUG_ENTER_FUNCTION(); + length = (uint) strlen(table_name); + mrn::Lock lock(&mrn_open_tables_mutex); + if (!(share = (MRN_SHARE*) my_hash_search(&mrn_open_tables, + (uchar*) table_name, length))) + { + if (!(share = (MRN_SHARE *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &share, sizeof(*share), + &tmp_name, length + 1, + &index_table, sizeof(char *) * table->s->keys, + &index_table_length, sizeof(uint) * table->s->keys, + &key_parser, sizeof(char *) * table->s->keys, + &key_parser_length, sizeof(uint) * table->s->keys, + &col_flags, sizeof(char *) * table->s->fields, + &col_flags_length, sizeof(uint) * table->s->fields, + &col_type, sizeof(char *) * table->s->fields, + &col_type_length, sizeof(uint) * table->s->fields, + &wrap_key_nr, sizeof(*wrap_key_nr) * table->s->keys, + &wrap_key_info, sizeof(*wrap_key_info) * table->s->keys, + &wrap_table_share, sizeof(*wrap_table_share), + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + goto error_alloc_share; + } + share->use_count = 0; + share->table_name_length = length; + share->table_name = tmp_name; + share->index_table = index_table; + share->index_table_length = index_table_length; + share->key_parser = key_parser; + share->key_parser_length = key_parser_length; + share->col_flags = col_flags; + share->col_flags_length = col_flags_length; + share->col_type = col_type; + share->col_type_length = col_type_length; + strmov(share->table_name, table_name); + share->table_share = table->s; + + if ( + (*error = mrn_parse_table_param(share, table)) || + (*error = mrn_parse_column_param(share, table)) || + (*error = mrn_parse_index_param(share, table)) + ) + goto error_parse_table_param; + + if (share->wrapper_mode) + { + j = 0; + for (i = 0; i < table->s->keys; i++) + { + if (table->s->key_info[i].algorithm != HA_KEY_ALG_FULLTEXT && + !mrn_is_geo_key(&table->s->key_info[i])) + { + wrap_key_nr[i] = j; + memcpy(&wrap_key_info[j], &table->s->key_info[i], + sizeof(*wrap_key_info)); + j++; + } else { + wrap_key_nr[i] = MAX_KEY; + } + } + share->wrap_keys = j; + share->base_keys = table->s->keys; + share->base_key_info = table->s->key_info; + share->base_primary_key = table->s->primary_key; + if (i) + { + share->wrap_key_nr = wrap_key_nr; + share->wrap_key_info = wrap_key_info; + if (table->s->primary_key == MAX_KEY) + share->wrap_primary_key = MAX_KEY; + else + share->wrap_primary_key = wrap_key_nr[table->s->primary_key]; + } else { + share->wrap_key_nr = NULL; + share->wrap_key_info = NULL; + share->wrap_primary_key = MAX_KEY; + } + memcpy(wrap_table_share, table->s, sizeof(*wrap_table_share)); + wrap_table_share->keys = share->wrap_keys; + wrap_table_share->key_info = share->wrap_key_info; + wrap_table_share->primary_key = share->wrap_primary_key; + wrap_table_share->keys_in_use.init(share->wrap_keys); + wrap_table_share->keys_for_keyread.init(share->wrap_keys); +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE +# ifdef WIN32 + mysql_mutex_init(*mrn_table_share_lock_share, + &(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW); +# else + mysql_mutex_init(key_TABLE_SHARE_LOCK_share, + &(wrap_table_share->LOCK_share), MY_MUTEX_INIT_SLOW); +# endif +#endif +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA +# ifdef WIN32 + mysql_mutex_init(*mrn_table_share_lock_ha_data, + &(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST); +# else + mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data, + &(wrap_table_share->LOCK_ha_data), MY_MUTEX_INIT_FAST); +# endif +#endif + share->wrap_table_share = wrap_table_share; + } + + if (pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_init_mutex; + } + thr_lock_init(&share->lock); + if (!(share->long_term_share = mrn_get_long_term_share(table_name, length, + error))) + { + goto error_get_long_term_share; + } + if (my_hash_insert(&mrn_open_tables, (uchar*) share)) + { + *error = HA_ERR_OUT_OF_MEM; + goto error_hash_insert; + } + } + share->use_count++; + DBUG_RETURN(share); + +error_hash_insert: +error_get_long_term_share: + pthread_mutex_destroy(&share->mutex); +error_init_mutex: +error_parse_table_param: + mrn_free_share_alloc(share); + my_free(share, MYF(0)); +error_alloc_share: + DBUG_RETURN(NULL); +} + +int mrn_free_share(MRN_SHARE *share) +{ + MRN_DBUG_ENTER_FUNCTION(); + mrn::Lock lock(&mrn_open_tables_mutex); + if (!--share->use_count) + { + my_hash_delete(&mrn_open_tables, (uchar*) share); + if (share->wrapper_mode) + plugin_unlock(NULL, share->plugin); + mrn_free_share_alloc(share); + thr_lock_delete(&share->lock); + pthread_mutex_destroy(&share->mutex); + if (share->wrapper_mode) { +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_SHARE + mysql_mutex_destroy(&(share->wrap_table_share->LOCK_share)); +#endif +#ifdef MRN_TABLE_SHARE_HAVE_LOCK_HA_DATA + mysql_mutex_destroy(&(share->wrap_table_share->LOCK_ha_data)); +#endif + } + my_free(share, MYF(0)); + } + DBUG_RETURN(0); +} + +TABLE_SHARE *mrn_get_table_share(TABLE_LIST *table_list, int *error) +{ + uint key_length; + TABLE_SHARE *share; + THD *thd = current_thd; + MRN_DBUG_ENTER_FUNCTION(); +#ifdef MRN_HAVE_GET_TABLE_DEF_KEY + const char *key; + key_length = get_table_def_key(table_list, &key); +#else + char key[MAX_DBKEY_LENGTH]; + key_length = create_table_def_key(thd, key, table_list, FALSE); +#endif +#ifdef MRN_HAVE_TABLE_DEF_CACHE + my_hash_value_type hash_value; + hash_value = my_calc_hash(mrn_table_def_cache, (uchar*) key, key_length); + share = get_table_share(thd, table_list, key, key_length, 0, error, + hash_value); +#elif defined(MRN_HAVE_TDC_ACQUIRE_SHARE) + share = tdc_acquire_share(thd, table_list->db, table_list->table_name, key, + key_length, + table_list->mdl_request.key.tc_hash_value(), + GTS_TABLE, NULL); +#else + share = get_table_share(thd, table_list, key, key_length, 0, error); +#endif + DBUG_RETURN(share); +} + +TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path, + int *error) +{ + uint key_length; + TABLE_SHARE *share; + THD *thd = current_thd; + + MRN_DBUG_ENTER_FUNCTION(); +#ifdef MRN_HAVE_GET_TABLE_DEF_KEY + const char *key; + key_length = get_table_def_key(table_list, &key); +#else + char key[MAX_DBKEY_LENGTH]; + key_length = create_table_def_key(thd, key, table_list, FALSE); +#endif +#if MYSQL_VERSION_ID >= 100002 && defined(MRN_MARIADB_P) + share = alloc_table_share(table_list->db, table_list->table_name, key, + key_length); +#else + share = alloc_table_share(table_list, key, key_length); +#endif + if (!share) + { + *error = ER_CANT_OPEN_FILE; + DBUG_RETURN(NULL); + } + share->tmp_table = INTERNAL_TMP_TABLE; // TODO: is this right? + share->path.str = (char *) path; + share->path.length = strlen(path); + share->normalized_path.str = share->path.str; + share->normalized_path.length = share->path.length; + if (open_table_def(thd, share, GTS_TABLE)) + { + *error = ER_CANT_OPEN_FILE; + DBUG_RETURN(NULL); + } + DBUG_RETURN(share); +} + +void mrn_free_tmp_table_share(TABLE_SHARE *tmp_table_share) +{ + MRN_DBUG_ENTER_FUNCTION(); + free_table_share(tmp_table_share); + DBUG_VOID_RETURN; +} + +KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error) +{ + uint *wrap_key_nr = share->wrap_key_nr, i, j; + KEY *wrap_key_info; + MRN_DBUG_ENTER_FUNCTION(); + if (share->wrap_keys) + { + if (!(wrap_key_info = (KEY *) + my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &wrap_key_info, sizeof(*wrap_key_info) * share->wrap_keys, + NullS)) + ) { + *error = HA_ERR_OUT_OF_MEM; + DBUG_RETURN(NULL); + } + for (i = 0; i < table->s->keys; i++) + { + j = wrap_key_nr[i]; + if (j < MAX_KEY) + { + memcpy(&wrap_key_info[j], &table->key_info[i], + sizeof(*wrap_key_info)); + } + } + } else + wrap_key_info = NULL; + *error = 0; + DBUG_RETURN(wrap_key_info); +} + +void mrn_set_bitmap_by_key(MY_BITMAP *map, KEY *key_info) +{ + uint i; + MRN_DBUG_ENTER_FUNCTION(); + for (i = 0; i < KEY_N_KEY_PARTS(key_info); i++) + { + Field *field = key_info->key_part[i].field; + bitmap_set_bit(map, field->field_index); + } + DBUG_VOID_RETURN; +} + +st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_slot_data *slot_data = + (st_mrn_slot_data*) *thd_ha_data(thd, mrn_hton_ptr); + if (slot_data == NULL) { + slot_data = (st_mrn_slot_data*) malloc(sizeof(st_mrn_slot_data)); + slot_data->last_insert_record_id = GRN_ID_NIL; + slot_data->first_alter_share = NULL; + slot_data->alter_create_info = NULL; + slot_data->disable_keys_create_info = NULL; + slot_data->alter_connect_string = NULL; + slot_data->alter_comment = NULL; + *thd_ha_data(thd, mrn_hton_ptr) = (void *) slot_data; + { + mrn::Lock lock(&mrn_allocated_thds_mutex); + if (my_hash_insert(&mrn_allocated_thds, (uchar*) thd)) + { + free(slot_data); + DBUG_RETURN(NULL); + } + } + } + DBUG_RETURN(slot_data); +} + +void mrn_clear_alter_share(THD *thd) +{ + MRN_DBUG_ENTER_FUNCTION(); + st_mrn_slot_data *slot_data = mrn_get_slot_data(thd, FALSE); + if (slot_data) { + if (slot_data->first_alter_share) { + st_mrn_alter_share *tmp_alter_share; + st_mrn_alter_share *alter_share = slot_data->first_alter_share; + while (alter_share) + { + tmp_alter_share = alter_share->next; + mrn_free_tmp_table_share(alter_share->alter_share); + free(alter_share); + alter_share = tmp_alter_share; + } + slot_data->first_alter_share = NULL; + } + slot_data->alter_create_info = NULL; + slot_data->disable_keys_create_info = NULL; + if (slot_data->alter_connect_string) { + my_free(slot_data->alter_connect_string, MYF(0)); + slot_data->alter_connect_string = NULL; + } + if (slot_data->alter_comment) { + my_free(slot_data->alter_comment, MYF(0)); + slot_data->alter_comment = NULL; + } + } + DBUG_VOID_RETURN; +} + +#ifdef __cplusplus +} +#endif diff --git a/storage/mroonga/mrn_table.hpp b/storage/mroonga/mrn_table.hpp new file mode 100644 index 00000000000..813e69e1023 --- /dev/null +++ b/storage/mroonga/mrn_table.hpp @@ -0,0 +1,176 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2011-2013 Kentoku SHIBA + Copyright(C) 2011-2013 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_TABLE_HPP_ +#define MRN_TABLE_HPP_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct st_mroonga_long_term_share +{ + char *table_name; + uint table_name_length; + + // for auto_increment (storage mode only) + pthread_mutex_t auto_inc_mutex; + bool auto_inc_inited; + ulonglong auto_inc_value; +} MRN_LONG_TERM_SHARE; + +typedef struct st_mroonga_share +{ + char *table_name; + uint table_name_length; + uint use_count; + pthread_mutex_t mutex; + THR_LOCK lock; + TABLE_SHARE *table_share; + TABLE_SHARE *wrap_table_share; + MRN_LONG_TERM_SHARE *long_term_share; + + char *engine; + int engine_length; + char *default_tokenizer; + int default_tokenizer_length; + char *normalizer; + int normalizer_length; + char *token_filters; + int token_filters_length; + plugin_ref plugin; + handlerton *hton; + char **index_table; + char **key_parser; + char **col_flags; + char **col_type; + uint *index_table_length; + uint *key_parser_length; + uint *col_flags_length; + uint *col_type_length; + uint *wrap_key_nr; + uint wrap_keys; + uint base_keys; + KEY *wrap_key_info; + KEY *base_key_info; + uint wrap_primary_key; + uint base_primary_key; + bool wrapper_mode; + bool disable_keys; +} MRN_SHARE; + +struct st_mrn_alter_share +{ + char path[FN_REFLEN + 1]; + TABLE_SHARE *alter_share; + st_mrn_alter_share *next; +}; + +struct st_mrn_slot_data +{ + grn_id last_insert_record_id; + st_mrn_alter_share *first_alter_share; + HA_CREATE_INFO *alter_create_info; + HA_CREATE_INFO *disable_keys_create_info; + char *alter_connect_string; + char *alter_comment; +}; + +#define MRN_SET_WRAP_ALTER_KEY(file, ha_alter_info) \ + Alter_inplace_info::HA_ALTER_FLAGS base_handler_flags = ha_alter_info->handler_flags; \ + KEY *base_key_info_buffer = ha_alter_info->key_info_buffer; \ + uint base_key_count = ha_alter_info->key_count; \ + uint base_index_drop_count = ha_alter_info->index_drop_count; \ + KEY **base_index_drop_buffer = ha_alter_info->index_drop_buffer; \ + uint base_index_add_count = ha_alter_info->index_add_count; \ + uint *base_index_add_buffer = ha_alter_info->index_add_buffer; \ + ha_alter_info->handler_flags = file->alter_handler_flags; \ + ha_alter_info->key_info_buffer = file->alter_key_info_buffer; \ + ha_alter_info->key_count = file->alter_key_count; \ + ha_alter_info->index_drop_count = file->alter_index_drop_count; \ + ha_alter_info->index_drop_buffer = &file->alter_index_drop_buffer; \ + ha_alter_info->index_add_count = file->alter_index_add_count; \ + ha_alter_info->index_add_buffer = file->alter_index_add_buffer; + +#define MRN_SET_BASE_ALTER_KEY(share, table_share) \ + ha_alter_info->handler_flags = base_handler_flags; \ + ha_alter_info->key_info_buffer = base_key_info_buffer; \ + ha_alter_info->key_count = base_key_count; \ + ha_alter_info->index_drop_count = base_index_drop_count; \ + ha_alter_info->index_drop_buffer = base_index_drop_buffer; \ + ha_alter_info->index_add_count = base_index_add_count; \ + ha_alter_info->index_add_buffer = base_index_add_buffer; + +#define MRN_SET_WRAP_SHARE_KEY(share, table_share) +/* + table_share->keys = share->wrap_keys; \ + table_share->key_info = share->wrap_key_info; \ + table_share->primary_key = share->wrap_primary_key; +*/ + +#define MRN_SET_BASE_SHARE_KEY(share, table_share) +/* + table_share->keys = share->base_keys; \ + table_share->key_info = share->base_key_info; \ + table_share->primary_key = share->base_primary_key; +*/ + +#define MRN_SET_WRAP_TABLE_KEY(file, table) \ + table->key_info = file->wrap_key_info; \ + table->s = share->wrap_table_share; + +#define MRN_SET_BASE_TABLE_KEY(file, table) \ + table->key_info = file->base_key_info; \ + table->s = share->table_share; + +#ifdef WITH_PARTITION_STORAGE_ENGINE +void mrn_get_partition_info(const char *table_name, uint table_name_length, + const TABLE *table, partition_element **part_elem, + partition_element **sub_elem); +#endif +int mrn_parse_table_param(MRN_SHARE *share, TABLE *table); +bool mrn_is_geo_key(const KEY *key_info); +int mrn_add_index_param(MRN_SHARE *share, KEY *key_info, int i); +int mrn_parse_index_param(MRN_SHARE *share, TABLE *table); +int mrn_add_column_param(MRN_SHARE *share, Field *field, int i); +int mrn_parse_column_param(MRN_SHARE *share, TABLE *table); +MRN_SHARE *mrn_get_share(const char *table_name, TABLE *table, int *error); +int mrn_free_share_alloc(MRN_SHARE *share); +int mrn_free_share(MRN_SHARE *share); +MRN_LONG_TERM_SHARE *mrn_get_long_term_share(const char *table_name, + uint table_name_length, + int *error); +void mrn_free_long_term_share(MRN_LONG_TERM_SHARE *long_term_share); +TABLE_SHARE *mrn_get_table_share(TABLE_LIST *table_list, int *error); +TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path, + int *error); +void mrn_free_tmp_table_share(TABLE_SHARE *table_share); +KEY *mrn_create_key_info_for_table(MRN_SHARE *share, TABLE *table, int *error); +void mrn_set_bitmap_by_key(MY_BITMAP *map, KEY *key_info); +st_mrn_slot_data *mrn_get_slot_data(THD *thd, bool can_create); +void mrn_clear_alter_share(THD *thd); + +#ifdef __cplusplus +} +#endif + +#endif /* MRN_TABLE_HPP_ */ diff --git a/storage/mroonga/mrn_version.h.in b/storage/mroonga/mrn_version.h.in new file mode 100644 index 00000000000..dfa0e2dffd5 --- /dev/null +++ b/storage/mroonga/mrn_version.h.in @@ -0,0 +1,40 @@ +/* + Copyright(C) 2011 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef MRN_VERSION_H_ +#define MRN_VERSION_H_ + +/* Define mroonga version in string */ +#define MRN_VERSION "@MRN_VERSION@" + +/* Define mroonga version in hex */ +#define MRN_VERSION_IN_HEX @MRN_VERSION_IN_HEX@ + +/* Define mroonga major version */ +#define MRN_VERSION_MAJOR @MRN_VERSION_MAJOR@ + +/* Define mroonga minor version */ +#define MRN_VERSION_MINOR @MRN_VERSION_MINOR@ + +/* Define mroonga micro version */ +#define MRN_VERSION_MICRO @MRN_VERSION_MICRO@ + +/* Define to the full name and version of this package. */ +#define MRN_PACKAGE_STRING "@MRN_PACKAGE_STRING@" + +#endif /* MRN_VERSION_H_ */ diff --git a/storage/mroonga/mysql-test/Makefile.am b/storage/mroonga/mysql-test/Makefile.am new file mode 100644 index 00000000000..9ea677b579a --- /dev/null +++ b/storage/mroonga/mysql-test/Makefile.am @@ -0,0 +1,8 @@ +dist-hook: + if [ -n "`find mroonga -name '*.reject'`" ]; then \ + echo "reject files exist"; \ + exit 1; \ + fi + +EXTRA_DIST = \ + mroonga diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc new file mode 100644 index 00000000000..89700a87cff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_freebsd.inc @@ -0,0 +1,19 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +let $VERSION_COMPILE_OS_FREEBSD=`SELECT IF(@@version_compile_os like 'FREEBSD%', 1, 0);`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc new file mode 100644 index 00000000000..94cf42dd5ab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_ha_mroonga_so.inc @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_windows.inc + +--disable_query_log +if ($VERSION_COMPILE_OS_WIN) { + let ha_mroonga_so='ha_mroonga.dll'; +} +if (!$VERSION_COMPILE_OS_WIN) { + let ha_mroonga_so='ha_mroonga.so'; +} +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc new file mode 100644 index 00000000000..13b2f3439e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_mariadb.inc @@ -0,0 +1,19 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +let $mariadb = `SELECT LOCATE('MariaDB', @@global.version) > 0`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc new file mode 100644 index 00000000000..8b8387a74fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_osx.inc @@ -0,0 +1,19 @@ +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +let $VERSION_COMPILE_OS_OSX=`SELECT IF(@@version_compile_os like 'osx%', 1, 0);`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc new file mode 100644 index 00000000000..b59a981d822 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_version.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2012-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +let $version_major_minor = + `SELECT CAST(SUBSTRING_INDEX(@@global.version, '.', 2) AS DECIMAL(4, 2))`; + +let $version_55 = `SELECT $version_major_minor = 5.5`; +let $version_56 = `SELECT $version_major_minor = 5.6`; +let $version_100 = `SELECT $version_major_minor = 10.0`; + +let $version_55_or_later = `SELECT $version_major_minor >= 5.5`; +let $version_56_or_later = `SELECT $version_major_minor >= 5.6`; +let $version_100_or_later = `SELECT $version_major_minor >= 10.0`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc new file mode 100644 index 00000000000..21e61000a06 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/check_windows.inc @@ -0,0 +1,20 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +let $VERSION_COMPILE_OS_WIN=`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc new file mode 100644 index 00000000000..41ab6bf4899 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_32bit.inc @@ -0,0 +1,28 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_osx.inc + +disable_query_log; +disable_warnings; +let $VERSION_COMPILE_64BIT= + `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; +enable_warnings; +enable_query_log; +if ($VERSION_COMPILE_64BIT) { + skip Need a 32 bit machine/binary; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc new file mode 100644 index 00000000000..3774de2f479 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_64bit.inc @@ -0,0 +1,25 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +disable_query_log; +disable_warnings; +let $VERSION_COMPILE_64BIT= + `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; +enable_warnings; +enable_query_log; +if (!$VERSION_COMPILE_64BIT) { + skip Need a 64 binary; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc new file mode 100644 index 00000000000..c4764b83c8a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fractional_seconds.inc @@ -0,0 +1,32 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_mariadb.inc +--source ../../include/mroonga/check_version.inc + +if ($mariadb) { + let $fractional_seconds = 1; +} + +if (!$mariadb) { + if ($version_56) { + let $fractional_seconds = `SELECT @@global.version >= '5.6'`; + } +} + +if (!$fractional_seconds) { + skip fractional seconds in time values are available in MySQL version 5.6 or later or MariaDB; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc new file mode 100644 index 00000000000..dfe198ca9ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_freebsd.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_freebsd.inc + +if (!$VERSION_COMPILE_OS_FREEBSD) { + skip Need OS FreeBSD; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc new file mode 100644 index 00000000000..e8c79936cc6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_fulltext_index_comment.inc @@ -0,0 +1,25 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if ($version_55_or_later) { + let $fulltext_index_comment = 1; +} + +if (!$fulltext_index_comment) { + skip Fulltext index comment is available in version 5.5 or later; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc new file mode 100644 index 00000000000..2ebec2df8c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga.inc @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013-2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_ha_mroonga_so.inc + +disable_query_log; + +let have_mroonga_storage_engine=`SELECT 1 FROM information_schema.plugins WHERE plugin_name = "mroonga"`; +if (!$have_mroonga_storage_engine) { + eval INSTALL PLUGIN mroonga SONAME $ha_mroonga_so; + eval INSTALL PLUGIN mroonga_stats SONAME $ha_mroonga_so; +} + +let have_default_storage_engine_variable=`SELECT 1 FROM information_schema.global_variables WHERE variable_name = "default_storage_engine"`; +if ($have_default_storage_engine_variable) { + let original_default_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "default_storage_engine"`; + set default_storage_engine=Mroonga; +} +if (!$have_default_storage_engine_variable) { + let original_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "storage_engine"`; + set storage_engine=Mroonga; +} + +let have_default_tmp_storage_engine_variable=`SELECT 1 FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`; +if ($have_default_tmp_storage_engine_variable) { + let original_default_tmp_storage_engine=`SELECT variable_value FROM information_schema.global_variables WHERE variable_name = "default_tmp_storage_engine"`; + set default_tmp_storage_engine=Mroonga; +} + +enable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc new file mode 100644 index 00000000000..0b6b7081d00 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_deinit.inc @@ -0,0 +1,36 @@ +# Copyright(C) 2010-2014 Kentoku SHIBA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +disable_query_log; + +if ($have_default_storage_engine_variable) { + eval set default_storage_engine=$original_default_storage_engine; +} +if (!$have_default_storage_engine_variable) { + eval set storage_engine=$original_storage_engine; +} + +if ($have_default_tmp_storage_engine_variable) { + eval set default_tmp_storage_engine=$original_default_tmp_storage_engine; +} + +if (!$have_mroonga_storage_engine) { + UNINSTALL PLUGIN mroonga_stats; + UNINSTALL PLUGIN mroonga; +} + +enable_query_log; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc new file mode 100644 index 00000000000..1a7ec750288 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mroonga_helper.inc @@ -0,0 +1,17 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +let $MYSQLD_DATADIR= `select @@datadir`; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc new file mode 100644 index 00000000000..d054f0a9afd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_mysql.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_mariadb.inc + +if ($mariadb) { + skip This test is for MySQL; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc new file mode 100644 index 00000000000..5643d8c8c2d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_100) { + skip This test is for MariaDB version 10.0.x; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc new file mode 100644 index 00000000000..9c9faa00ea2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_100_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_100_or_later) { + skip This test is for MariaDB version 10.0.x or later; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc new file mode 100644 index 00000000000..b34f7876ed8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_55.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_55) { + skip This test is for MySQL version 5.5.x; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc new file mode 100644 index 00000000000..4ecff3e4466 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_56) { + skip This test is for MySQL version 5.6.x; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc new file mode 100644 index 00000000000..ef166fcf590 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/have_version_56_or_later.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc + +if (!$version_56_or_later) { + skip This test is for MySQL version 5.6.x or later; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc new file mode 100644 index 00000000000..6df4e88ffc8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/load_mroonga_functions.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_ha_mroonga_so.inc + +--disable_query_log +eval CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_command RETURNS STRING SONAME $ha_mroonga_so; +eval CREATE FUNCTION mroonga_escape RETURNS STRING SONAME $ha_mroonga_so; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc new file mode 100644 index 00000000000..0c48adfee92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_freebsd.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_freebsd.inc + +if ($VERSION_COMPILE_OS_FREEBSD) { + skip This test is not for FreeBSD; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc new file mode 100644 index 00000000000..8b46d606eec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mariadb_55.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2012-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_55) { + if ($mariadb) { + skip This test is not for MariaDB 5.5.x; + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc new file mode 100644 index 00000000000..86bb34ff86d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_mysql_55.inc @@ -0,0 +1,24 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_version.inc +--source ../../include/mroonga/check_mariadb.inc + +if ($version_55) { + if (!$mariadb) { + skip This test is not for MySQL 5.5.x; + } +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc new file mode 100644 index 00000000000..a8f4409f7e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_osx.inc @@ -0,0 +1,21 @@ +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/check_osx.inc + +if ($VERSION_COMPILE_OS_OSX) { + skip This test is not for OSX; +} diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc new file mode 100644 index 00000000000..881aa47c629 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/unload_mroonga_functions.inc @@ -0,0 +1,22 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--disable_query_log +DROP FUNCTION last_insert_grn_id; +DROP FUNCTION mroonga_snippet; +DROP FUNCTION mroonga_command; +DROP FUNCTION mroonga_escape; +--enable_query_log diff --git a/storage/mroonga/mysql-test/mroonga/storage/disabled.def b/storage/mroonga/mysql-test/mroonga/storage/disabled.def new file mode 100644 index 00000000000..3f546dad2a4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/disabled.def @@ -0,0 +1,9 @@ +alter_table_add_index_token_filters_one_token_filter : Bundled Mroonga does not support token filter yet. +alter_table_change_token_filter : Bundled Mroonga does not support token filter yet. +fulltext_token_filters_skip : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does not support token filter yet. +create_table_token_filters_table_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_table_comment_one_token_filter : Bundled Mroonga does not support token filter yet. +foreign_key_create : Bundled Mroonga does not support this test yet. + diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result new file mode 100644 index 00000000000..52a72155af3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_after.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries ADD title TEXT AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result new file mode 100644 index 00000000000..81feeefc589 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_first.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries ADD title TEXT FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `title` text, + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +title id body +groonga (1) 1 starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result new file mode 100644 index 00000000000..bb157539ac9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_multiple.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries +ADD COLUMN body TEXT FIRST, +ADD COLUMN published BOOLEAN AFTER id, +ADD COLUMN created_at DATETIME; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +body id published title created_at +will start groonga! 1 0 survey 1970-01-01 00:00:00 +INSERT INTO diaries (title, body, published, created_at) +VALUES ("groonga (1)", "starting groonga...", TRUE, "2014-2-9 02:09:00"); +INSERT INTO diaries (title, body, published, created_at) +VALUES ("groonga (2)", "started groonga.", FALSE, "2014-2-9 12:19:00"); +SELECT * FROM diaries; +body id published title created_at +will start groonga! 1 0 survey 1970-01-01 00:00:00 +starting groonga... 2 1 groonga (1) 2014-02-09 02:09:00 +started groonga. 3 0 groonga (2) 2014-02-09 12:19:00 +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `body` text, + `id` int(11) NOT NULL AUTO_INCREMENT, + `published` tinyint(1) DEFAULT NULL, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result new file mode 100644 index 00000000000..df5a15568d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_plain.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result new file mode 100644 index 00000000000..1bc15c6efe2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_flags.result @@ -0,0 +1,10 @@ +CREATE TABLE tags ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 +column_create tags name COLUMN_VECTOR ShortText +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result new file mode 100644 index 00000000000..6ff92ec8e99 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_column_with_type.result @@ -0,0 +1,16 @@ +CREATE TABLE tags ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create tags TABLE_PAT_KEY UInt32 +column_create tags id COLUMN_SCALAR UInt32 +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 +column_create bugs name COLUMN_SCALAR tags +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result new file mode 100644 index 00000000000..e0449e3e54b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_token_filters_one_token_filter.result @@ -0,0 +1,19 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_NO_KEY +column_create memos content COLUMN_SCALAR ShortText +ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_NO_KEY +column_create memos content COLUMN_SCALAR ShortText +table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result new file mode 100644 index 00000000000..8b8b2efbc44 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_index_unique_duplicated.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT +) DEFAULT CHARSET UTF8; +INSERT INTO ids (id) values (1), (1); +ALTER TABLE ids ADD UNIQUE INDEX (id); +ERROR 23000: Can't write, because of unique constraint, to table 'ids' +SHOW CREATE TABLE ids; +Table Create Table +ids CREATE TABLE `ids` ( + `id` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT * FROM ids; +id +1 +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result new file mode 100644 index 00000000000..73fb6a7abe3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_add_key_multiple_column_with_data.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS scores; +SET NAMES UTF8; +CREATE TABLE scores ( +id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +ALTER TABLE scores ADD KEY property (name, score); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result new file mode 100644 index 00000000000..a993756ad62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_comment_not_for_mroonga.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs +CHANGE COLUMN +tag +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result new file mode 100644 index 00000000000..c51c10b6da3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_have_index.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +title VARCHAR(32), +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE bugs CHANGE COLUMN title title VARCHAR(64); +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result new file mode 100644 index 00000000000..19d5d017fb2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_after.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description TEXT AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` text, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id description title +1 starting groonga. groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result new file mode 100644 index 00000000000..cf2bcc0fc2c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_first.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description TEXT FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `description` text, + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +description id title +starting groonga. 1 groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result new file mode 100644 index 00000000000..bc5b0132e43 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_multiple.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries +CHANGE body description TEXT FIRST, +CHANGE title subject TEXT AFTER internal_id, +CHANGE id internal_id INT; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `description` text, + `internal_id` int(11) NOT NULL DEFAULT '0', + `subject` text, + PRIMARY KEY (`internal_id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (subject, description) +VALUES ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +description internal_id subject +starting groonga. 0 groonga (1) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result new file mode 100644 index 00000000000..6d60200e5ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_column_rename_no_order.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +ALTER TABLE diaries CHANGE body description TEXT; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `description` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title description +1 groonga (1) starting groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result new file mode 100644 index 00000000000..3a7413e389b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_engine.result @@ -0,0 +1,49 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries ENGINE = mroonga; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result new file mode 100644 index 00000000000..5046dc8e142 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_change_token_filter.result @@ -0,0 +1,32 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText +table_create memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 +column_create terms content COLUMN_INDEX|WITH_POSITION memos content +ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result new file mode 100644 index 00000000000..6127df61cb4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_create_fulltext.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +CREATE FULLTEXT INDEX title_index on diaries (title); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result new file mode 100644 index 00000000000..ff7bc5e7cea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_ujis.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES ujis; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "Å·µ¤"); +INSERT INTO diaries VALUES (3, "Éٻλ³"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("Éٻλ³"); +id title +3 Éٻλ³ +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("Éٻλ³"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result new file mode 100644 index 00000000000..cbaa8d62c98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_fulltext_utf8.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result new file mode 100644 index 00000000000..9d6cdcd9ba8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_multiple_column.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result new file mode 100644 index 00000000000..09399c12a3e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_normal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result new file mode 100644 index 00000000000..f94c98ff9b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_primary.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result new file mode 100644 index 00000000000..7b71832b84f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_truncate.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +first_name VARCHAR(32) NOT NULL, +last_name VARCHAR(32) NOT NULL, +KEY (first_name, last_name) +); +INSERT INTO users VALUES("Taro", "Yamada"); +INSERT INTO users VALUES("Hanako", "Tanaka"); +INSERT INTO users VALUES("Joe", "Honda"); +SELECT * FROM users; +first_name last_name +Taro Yamada +Hanako Tanaka +Joe Honda +ALTER TABLE users DISABLE KEYS; +TRUNCATE users; +SELECT * FROM users; +first_name last_name +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result new file mode 100644 index 00000000000..8b6f94c0cb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_disable_keys_updating.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +c1 int NOT NULL, +c2 text NOT NULL, +c3 int NOT NULL, +c4 int NOT NULL, +PRIMARY KEY(c1), +KEY idx1(c3,c4), +FULLTEXT KEY ft1(c2) +); +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result new file mode 100644 index 00000000000..6475de51b21 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_multiple.result @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries +DROP COLUMN title, +DROP COLUMN body; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +SELECT * FROM diaries; +id +1 +INSERT INTO diaries () VALUES (); +SELECT * FROM diaries; +id +1 +2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result new file mode 100644 index 00000000000..cbc94cebccf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_column_one.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +SELECT * FROM diaries; +id title +1 survey +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; +id title +1 survey +2 groonga (1) +3 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result new file mode 100644 index 00000000000..b0aa59a20b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_drop_key_multiple_column_with_data.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS scores; +SET NAMES UTF8; +CREATE TABLE scores ( +id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +KEY property (name, score) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +ALTER TABLE scores DROP KEY property; +SELECT * FROM scores +WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result new file mode 100644 index 00000000000..e5c8a34901f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result new file mode 100644 index 00000000000..3853cc849fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_ujis.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES ujis; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "Å·µ¤"); +INSERT INTO diaries VALUES (3, "Éٻλ³"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("Éٻλ³"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("Éٻλ³"); +id title +3 Éٻλ³ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result new file mode 100644 index 00000000000..e5c8a34901f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_fulltext_utf8.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result new file mode 100644 index 00000000000..e252061d109 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_multiple_column.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result new file mode 100644 index 00000000000..0e56e78d0c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_normal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result new file mode 100644 index 00000000000..722e62f966b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_enable_keys_primary.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result new file mode 100644 index 00000000000..6bbedd41e95 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_engine_decimal.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL(6, 3) +) ENGINE InnoDB DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +ALTER TABLE diaries ENGINE = mroonga; +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +2 rainy day 14.213 +3 cloudy day 17.821 +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result new file mode 100644 index 00000000000..bf7593f78eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_no_primary_key.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE memos ( +content varchar(32) +) DEFAULT CHARSET="utf8"; +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `content` varchar(32) DEFAULT NULL, + FULLTEXT KEY `content_index` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); +content +Starting Groonga... +Started Groonga. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result new file mode 100644 index 00000000000..d98dc431a0b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_normal.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT +) DEFAULT CHARSET="utf8"; +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content_index` (`content`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); +id content +1 Starting Groonga... +2 Started Groonga. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result new file mode 100644 index 00000000000..705d2f70126 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_add_table.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); +SELECT * FROM bugs; +id tags +1 GROONGA MROONGA +ALTER TABLE bugs ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; +SELECT * FROM bugs +WHERE MATCH(tags) AGAINST("Groonga"); +id tags +1 GROONGA MROONGA +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result new file mode 100644 index 00000000000..2d5e3d55ca7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_fulltext_drop_table.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags"', +FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); +ALTER TABLE bugs DROP INDEX bugs_tags_index; +ALTER TABLE bugs +ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; +SELECT * FROM bugs +WHERE MATCH(tags) AGAINST("Groonga"); +id tags +1 GROONGA MROONGA +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result new file mode 100644 index 00000000000..d831d02d76a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_after.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY body TEXT AFTER id; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id body title +1 starting groonga. groonga (1) +2 started groonga. groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result new file mode 100644 index 00000000000..bd936507211 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_first.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY body TEXT FIRST; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `body` text, + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +body id title +starting groonga. 1 groonga (1) +started groonga. 2 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result new file mode 100644 index 00000000000..d8d963d87b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_modify_column_no_order.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +ALTER TABLE diaries MODIFY title VARCHAR(100); +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(100) DEFAULT NULL, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 groonga (1) starting groonga. +2 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result new file mode 100644 index 00000000000..64f524de06c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_recreate_anonymous_index_at_once.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 survey will start mroonga! +SELECT * FROM diaries +WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries +DROP INDEX body, +ADD FULLTEXT INDEX (body); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 survey will start mroonga! +SELECT * FROM diaries +WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result new file mode 100644 index 00000000000..eac322ceb26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_rename_table.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries, memos; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +id title body +1 survey will start groonga! +SELECT * FROM memos +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result new file mode 100644 index 00000000000..d8ed80a157d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/alter_table_spatial.result @@ -0,0 +1,132 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL +); +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +GeomFromText('POINT(139.711517 35.647701)')); +ALTER TABLE shops ADD SPATIAL KEY location_index (location); +SELECT id, name, AsText(location) AS location_text FROM shops +WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) +ORDER BY id; +id name location_text +14 tetsuji POINT(139.76857 35.680911944444446) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +SHOW CREATE TABLE shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..6a5729af023 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_TODO_SPLIT_ME.result @@ -0,0 +1,53 @@ +drop table if exists t1; +create table t1 (c1 int auto_increment, primary key(c1)); +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +1 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +2 +insert into t1 values(10); +select c1 from t1 order by c1 desc limit 1; +c1 +10 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +11 +insert into t1 values(6); +select c1 from t1 order by c1 desc limit 1; +c1 +11 +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +c1 +12 +drop table t1; +create table t1 (c1 int, c2 int auto_increment, primary key(c1), key idx1(c2)); +insert into t1 values(1, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +1 1 +insert into t1 values(2, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +2 2 +insert into t1 values(3, 10); +select * from t1 order by c2 desc limit 1; +c1 c2 +3 10 +insert into t1 values(4, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +4 11 +insert into t1 values(5, 6); +select * from t1 order by c2 desc limit 1; +c1 c2 +4 11 +insert into t1 values(6, null); +select * from t1 order by c2 desc limit 1; +c1 c2 +6 12 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result new file mode 100644 index 00000000000..f89b74e571a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_table_param.result @@ -0,0 +1,70 @@ +drop table if exists t1; +create table t1 (c1 int auto_increment, primary key(c1)) auto_increment=34129; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34129 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga AUTO_INCREMENT=34130 DEFAULT CHARSET=latin1 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34130 +34129 +insert into t1 values(10); +select c1 from t1 order by c1 desc; +c1 +34130 +34129 +10 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34131 +34130 +34129 +10 +insert into t1 values(6); +select c1 from t1 order by c1 desc; +c1 +34131 +34130 +34129 +10 +6 +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +34132 +34131 +34130 +34129 +10 +6 +truncate table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +1 +delete from t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +c1 +2 +rename table t1 to t2; +insert into t2 values(null); +select c1 from t2 order by c1 desc; +c1 +3 +2 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +drop table t2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result new file mode 100644 index 00000000000..fe5e6409abe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/auto_increment_text.result @@ -0,0 +1,15 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text +); +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +id body +1 started groonga (long text) +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +id body +1 started groonga (long text) +2 sleeping... (short text) +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..340509f6e53 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/binlog_TODO_SPLIT_ME.result @@ -0,0 +1,34 @@ +drop table if exists t1; +show variables like 'log_bin'; +Variable_name Value +log_bin ON +set binlog_format="STATEMENT"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="ROW"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="MIXED"; +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result new file mode 100644 index 00000000000..880092f46fb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_general_ci_french.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_general_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("Je suis un garçon."); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); +content +Je suis un garçon. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result new file mode 100644 index 00000000000..3f24de87035 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_french.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_unicode_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("Je suis un garçon."); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); +content +Je suis un garçon. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result new file mode 100644 index 00000000000..94ef2608b81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/collation_utf8_unicode_ci_japanese.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +content varchar(256) COLLATE utf8_unicode_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚"); +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("ã‹ãŸã‹ãª"); +content +ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result new file mode 100644 index 00000000000..94b3a603389 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_index_not_for_mroonga.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED, +INDEX (id) COMMENT 'ID search is required.' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned DEFAULT NULL, + KEY `id` (`id`) COMMENT 'ID search is required.' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result new file mode 100644 index 00000000000..162b515d898 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_comment_normal_not_for_mroonga.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result new file mode 100644 index 00000000000..e24a56be3a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_with_index.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATE, +KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` date DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +3 cloudy day 2012-01-31 +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result new file mode 100644 index 00000000000..018ee8eb5b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_without_index.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +3 cloudy day 2012-01-31 +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; +id title created_at +1 clear day 2012-01-29 +2 rainy day 2012-01-30 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result new file mode 100644 index 00000000000..b2364e1158e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_date_zero_date.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; +Table Create Table +timestamps CREATE TABLE `timestamps` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_dt` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +1 2012-01-01 +2 2012-01-01 +SELECT * FROM timestamps WHERE create_dt = "2012-01-01"; +id create_dt +1 2012-01-01 +2 2012-01-01 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result new file mode 100644 index 00000000000..453f641968b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_2038.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-20 03:14:08', '2038-01-20 03:14:08'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2038-01-18 03:14:07 2038-01-18 03:14:07 +2 2038-01-20 03:14:08 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result new file mode 100644 index 00000000000..10824d7c28d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_before_unix_epoch.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 1000-01-01 00:00:00 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result new file mode 100644 index 00000000000..f3a7b27f342 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_max.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 9999-12-31 23:59:59 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result new file mode 100644 index 00000000000..d7acad79bab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_32bit_out_of_range.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result new file mode 100644 index 00000000000..56e38902f28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_2038.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); +INSERT INTO diaries (title, created_at) +VALUES ('2038-01-19 03:14:08', '2038-01-19 03:14:08'); +SELECT * FROM diaries; +id title created_at +1 2038-01-19 03:14:07 2038-01-19 03:14:07 +2 2038-01-19 03:14:08 2038-01-19 03:14:08 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result new file mode 100644 index 00000000000..c3ca2628bca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_before_unix_epoch.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +SELECT * FROM diaries; +id title created_at +1 1000-01-01 00:00:00 1000-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result new file mode 100644 index 00000000000..0373d17530e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_max.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); +SELECT * FROM diaries; +id title created_at +1 9999-12-31 23:59:59 9999-12-31 23:59:59 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result new file mode 100644 index 00000000000..733217fda85 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_55_out_of_range.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1264 Out of range value for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 0000-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result new file mode 100644 index 00000000000..962212c86f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_64bit_version_56_or_later_out_of_range.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('2012', '2012'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 2012 0000-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result new file mode 100644 index 00000000000..a31042f768d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_with_index.result @@ -0,0 +1,34 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME(6), +KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime(6) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +3 cloudy day 2012-01-31 08:32:10.555500 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result new file mode 100644 index 00000000000..0b1bf0f0eb4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_fractional_seconds_without_index.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME(6) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime(6) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +3 cloudy day 2012-01-31 08:32:10.555500 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at +1 clear day 2012-01-29 21:51:01.111111 +2 rainy day 2012-01-30 01:23:45.333000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result new file mode 100644 index 00000000000..10824d7c28d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_freebsd_before_unix_epoch.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); +Warnings: +Warning 1265 Data truncated for column 'created_at' at row 1 +SELECT * FROM diaries; +id title created_at +1 1000-01-01 00:00:00 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result new file mode 100644 index 00000000000..82f01b9f237 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_null.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ('NULL', NULL); +SELECT * FROM diaries; +id title created_at +1 NULL 1970-01-01 00:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result new file mode 100644 index 00000000000..b205031dec1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_with_index.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME, +KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `created_at` (`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +3 cloudy day 2012-01-31 08:32:10 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result new file mode 100644 index 00000000000..6592df35fcb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_without_index.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at) +VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) +VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) +VALUES ("cloudy day", "2012-01-31 08:32:10"); +SELECT * FROM diaries; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +3 cloudy day 2012-01-31 08:32:10 +SELECT * FROM diaries +WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at +1 clear day 2012-01-29 21:51:01 +2 rainy day 2012-01-30 01:23:45 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result new file mode 100644 index 00000000000..c22a63f9744 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_datetime_zero_date.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS timestamps; +CREATE TABLE timestamps ( +id INT PRIMARY KEY AUTO_INCREMENT, +create_dt DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; +Table Create Table +timestamps CREATE TABLE `timestamps` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_dt` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); +Warnings: +Warning 1265 Data truncated for column 'create_dt' at row 1 +SELECT * FROM timestamps; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; +id create_dt +1 2012-01-01 00:00:00 +2 2012-01-01 00:00:00 +DROP TABLE timestamps; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result new file mode 100644 index 00000000000..4a21d62dd14 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_with_index.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL(6, 3), +KEY (temperature) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `temperature` (`temperature`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +2 rainy day 14.213 +3 cloudy day 17.821 +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; +id title temperature +2 rainy day 14.213 +3 cloudy day 17.821 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result new file mode 100644 index 00000000000..cd939fa5483 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_fractional_seconds_without_index.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL(6, 3) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(6,3) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; +id title temperature +1 clear day 21.281 +2 rainy day 14.213 +3 cloudy day 17.821 +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; +id title temperature +2 rainy day 14.213 +3 cloudy day 17.821 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result new file mode 100644 index 00000000000..56a6a360dc9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_with_index.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL, +KEY (temperature) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(10,0) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `temperature` (`temperature`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); +SELECT * FROM diaries; +id title temperature +1 clear day 21 +2 rainy day 14 +3 cloudy day 17 +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; +id title temperature +2 rainy day 14 +3 cloudy day 17 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result new file mode 100644 index 00000000000..06162f76ddd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_decimal_without_index.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +temperature DECIMAL +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `temperature` decimal(10,0) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); +SELECT * FROM diaries; +id title temperature +1 clear day 21 +2 rainy day 14 +3 cloudy day 17 +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; +id title temperature +2 rainy day 14 +3 cloudy day 17 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result new file mode 100644 index 00000000000..28c80dcc6f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_less_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +size ENUM("small", "medium", "large"), +INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `size` enum('small','medium','large') DEFAULT NULL, + KEY `size` (`size`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart for child", "small"); +INSERT INTO items VALUES ("leadies' coat", "medium"); +INSERT INTO items VALUES ("parka", "large"); +INSERT INTO items VALUES ("hat", "medium"); +SELECT * FROM items; +name size +t-shart for child small +leadies' coat medium +parka large +hat medium +SELECT * FROM items WHERE size = "medium"; +name size +leadies' coat medium +hat medium +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result new file mode 100644 index 00000000000..731a9690702 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_enum_many_with_index.result @@ -0,0 +1,287 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +size ENUM("size1", +"size2", +"size3", +"size4", +"size5", +"size6", +"size7", +"size8", +"size9", +"size10", +"size11", +"size12", +"size13", +"size14", +"size15", +"size16", +"size17", +"size18", +"size19", +"size20", +"size21", +"size22", +"size23", +"size24", +"size25", +"size26", +"size27", +"size28", +"size29", +"size30", +"size31", +"size32", +"size33", +"size34", +"size35", +"size36", +"size37", +"size38", +"size39", +"size40", +"size41", +"size42", +"size43", +"size44", +"size45", +"size46", +"size47", +"size48", +"size49", +"size50", +"size51", +"size52", +"size53", +"size54", +"size55", +"size56", +"size57", +"size58", +"size59", +"size60", +"size61", +"size62", +"size63", +"size64", +"size65", +"size66", +"size67", +"size68", +"size69", +"size70", +"size71", +"size72", +"size73", +"size74", +"size75", +"size76", +"size77", +"size78", +"size79", +"size80", +"size81", +"size82", +"size83", +"size84", +"size85", +"size86", +"size87", +"size88", +"size89", +"size90", +"size91", +"size92", +"size93", +"size94", +"size95", +"size96", +"size97", +"size98", +"size99", +"size100", +"size101", +"size102", +"size103", +"size104", +"size105", +"size106", +"size107", +"size108", +"size109", +"size110", +"size111", +"size112", +"size113", +"size114", +"size115", +"size116", +"size117", +"size118", +"size119", +"size120", +"size121", +"size122", +"size123", +"size124", +"size125", +"size126", +"size127", +"size128", +"size129", +"size130", +"size131", +"size132", +"size133", +"size134", +"size135", +"size136", +"size137", +"size138", +"size139", +"size140", +"size141", +"size142", +"size143", +"size144", +"size145", +"size146", +"size147", +"size148", +"size149", +"size150", +"size151", +"size152", +"size153", +"size154", +"size155", +"size156", +"size157", +"size158", +"size159", +"size160", +"size161", +"size162", +"size163", +"size164", +"size165", +"size166", +"size167", +"size168", +"size169", +"size170", +"size171", +"size172", +"size173", +"size174", +"size175", +"size176", +"size177", +"size178", +"size179", +"size180", +"size181", +"size182", +"size183", +"size184", +"size185", +"size186", +"size187", +"size188", +"size189", +"size190", +"size191", +"size192", +"size193", +"size194", +"size195", +"size196", +"size197", +"size198", +"size199", +"size200", +"size201", +"size202", +"size203", +"size204", +"size205", +"size206", +"size207", +"size208", +"size209", +"size210", +"size211", +"size212", +"size213", +"size214", +"size215", +"size216", +"size217", +"size218", +"size219", +"size220", +"size221", +"size222", +"size223", +"size224", +"size225", +"size226", +"size227", +"size228", +"size229", +"size230", +"size231", +"size232", +"size233", +"size234", +"size235", +"size236", +"size237", +"size238", +"size239", +"size240", +"size241", +"size242", +"size243", +"size244", +"size245", +"size246", +"size247", +"size248", +"size249", +"size250", +"size251", +"size252", +"size253", +"size254", +"size255", +"size256"), +INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `size` enum('size1','size2','size3','size4','size5','size6','size7','size8','size9','size10','size11','size12','size13','size14','size15','size16','size17','size18','size19','size20','size21','size22','size23','size24','size25','size26','size27','size28','size29','size30','size31','size32','size33','size34','size35','size36','size37','size38','size39','size40','size41','size42','size43','size44','size45','size46','size47','size48','size49','size50','size51','size52','size53','size54','size55','size56','size57','size58','size59','size60','size61','size62','size63','size64','size65','size66','size67','size68','size69','size70','size71','size72','size73','size74','size75','size76','size77','size78','size79','size80','size81','size82','size83','size84','size85','size86','size87','size88','size89','size90','size91','size92','size93','size94','size95','size96','size97','size98','size99','size100','size101','size102','size103','size104','size105','size106','size107','size108','size109','size110','size111','size112','size113','size114','size115','size116','size117','size118','size119','size120','size121','size122','size123','size124','size125','size126','size127','size128','size129','size130','size131','size132','size133','size134','size135','size136','size137','size138','size139','size140','size141','size142','size143','size144','size145','size146','size147','size148','size149','size150','size151','size152','size153','size154','size155','size156','size157','size158','size159','size160','size161','size162','size163','size164','size165','size166','size167','size168','size169','size170','size171','size172','size173','size174','size175','size176','size177','size178','size179','size180','size181','size182','size183','size184','size185','size186','size187','size188','size189','size190','size191','size192','size193','size194','size195','size196','size197','size198','size199','size200','size201','size202','size203','size204','size205','size206','size207','size208','size209','size210','size211','size212','size213','size214','size215','size216','size217','size218','size219','size220','size221','size222','size223','size224','size225','size226','size227','size228','size229','size230','size231','size232','size233','size234','size235','size236','size237','size238','size239','size240','size241','size242','size243','size244','size245','size246','size247','size248','size249','size250','size251','size252','size253','size254','size255','size256') DEFAULT NULL, + KEY `size` (`size`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart for child", "size1"); +INSERT INTO items VALUES ("leadies' coat", "size1"); +INSERT INTO items VALUES ("parka", "size256"); +INSERT INTO items VALUES ("hat", "size256"); +SELECT * FROM items; +name size +t-shart for child size1 +leadies' coat size1 +parka size256 +hat size256 +SELECT * FROM items WHERE size = "size1"; +name size +t-shart for child size1 +leadies' coat size1 +SELECT * FROM items WHERE size = "size256"; +name size +parka size256 +hat size256 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result new file mode 100644 index 00000000000..33f31ed38df --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id__id.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS contents; +CREATE TABLE contents ( +_id INT, +content TEXT NOT NULL, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +INSERT INTO contents (content) VALUES ('first'); +INSERT INTO contents (content) VALUES ('second'); +SELECT _id, content FROM contents; +_id content +1 first +2 second +DROP TABLE contents; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result new file mode 100644 index 00000000000..903e3a85cab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga__id_invalid_id.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS contents; +CREATE TABLE contents ( +_i INT, +content TEXT NOT NULL, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +ERROR HY000: [column][create] name can't start with '_' and contains only 0-9, A-Z, a-z, #, @, - or _: <_i> +DROP TABLE IF EXISTS contents; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result new file mode 100644 index 00000000000..87c14a98f15 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_fulltext_other_table.result @@ -0,0 +1,42 @@ +DROP DATABASE IF EXISTS mroonga; +CREATE DATABASE mroonga; +USE mroonga; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"', +FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit +column_create tags name COLUMN_SCALAR ShortText +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 +column_create bugs tags COLUMN_VECTOR tags +column_create tags bugs_tags_index COLUMN_INDEX|WITH_POSITION bugs tags +load --table tags +[ +["_key","name"], +["Linux",""], +["MySQL",""], +["groonga",""] +] +load --table bugs +[ +["_key","id","tags"], +[1,1,["Linux","MySQL","groonga"]] +] +SELECT *, MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE) AS score +FROM bugs +WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); +id tags score +1 Linux MySQL groonga 1 +DROP TABLE bugs; +DROP TABLE tags; +DROP DATABASE mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result new file mode 100644 index 00000000000..e46ed71d0fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_index_int_other_table.result @@ -0,0 +1,45 @@ +DROP DATABASE IF EXISTS mroonga; +CREATE DATABASE mroonga; +USE mroonga; +CREATE TABLE priorities ( +id INT PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +priority INT COMMENT 'type "priorities"', +INDEX bugs_priority_index (priority) COMMENT 'table "priorities"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, priority) VALUES (1, 10); +INSERT INTO bugs (id, priority) VALUES (2, 3); +INSERT INTO bugs (id, priority) VALUES (3, -2); +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create priorities TABLE_PAT_KEY Int32 +column_create priorities id COLUMN_SCALAR Int32 +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 +column_create bugs priority COLUMN_SCALAR priorities +column_create priorities bugs_priority_index COLUMN_INDEX|WITH_POSITION bugs priority +load --table priorities +[ +["_key","id"], +[-2,0], +[3,0], +[10,0] +] +load --table bugs +[ +["_key","id","priority"], +[1,1,10], +[2,2,3], +[3,3,-2] +] +SELECT * +FROM bugs +WHERE priority = 3; +id priority +2 3 +DROP TABLE bugs; +DROP TABLE priorities; +DROP DATABASE mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result new file mode 100644 index 00000000000..8acf8aab220 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_reference.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag TEXT COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); +SELECT * FROM bugs; +id tag +1 Linux +2 MySQL +3 groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result new file mode 100644 index 00000000000..cd910206a3d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_scalar_with_not_for_mroonga_comment.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag TEXT COMMENT 'It references to tags.name, type "tags"' +) DEFAULT CHARSET=utf8; +SHOW FULL COLUMNS FROM bugs LIKE 'tag'; +Field Type Collation Null Key Default Extra Privileges Comment +tag text utf8_general_ci YES NULL select,insert,update,references It references to tags.name, type "tags" +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); +SELECT * FROM bugs; +id tag +1 Linux +2 MySQL +3 groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result new file mode 100644 index 00000000000..468115e8a20 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_order_by_with_function.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL Groonga"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL Mroonga"); +INSERT INTO bugs (id, tags) VALUES (3, "Ruby Rroonga"); +SELECT * FROM tags ORDER BY SUBSTRING(name, 1, 1) ASC; +name +Groonga +Linux +Mroonga +MySQL +Rroonga +Ruby +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result new file mode 100644 index 00000000000..515dad1da2e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_groonga_vector_reference.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS tags, bugs; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +SELECT * FROM bugs; +id tags +1 Linux MySQL groonga +SELECT * FROM tags; +name +Linux +MySQL +groonga +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result new file mode 100644 index 00000000000..1afd7da9839 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_int_with_index_zero_value.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT KEY +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 200); +INSERT INTO items VALUES ("smile", 0); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +smile 0 +coke 100 +hamburger 200 +SELECT * FROM items WHERE price = 0; +name price +smile 0 +SELECT * FROM items WHERE price <= 100; +name price +smile 0 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result new file mode 100644 index 00000000000..ee818a62e75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_16_with_index.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "white,dark gray"); +INSERT INTO items VALUES ("parka", "chartreuse,orange"); +SELECT * FROM items; +name colors +t-shart black,gray +hat dark gray,white +parka orange,chartreuse +SELECT * FROM items WHERE colors = "dark gray,white"; +name colors +hat dark gray,white +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result new file mode 100644 index 00000000000..10d4fd8bd1c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_24_with_index.result @@ -0,0 +1,48 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,lawn green"); +INSERT INTO items VALUES ("parka", "gray,medium blue"); +SELECT * FROM items; +name colors +t-shart black,white +hat white,lawn green +parka gray,medium blue +SELECT * FROM items WHERE colors = "white,lawn green"; +name colors +hat white,lawn green +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result new file mode 100644 index 00000000000..0432970aa9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_32_with_index.result @@ -0,0 +1,56 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet", +"dark magenta", +"magenta", +"dark red", +"brown", +"firebrick", +"indian red", +"light coral", +"salmon"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet','dark magenta','magenta','dark red','brown','firebrick','indian red','light coral','salmon') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,dark violet"); +INSERT INTO items VALUES ("parka", "green,brown,red"); +SELECT * FROM items; +name colors +t-shart black,white +hat white,dark violet +parka red,green,brown +SELECT * FROM items WHERE colors = "white,dark violet"; +name colors +hat white,dark violet +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result new file mode 100644 index 00000000000..5b6d4511adf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_64_with_index.result @@ -0,0 +1,88 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white", +"red", +"orange red", +"dark orange", +"orange", +"gold", +"yellow", +"chartreuse", +"lawn green", +"green", +"spring green", +"medium spring green", +"cyan", +"deep sky blue", +"blue", +"medium blue", +"dark violet", +"dark magenta", +"magenta", +"dark red", +"brown", +"firebrick", +"indian red", +"light coral", +"salmon", +"light salmon", +"tomato", +"coral", +"dark salmon", +"rosy brown", +"sienna", +"saddle brown", +"chocolate", +"peru", +"sandy brown", +"burlywood", +"tan", +"navajo white", +"wheat", +"dark goldenrod", +"goldenrod", +"light goldenrod", +"pale goldenrod", +"cornsilk", +"dark khaki", +"khaki", +"lemon chiffon", +"dark olive green", +"olive drab", +"yellow green", +"green yellow", +"light green", +"forest green", +"dark green", +"lime green", +"pale green", +"dark sea green"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white','red','orange red','dark orange','orange','gold','yellow','chartreuse','lawn green','green','spring green','medium spring green','cyan','deep sky blue','blue','medium blue','dark violet','dark magenta','magenta','dark red','brown','firebrick','indian red','light coral','salmon','light salmon','tomato','coral','dark salmon','rosy brown','sienna','saddle brown','chocolate','peru','sandy brown','burlywood','tan','navajo white','wheat','dark goldenrod','goldenrod','light goldenrod','pale goldenrod','cornsilk','dark khaki','khaki','lemon chiffon','dark olive green','olive drab','yellow green','green yellow','light green','forest green','dark green','lime green','pale green','dark sea green') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,white,lawn green,dark violet"); +INSERT INTO items VALUES ("hat", "white,dark violet,yellow green"); +INSERT INTO items VALUES ("parka", "green,brown,red,lime green"); +SELECT * FROM items; +name colors +t-shart black,white,lawn green,dark violet +hat white,dark violet,yellow green +parka red,green,brown,lime green +SELECT * FROM items WHERE colors = "white,dark violet,yellow green"; +name colors +hat white,dark violet,yellow green +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result new file mode 100644 index 00000000000..3e6bf4e1939 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_set_8_with_index.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +colors SET("black", +"dim gray", +"dark gray", +"gray", +"light gray", +"gainsboro", +"white smoke", +"white"), +INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `name` varchar(255) DEFAULT NULL, + `colors` set('black','dim gray','dark gray','gray','light gray','gainsboro','white smoke','white') DEFAULT NULL, + KEY `colors` (`colors`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "dim gray,dark gray"); +INSERT INTO items VALUES ("parka", "white smoke,light gray"); +SELECT * FROM items; +name colors +t-shart black,gray +hat dim gray,dark gray +parka light gray,white smoke +SELECT * FROM items WHERE colors = "dim gray,dark gray"; +name colors +hat dim gray,dark gray +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result new file mode 100644 index 00000000000..262f77556c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_bigint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price BIGINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("house", 9223372036854775807); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -9223372036854775808); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 2147483648); +SELECT * FROM items; +name price +discount -9223372036854775808 +coke 100 +note PC 32767 +super car 2147483648 +house 9223372036854775807 +SELECT * FROM items WHERE price <= 2147483648; +name price +discount -9223372036854775808 +coke 100 +note PC 32767 +super car 2147483648 +SELECT * FROM items WHERE price > 2147483647; +name price +super car 2147483648 +house 9223372036854775807 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result new file mode 100644 index 00000000000..867b887182f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_int_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 2147483647); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -2147483647); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 16777216); +SELECT * FROM items; +name price +discount -2147483647 +coke 100 +note PC 32767 +bike 16777216 +car 2147483647 +SELECT * FROM items WHERE price <= 16777216; +name price +discount -2147483647 +coke 100 +note PC 32767 +bike 16777216 +SELECT * FROM items WHERE price > 16777215; +name price +bike 16777216 +car 2147483647 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result new file mode 100644 index 00000000000..c8b4f895a9c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_mediumint_with_index.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price MEDIUMINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 8388607); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -8388608); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 32768); +SELECT * FROM items; +name price +discount -8388608 +coke 100 +note PC 32767 +bike 32768 +car 8388607 +SELECT * FROM items WHERE price <= 127; +name price +discount -8388608 +coke 100 +SELECT * FROM items WHERE price >= 32768; +name price +bike 32768 +car 8388607 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result new file mode 100644 index 00000000000..8a51ee5fd8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_smallint_with_index.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price SMALLINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -32768); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 20000); +SELECT * FROM items; +name price +discount -32768 +coke 100 +tablet PC 20000 +note PC 32767 +SELECT * FROM items WHERE price <= 127; +name price +discount -32768 +coke 100 +SELECT * FROM items WHERE price >= 128; +name price +tablet PC 20000 +note PC 32767 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result new file mode 100644 index 00000000000..d14efcca9a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_signed_tinyint_with_index.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price TINYINT KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 120); +INSERT INTO items VALUES ("discount", -10); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +discount -10 +coke 100 +hamburger 120 +SELECT * FROM items WHERE price <= 100; +name price +discount -10 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result new file mode 100644 index 00000000000..9c2a8e876e3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_fractional_seconds_with_index.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +average TIME(6), +max TIME(6), +KEY (average) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; +Table Create Table +running_records CREATE TABLE `running_records` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `average` time(6) DEFAULT NULL, + `max` time(6) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `average` (`average`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO running_records (title, average, max) +VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); +INSERT INTO running_records (title, average, max) +VALUES ("bad condition", "12:23:34.123456", "838:59:58.999999"); +INSERT INTO running_records (title, average, max) +VALUES ("record failure", "-838:59:59.000000", "-838:59:59.000000"); +SELECT * FROM running_records; +id title average max +1 normal condition 01:00:00.000001 01:05:00.000001 +2 bad condition 12:23:34.123456 838:59:58.999999 +3 record failure -838:59:59.000000 -838:59:59.000000 +SELECT * FROM running_records +WHERE average BETWEEN "00:59:59.999999" AND "100:10:10.101010"; +id title average max +1 normal condition 01:00:00.000001 01:05:00.000001 +2 bad condition 12:23:34.123456 838:59:58.999999 +SELECT * FROM running_records +WHERE average BETWEEN "-838:59:59.000000" AND "01:00:00.000001"; +id title average max +3 record failure -838:59:59.000000 -838:59:59.000000 +1 normal condition 01:00:00.000001 01:05:00.000001 +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result new file mode 100644 index 00000000000..da75fd97424 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_time_with_index.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +average TIME, +max TIME, +KEY (average) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; +Table Create Table +running_records CREATE TABLE `running_records` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `average` time DEFAULT NULL, + `max` time DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `average` (`average`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO running_records (title, average, max) +VALUES ("normal condition", "01:00:00", "01:05:00"); +INSERT INTO running_records (title, average, max) +VALUES ("bad condition", "12:23:34", "838:59:59"); +INSERT INTO running_records (title, average, max) +VALUES ("record failure", "-838:59:59", "-838:59:59"); +SELECT * FROM running_records; +id title average max +1 normal condition 01:00:00 01:05:00 +2 bad condition 12:23:34 838:59:59 +3 record failure -838:59:59 -838:59:59 +SELECT * FROM running_records +WHERE average BETWEEN "00:59:59" AND "100:10:10"; +id title average max +1 normal condition 01:00:00 01:05:00 +2 bad condition 12:23:34 838:59:59 +SELECT * FROM running_records +WHERE average BETWEEN "-838:59:59" AND "01:00:00"; +id title average max +3 record failure -838:59:59 -838:59:59 +1 normal condition 01:00:00 01:05:00 +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result new file mode 100644 index 00000000000..da245535f2c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at TIMESTAMP(6), +updated_at TIMESTAMP(6), +KEY (updated_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', + PRIMARY KEY (`id`), + KEY `updated_at` (`updated_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("clear day", +"2012-01-29 21:51:01.111111", +"2012-01-29 21:51:02.222222"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("rainy day", +"2012-01-30 01:23:45.333", +"2012-01-30 01:23:46.444"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("cloudy day", +"2012-01-31 08:32:10.5555", +"2012-01-31 08:32:11.6666"); +SELECT * FROM diaries; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01.111111 2012-01-29 21:51:02.222222 +2 rainy day 2012-01-30 01:23:45.333000 2012-01-30 01:23:46.444000 +3 cloudy day 2012-01-31 08:32:10.555500 2012-01-31 08:32:11.666600 +SELECT * FROM diaries +WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01.111111 2012-01-29 21:51:02.222222 +2 rainy day 2012-01-30 01:23:45.333000 2012-01-30 01:23:46.444000 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result new file mode 100644 index 00000000000..b310de48111 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +created_at TIMESTAMP, +updated_at TIMESTAMP, +KEY (updated_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + PRIMARY KEY (`id`), + KEY `updated_at` (`updated_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("rainy day", "2012-01-30 01:23:45", "2012-01-30 01:23:46"); +INSERT INTO diaries (title, created_at, updated_at) +VALUES ("cloudy day", "2012-01-31 08:32:10", "2012-01-31 08:32:11"); +SELECT * FROM diaries; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01 2012-01-29 21:51:02 +2 rainy day 2012-01-30 01:23:45 2012-01-30 01:23:46 +3 cloudy day 2012-01-31 08:32:10 2012-01-31 08:32:11 +SELECT * FROM diaries +WHERE updated_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +id title created_at updated_at +1 clear day 2012-01-29 21:51:01 2012-01-29 21:51:02 +2 rainy day 2012-01-30 01:23:45 2012-01-30 01:23:46 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result new file mode 100644 index 00000000000..8dde1bdde6d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_tinyint_without_index.result @@ -0,0 +1,18 @@ +drop table if exists books; +create table books(title varchar(255), published tinyint); +insert into books values ("MySQL", 1); +insert into books values ("groonga", 1); +insert into books values ("mroonga", 0); +select count(*) from books where published = 0; +count(*) +1 +select count(*) from books where published = 1; +count(*) +2 +select count(*) from books where published != 2; +count(*) +3 +select count(*) from books where published != 1; +count(*) +1 +drop table books; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result new file mode 100644 index 00000000000..d16004e3b82 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price BIGINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("house", 18446744073709551615); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 9223372036854775808); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +super car 9223372036854775808 +house 18446744073709551615 +SELECT * FROM items WHERE price <= 9223372036854775808; +name price +discount 0 +coke 100 +note PC 32767 +super car 9223372036854775808 +SELECT * FROM items WHERE price > 9223372036854775807; +name price +super car 9223372036854775808 +house 18446744073709551615 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result new file mode 100644 index 00000000000..277580c7710 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_bigint_without_index.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT UNSIGNED +) DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES (317173755057152000); +INSERT INTO ids VALUES (317173755057152002); +SELECT * FROM ids; +id +317173755057152000 +317173755057152002 +SELECT * FROM ids WHERE id = 317173755057152000; +id +317173755057152000 +SELECT * FROM ids WHERE id = 317173755057152002; +id +317173755057152002 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result new file mode 100644 index 00000000000..d14ef87702d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_int_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price INT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 4294967295); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 2147483648); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +bike 2147483648 +car 4294967295 +SELECT * FROM items WHERE price <= 2147483648; +name price +discount 0 +coke 100 +note PC 32767 +bike 2147483648 +SELECT * FROM items WHERE price > 2147483647; +name price +bike 2147483648 +car 4294967295 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result new file mode 100644 index 00000000000..2825aadae48 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_mediumint_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price MEDIUMINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("car", 16777215); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 8388607); +SELECT * FROM items; +name price +discount 0 +coke 100 +note PC 32767 +bike 8388607 +car 16777215 +SELECT * FROM items WHERE price <= 8388608; +name price +discount 0 +coke 100 +note PC 32767 +bike 8388607 +SELECT * FROM items WHERE price >= 8388607; +name price +bike 8388607 +car 16777215 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result new file mode 100644 index 00000000000..8586d091386 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_smallint_with_index.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price SMALLINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("note PC", 65535); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 32767); +SELECT * FROM items; +name price +discount 0 +coke 100 +tablet PC 32767 +note PC 65535 +SELECT * FROM items WHERE price <= 32768; +name price +discount 0 +coke 100 +tablet PC 32767 +SELECT * FROM items WHERE price >= 32767; +name price +tablet PC 32767 +note PC 65535 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result new file mode 100644 index 00000000000..90adb048361 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_unsigned_tinyint_with_index.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +name VARCHAR(255), +price TINYINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; +INSERT INTO items VALUES ("hamburger", 255); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +SELECT * FROM items; +name price +discount 0 +coke 100 +hamburger 255 +SELECT * FROM items WHERE price <= 100; +name price +discount 0 +coke 100 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result new file mode 100644 index 00000000000..3ee91c1a408 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_with_index.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +party_year YEAR, +KEY (party_year) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; +Table Create Table +aniversary_memos CREATE TABLE `aniversary_memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `party_year` year(4) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `party_year` (`party_year`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO aniversary_memos (title, party_year) +VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Wow! Today is the anniversary party day!", "13"); +SELECT * FROM aniversary_memos; +id title party_year +1 We need a big cake! 2011 +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +id title party_year +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result new file mode 100644 index 00000000000..254a0c0718a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_year_without_index.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +party_year YEAR +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; +Table Create Table +aniversary_memos CREATE TABLE `aniversary_memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `party_year` year(4) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO aniversary_memos (title, party_year) +VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) +VALUES ("Wow! Today is the anniversary party day!", "13"); +SELECT * FROM aniversary_memos; +id title party_year +1 We need a big cake! 2011 +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +id title party_year +2 Invitations are sent. 2012 +3 Tommorow is the anniversary party day! 2012 +4 Wow! Today is the anniversary party day! 2013 +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result new file mode 100644 index 00000000000..56c868b2aa9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_database_name_slash.result @@ -0,0 +1,33 @@ +DROP DATABASE IF EXISTS `master/production`; +DROP DATABASE IF EXISTS `master/development`; +CREATE DATABASE `master/production`; +USE `master/production`; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title) VALUES ("clear day (production)"); +INSERT INTO diaries (title) VALUES ("rainy day (production)"); +INSERT INTO diaries (title) VALUES ("cloudy day (production)"); +SELECT * FROM diaries; +id title +1 clear day (production) +2 rainy day (production) +3 cloudy day (production) +CREATE DATABASE `master/development`; +USE `master/development`; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +INSERT INTO diaries (title) VALUES ("clear day (development)"); +INSERT INTO diaries (title) VALUES ("rainy day (development)"); +INSERT INTO diaries (title) VALUES ("cloudy day (development)"); +SELECT * FROM diaries; +id title +1 clear day (development) +2 rainy day (development) +3 cloudy day (development) +USE test; +DROP DATABASE `master/production`; +DROP DATABASE `master/development`; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..d2a00b777ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result @@ -0,0 +1,172 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int); +create table t2 (c1 int); +create table t3 (c1 int); +drop table t1,t2,t3; +create table t1 (c1 int, c2 int, c3 int); +create table t2 (c1 int primary key, c2 int, c3 int); +drop table t1,t2; +create table t1 (c1 bit); +desc t1; +Field Type Null Key Default Extra +c1 bit(1) YES NULL +drop table t1; +create table t1 (c1 tinyint); +desc t1; +Field Type Null Key Default Extra +c1 tinyint(4) YES NULL +drop table t1; +create table t1 (c1 smallint); +desc t1; +Field Type Null Key Default Extra +c1 smallint(6) YES NULL +drop table t1; +create table t1 (c1 mediumint); +desc t1; +Field Type Null Key Default Extra +c1 mediumint(9) YES NULL +drop table t1; +create table t1 (c1 int); +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +drop table t1; +create table t1 (c1 bigint); +desc t1; +Field Type Null Key Default Extra +c1 bigint(20) YES NULL +drop table t1; +create table t1 (c1 double); +desc t1; +Field Type Null Key Default Extra +c1 double YES NULL +drop table t1; +create table t1 (c1 float); +desc t1; +Field Type Null Key Default Extra +c1 float YES NULL +drop table t1; +create table t1 (c1 decimal); +desc t1; +Field Type Null Key Default Extra +c1 decimal(10,0) YES NULL +drop table t1; +create table t1 (c1 date); +desc t1; +Field Type Null Key Default Extra +c1 date YES NULL +drop table t1; +create table t1 (c1 time); +desc t1; +Field Type Null Key Default Extra +c1 time YES NULL +drop table t1; +create table t1 (c1 timestamp); +desc t1; +Field Type Null Key Default Extra +c1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +drop table t1; +create table t1 (c1 datetime); +desc t1; +Field Type Null Key Default Extra +c1 datetime YES NULL +drop table t1; +create table t1 (c1 year); +desc t1; +Field Type Null Key Default Extra +c1 year(4) YES NULL +drop table t1; +create table t1 (c1 char(10)); +desc t1; +Field Type Null Key Default Extra +c1 char(10) YES NULL +drop table t1; +create table t1 (c1 varchar(10)); +desc t1; +Field Type Null Key Default Extra +c1 varchar(10) YES NULL +drop table t1; +create table t1 (c1 binary(10)); +desc t1; +Field Type Null Key Default Extra +c1 binary(10) YES NULL +drop table t1; +create table t1 (c1 varbinary(10)); +desc t1; +Field Type Null Key Default Extra +c1 varbinary(10) YES NULL +drop table t1; +create table t1 (c1 tinyblob); +desc t1; +Field Type Null Key Default Extra +c1 tinyblob YES NULL +drop table t1; +create table t1 (c1 blob); +desc t1; +Field Type Null Key Default Extra +c1 blob YES NULL +drop table t1; +create table t1 (c1 mediumblob); +desc t1; +Field Type Null Key Default Extra +c1 mediumblob YES NULL +drop table t1; +create table t1 (c1 longblob); +desc t1; +Field Type Null Key Default Extra +c1 longblob YES NULL +drop table t1; +create table t1 (c1 tinytext); +desc t1; +Field Type Null Key Default Extra +c1 tinytext YES NULL +drop table t1; +create table t1 (c1 text); +desc t1; +Field Type Null Key Default Extra +c1 text YES NULL +drop table t1; +create table t1 (c1 mediumtext); +desc t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +drop table t1; +create table t1 (c1 longtext); +desc t1; +Field Type Null Key Default Extra +c1 longtext YES NULL +drop table t1; +create table t1 (c1 enum("yes","no")); +desc t1; +Field Type Null Key Default Extra +c1 enum('yes','no') YES NULL +drop table t1; +create table t1 (c1 set("A","B","AB","O")); +desc t1; +Field Type Null Key Default Extra +c1 set('A','B','AB','O') YES NULL +drop table t1; +create table t1 (c1 int, `_id` int) engine = mroonga; +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +_id int(11) YES NULL +drop table t1; +create table t1 (c1 int, `_score` float) engine = mroonga; +ERROR HY000: [column][create] name can't start with '_' and contains only 0-9, A-Z, a-z, #, @, - or _: <_score> +create table t1 (c1 int, `_id` text) engine = mroonga; +ERROR HY000: _id must be numeric data type +create table t1 (c1 int, `_id` int, index(`_id`)) engine = mroonga; +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, primary key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, primary key (_id) using hash); +drop table t1; +create table t1 (_id int, c1 int, unique key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, unique key (_id) using hash); +drop table t1; +create table t1 (_id int, c1 int, key (_id)); +ERROR HY000: only hash index can be defined for _id +create table t1 (_id int, c1 int, key (_id) using hash); +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result new file mode 100644 index 00000000000..edda98cd034 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_comment_normal.result @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED +) DEFAULT CHARSET=utf8 +COMMENT='Free style normal comment'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='Free style normal comment' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result new file mode 100644 index 00000000000..e14c67291cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_default_tokenizer.result @@ -0,0 +1,10 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create tags TABLE_PAT_KEY ShortText --default_tokenizer TokenDelimit +column_create tags name COLUMN_SCALAR ShortText +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index.result new file mode 100644 index 00000000000..e2d405a1e35 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_fulltext_index.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +day content +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); +day content +2013-04-23 ブラックコーヒーを飲んã ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.result new file mode 100644 index 00000000000..9d12e2d0e39 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES latin1; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerMySQLGeneralCI"' +) DEFAULT CHARSET=latin1; +INSERT INTO diaries VALUES ("2013-04-23", "I drunk a black cookie."); +ERROR HY000: [tokenizer] failed to open normalized string +SELECT * FROM diaries; +day content +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_table_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_table_comment.result new file mode 100644 index 00000000000..dbf69362ee7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_normalizer_table_comment.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +DROP TABLE IF EXISTS terms; +SET NAMES utf8; +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY +) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ"); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); +id content +1 1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔㌠+DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result new file mode 100644 index 00000000000..68a6bc8012f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_reference_type.result @@ -0,0 +1,16 @@ +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create tags TABLE_PAT_KEY ShortText +column_create tags name COLUMN_SCALAR ShortText +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 +column_create bugs tag COLUMN_SCALAR tags +DROP TABLE bugs; +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result new file mode 100644 index 00000000000..7d762258e6f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_multiple_token_filters.result @@ -0,0 +1,15 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_NO_KEY +column_create memos content COLUMN_SCALAR ShortText +table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result new file mode 100644 index 00000000000..6cc89a7b941 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_index_comment_one_token_filter.result @@ -0,0 +1,15 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_NO_KEY +column_create memos content COLUMN_SCALAR ShortText +table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create memos-content index COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result new file mode 100644 index 00000000000..fe7e0059250 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_multiple_token_filters.result @@ -0,0 +1,23 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord,TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText +table_create memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 +column_create terms content COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result new file mode 100644 index 00000000000..fe855b60f38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_token_filters_table_comment_one_token_filter.result @@ -0,0 +1,23 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create terms is_stop_word COLUMN_SCALAR Int8 +column_create terms term COLUMN_SCALAR ShortText +table_create memos TABLE_PAT_KEY Int32 +column_create memos content COLUMN_SCALAR LongText +column_create memos id COLUMN_SCALAR Int32 +column_create terms content COLUMN_INDEX|WITH_POSITION memos content +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result new file mode 100644 index 00000000000..561a266598f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_vector.result @@ -0,0 +1,10 @@ +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags TEXT COMMENT 'flags "COLUMN_VECTOR"' +) DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create bugs TABLE_PAT_KEY UInt32 +column_create bugs id COLUMN_SCALAR UInt32 +column_create bugs tags COLUMN_VECTOR LongText +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result new file mode 100644 index 00000000000..5fb52294758 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_fulltext_column.result @@ -0,0 +1,21 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +20 ka ki ku ke +delete from t1 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result new file mode 100644 index 00000000000..f318e1255fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_btree_many_records.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT, +KEY (id) +) DEFAULT CHARSET UTF8; +INSERT INTO ids VALUES(1); +INSERT INTO ids VALUES(2); +INSERT INTO ids VALUES(3); +SELECT * FROM ids ORDER BY id; +id +1 +2 +3 +DELETE FROM ids WHERE id = 1; +SELECT * FROM ids ORDER BY id; +id +2 +3 +DELETE FROM ids WHERE id = 2; +SELECT * FROM ids ORDER BY id; +id +3 +DELETE FROM ids WHERE id = 3; +SELECT * FROM ids ORDER BY id; +id +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result new file mode 100644 index 00000000000..76a4ed8835b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_no_unique.result @@ -0,0 +1,19 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +delete from t1 where _id = 2; +select * from t1; +_id c1 +1 100 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result new file mode 100644 index 00000000000..6307c55fcc0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_index_hash_id_unique.result @@ -0,0 +1,19 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +delete from t1 where _id = 2; +select * from t1; +_id c1 +1 100 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result new file mode 100644 index 00000000000..7503c0b801e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_normal_column.result @@ -0,0 +1,34 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +4 102 +delete from t1 where c1=3; +select * from t1; +c1 c2 +1 100 +2 101 +4 102 +flush tables; +delete from t1 where c1=2; +select * from t1; +c1 c2 +1 100 +4 102 +delete from t1; +select * from t1; +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result new file mode 100644 index 00000000000..23cc23eeef6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/delete_unsigned_bigint.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS numbers; +CREATE TABLE numbers ( +data BIGINT UNSIGNED +); +INSERT INTO numbers VALUES(18446744073709551615); +SELECT * FROM numbers ORDER BY data; +data +18446744073709551615 +DELETE FROM numbers WHERE data = 18446744073709551615; +SELECT * FROM numbers ORDER BY data; +data +DROP TABLE numbers; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..4bd97162a6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_database_TODO_SPLIT_ME.result @@ -0,0 +1,14 @@ +drop database if exists groonga; +create database groonga; +drop database groonga; +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop database groonga; +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop table t1, t2; +drop database groonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..99896765e28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/drop_table_TODO_SPLIT_ME.result @@ -0,0 +1,5 @@ +drop table if exists alphabet, `with-hyphen`; +create table alphabet (c1 int primary key, c2 int, c3 int); +drop table alphabet; +create table `with-hyphen` (c1 int primary key, c2 int, c3 int); +drop table `with-hyphen`; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result b/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result new file mode 100644 index 00000000000..449f6437501 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/flush_logs.result @@ -0,0 +1 @@ +flush logs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result new file mode 100644 index 00000000000..fc550d97f87 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/foreign_key_create.result @@ -0,0 +1,147 @@ +drop table if exists articles2; +drop table if exists articles; +drop table if exists comments2; +drop table if exists comments; +create table comments( +comment int unsigned, +content text not null, +primary key(comment) +); +create table articles( +content text not null, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +insert into comments (comment, content) values +(1, 'aaa bbb'),(2, 'ccc ddd'),(3, 'eee fff'); +insert into articles (content, comment) values +('111aaa', 1),('222bbb', 2),('222ccc', 2); +select comment, content from comments; +comment content +1 aaa bbb +2 ccc ddd +3 eee fff +select content, comment from articles; +content comment +111aaa 1 +222bbb 2 +222ccc 2 +show create table comments; +Table Create Table +comments CREATE TABLE `comments` ( + `comment` int(10) unsigned NOT NULL DEFAULT '0', + `content` text NOT NULL, + PRIMARY KEY (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +select * from information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments +rename table comments to comments2; +rename table articles to articles2; +create table comments( +comment int unsigned, +content text not null, +primary key(comment) +); +create table articles( +content text not null, +comment int unsigned, +FOREIGN KEY (comment) REFERENCES comments (comment) +); +insert into comments (comment, content) values +(1, 'ab'),(2, 'cd'),(3, 'ef'); +insert into articles (content, comment) values +('1a', 1),('2b', 2),('2c', 2); +select comment, content from comments; +comment content +1 ab +2 cd +3 ef +select content, comment from articles; +content comment +1a 1 +2b 2 +2c 2 +select comment, content from comments2; +comment content +1 aaa bbb +2 ccc ddd +3 eee fff +select content, comment from articles2; +content comment +111aaa 1 +222bbb 2 +222ccc 2 +show create table comments; +Table Create Table +comments CREATE TABLE `comments` ( + `comment` int(10) unsigned NOT NULL DEFAULT '0', + `content` text NOT NULL, + PRIMARY KEY (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +show create table comments2; +Table Create Table +comments2 CREATE TABLE `comments2` ( + `comment` int(10) unsigned NOT NULL DEFAULT '0', + `content` text NOT NULL, + PRIMARY KEY (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +show create table articles2; +Table Create Table +articles2 CREATE TABLE `articles2` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments2` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +select * from information_schema.referential_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE TABLE_NAME REFERENCED_TABLE_NAME +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles comments +def test comment def test PRIMARY NONE RESTRICT RESTRICT articles2 comments2 +alter table articles drop foreign key comment; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +select content, comment from articles; +content comment +1a 1 +2b 2 +2c 2 +alter table articles add FOREIGN KEY (comment) REFERENCES comments (comment); +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `content` text NOT NULL, + `comment` int(10) unsigned DEFAULT NULL, + KEY `comment` (`comment`), + CONSTRAINT `comment` FOREIGN KEY (`comment`) REFERENCES `test`.`comments` (`comment`) ON DELETE RESTRICT ON UPDATE RESTRICT +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +select content, comment from articles; +content comment +1a 1 +2b 2 +2c 2 +drop table articles2; +drop table articles; +drop table comments2; +drop table comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result new file mode 100644 index 00000000000..96c6ae4150c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_empty_query.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST("" IN BOOLEAN MODE); +title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result new file mode 100644 index 00000000000..a48eb25dece --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_escape.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("\\(groonga\\)*" IN BOOLEAN MODE); +id content +1 (groonga) Installed! +3 (groonga) Upgraded! +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result new file mode 100644 index 00000000000..d0e1a68f76b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_leading_not.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); +id title content +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result new file mode 100644 index 00000000000..d10b5dad815 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); +content +Yesterday was fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result new file mode 100644 index 00000000000..82c7e799fd4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); +content +Today is good day. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result new file mode 100644 index 00000000000..c4c7b0e8546 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); +content +Today is good day. +Yesterday was good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result new file mode 100644 index 00000000000..f45e8fd4fb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE); +content +Today is good day. +Today is fine. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result new file mode 100644 index 00000000000..103866902c2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE); +content +Tomorrow will be good day. +Today is fine. +Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result new file mode 100644 index 00000000000..fd52868b4bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE); +content +Today is good day. +Tomorrow will be good day. +Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result new file mode 100644 index 00000000000..4d1f65923c4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); +content +Today is good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result new file mode 100644 index 00000000000..deda6f3bb1a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); +content +Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result new file mode 100644 index 00000000000..2d25388fada --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); +content +Today is good day. +Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result new file mode 100644 index 00000000000..b8f15d9847e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_full_spec.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠12 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result new file mode 100644 index 00000000000..42aa068a547 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_no_weight.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠3 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result new file mode 100644 index 00000000000..c73d2660d54 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_omit_section.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠3 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result new file mode 100644 index 00000000000..b1b9d5f4f41 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +title VARCHAR(255), +tag1 VARCHAR(10), +tag2 VARCHAR(10), +tag3 VARCHAR(10), +tag4 VARCHAR(10), +tag5 VARCHAR(10), +tag6 VARCHAR(10), +tag7 VARCHAR(10), +tag8 VARCHAR(10), +tag9 VARCHAR(10), +tag10 VARCHAR(10), +FULLTEXT INDEX (tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +) DEFAULT CHARSET=utf8; +INSERT INTO memos +VALUES("Groonga", +"tag 1", +"tag 2", +"tag 3", +"tag 4", +"tag 5", +"tag 6", +"tag 7", +"tag 8", +"tag 9", +"tag 10"); +SELECT title, +MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE) AS score +FROM memos +WHERE MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE); +title score +Groonga 110 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result new file mode 100644 index 00000000000..02db17e61da --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_pragma_weight_three_or_more_sections.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +category VARCHAR(10), +content TEXT, +FULLTEXT INDEX (title, category, content) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES(1, "Hello", "日記", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気予報", "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "天気", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, category, content) +AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, category, content) +AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE); +id title category content score +2 天気予報 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠13 +3 富士山 天気 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 11 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result new file mode 100644 index 00000000000..5746ce89cb7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result new file mode 100644 index 00000000000..1811994b67e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_error_and_log.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +ERROR 42000: failed to parse fulltext search keyword: <(groonga>: > +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result new file mode 100644 index 00000000000..6a4759963a3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = "IGNORE"; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +id content +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result new file mode 100644 index 00000000000..384d677c427 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_boolean_mode_syntax_error_ignore_and_log.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS memos; +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT PRIMARY KEY, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); +id content +DROP TABLE memos; +SET GLOBAL mroonga_default_parser = TokenBigram; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result new file mode 100644 index 00000000000..c542ba1adae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_ascii.result @@ -0,0 +1,29 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii"); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result new file mode 100644 index 00000000000..bd208d520c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_cp932.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä","‚ ‚ ‚ ‚ ‚ ‚ ‚ "); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä ‚ ‚ ‚ ‚ ‚ ‚ ‚  +2 ‚¢‚¢‚¢‚¢‚¢ –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ +3 dummy dummy +select * from t1 where match(c2) against("•xŽmŽR"); +c1 c2 c3 +1 –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä ‚ ‚ ‚ ‚ ‚ ‚ ‚  +select * from t1 where match(c3) against("•xŽmŽR"); +c1 c2 c3 +2 ‚¢‚¢‚¢‚¢‚¢ –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result new file mode 100644 index 00000000000..51360875cf1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_eucjpms.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ","¤¢¤¢¤¢¤¢¤¢¤¢¤¢"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ ¤¢¤¢¤¢¤¢¤¢¤¢¤¢ +2 ¤¤¤¤¤¤¤¤¤¤ ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó +3 dummy dummy +select * from t1 where match(c2) against("Éٻλ³"); +c1 c2 c3 +1 ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ ¤¢¤¢¤¢¤¢¤¢¤¢¤¢ +select * from t1 where match(c3) against("Éٻλ³"); +c1 c2 c3 +2 ¤¤¤¤¤¤¤¤¤¤ ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result new file mode 100644 index 00000000000..cfff3f2e29b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_japanese.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +3 dummy dummy +select * from t1 where match(c2) against("富士山"); +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +select * from t1 where match(c3) against("富士山"); +c1 c2 c3 +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result new file mode 100644 index 00000000000..31d45181c96 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_charset_utf8mb4.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8mb4; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci, +content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, +FULLTEXT INDEX (content) +) DEFAULT CHARSET utf8mb4; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4 +INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); +INSERT INTO diaries VALUES(2, "Mathmatics", "ð€ðð‚ðƒð„ | U+1D400-U+1D405"); +INSERT INTO diaries VALUES(3, "ã²ã‚‰ãŒãª", "ã‚ã„ã†ãˆãŠ"); +SELECT * +FROM diaries +WHERE MATCH (content) AGAINST("ABCDE" IN BOOLEAN MODE); +id title content +1 Alphabet ABCDE +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result new file mode 100644 index 00000000000..bb7b3b63752 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_empty_query.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST(""); +title +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result new file mode 100644 index 00000000000..c107991d151 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_found_rows.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT SQL_CALC_FOUND_ROWS * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +6 2011 12 2 åˆé›ª 今日ã®å¤©æ°—ã¯é›ªï¼ +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SELECT FOUND_ROWS(); +FOUND_ROWS() +6 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result new file mode 100644 index 00000000000..a23d8e5b542 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_groonga_varchar_vector.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS bugs, tags; +CREATE TABLE tags ( +name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COLLATE=utf8_bin +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tags VARCHAR(40) COMMENT 'type "tags", flags "COLUMN_VECTOR"', +FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL groonga"); +INSERT INTO bugs (id, tags) VALUES (3, "mroonga"); +SELECT * +FROM bugs +WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); +id tags +1 Linux MySQL +2 MySQL groonga +DROP TABLE bugs, tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result new file mode 100644 index 00000000000..04996d30f36 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_index_recreate.result @@ -0,0 +1,41 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +drop index title on diaries; +select * from diaries where match(title) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +create fulltext index new_title_index on diaries (title); +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result new file mode 100644 index 00000000000..6c268ff7641 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_select.result @@ -0,0 +1,66 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +c1 c2 +3 aa ii ii ii oo +5 ta ti ii ii to +1 aa ii uu ee oo +select * from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +c1 c2 +1 aa ii uu ee oo +5 ta ti ii ii to +3 aa ii ii ii oo +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +select c1,c2,match(c2) against("ii") from t2 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +drop table t1,t2; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result new file mode 100644 index 00000000000..623c66daaf4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_insert_values.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` text, + PRIMARY KEY (`c1`), + FULLTEXT KEY `ft` (`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result new file mode 100644 index 00000000000..843c4b958ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_delete.result @@ -0,0 +1,34 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(content) against("富士山"); +id title content +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result new file mode 100644 index 00000000000..3856d7ecc10 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_insert.result @@ -0,0 +1,40 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result new file mode 100644 index 00000000000..59b26574c73 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_recreate.result @@ -0,0 +1,42 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +drop index title on diaries; +select * from diaries where match(title, content) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result new file mode 100644 index 00000000000..d17ff6adf83 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_column_index_update.result @@ -0,0 +1,37 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +update diaries set title = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒž" where id = 3; +update diaries set content = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±±" where id = 1; +select * from diaries where match(title, content) against("富士山"); +id title content +1 Hello ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±± +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+select * from diaries where match(title) against("富士山"); +id title content +select * from diaries where match(content) against("富士山"); +id title content +1 Hello ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±± +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result new file mode 100644 index 00000000000..81b40261a4c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_multiple_index.result @@ -0,0 +1,33 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +title text, +body text, +fulltext index title_index (title), +fulltext index body_index (body) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); +select * from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body +1 survey will start groonga! +select *, match(title) against("survey"), match(body) against("groonga") +from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body match(title) against("survey") match(body) against("groonga") +1 survey will start groonga! 1048577 149797 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result new file mode 100644 index 00000000000..5f85632575b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_no_primary_key.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `title` varchar(255) DEFAULT NULL, + `content` text, + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES("Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES("天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES("富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("*D+ 今日 天気" IN BOOLEAN MODE); +title content +富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result new file mode 100644 index 00000000000..2c1666369a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_not_match_against.result @@ -0,0 +1,68 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where match(c3) against("uu"); +c1 c2 c3 +1 10 aa ii uu ee oo +3 10 aa ii uu ee oo +5 20 aa ii uu ee oo +7 20 aa ii uu ee oo +select * from t1 where not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where match(c3) against("dummy"); +c1 c2 c3 +select * from t1 where not match(c3) against("dummy"); +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("uu"); +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result new file mode 100644 index 00000000000..f1f7888ceeb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_or.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT * +FROM diaries +WHERE MATCH(title) AGAINST("Ruby" IN BOOLEAN MODE) OR +MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +title +Start mroonga +Start groonga and Ruby +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_against.result new file mode 100644 index 00000000000..d1f0d6bc0ab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_against.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga mroonga" IN BOOLEAN MODE) +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start mroonga 0 +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_match.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_match.result new file mode 100644 index 00000000000..b4a07cd0b66 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_different_match.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +body TEXT, +FULLTEXT KEY (title), +FULLTEXT KEY (body) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga", "I read groonga's tutorial."); +INSERT INTO diaries VALUES("Start mroonga", "I read mroonga's tutorial."); +INSERT INTO diaries VALUES("Start groonga and Ruby", "I installed rroonga."); +SELECT * FROM diaries; +title body +Start groonga I read groonga's tutorial. +Start mroonga I read mroonga's tutorial. +Start groonga and Ruby I installed rroonga. +SELECT *, MATCH(body) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) +ORDER BY MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +title body score +Start groonga and Ruby I installed rroonga. 0 +Start groonga I read groonga's tutorial. 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_no_where.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_no_where.result new file mode 100644 index 00000000000..125b35fb96e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_no_where.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start mroonga 0 +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_same_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_same_match_against.result new file mode 100644 index 00000000000..a3a668c4445 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_order_same_match_against.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT * FROM diaries; +title +Start groonga +Start mroonga +Start groonga and Ruby +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) +ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); +title score +Start groonga 1 +Start groonga and Ruby 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result new file mode 100644 index 00000000000..f2abfe85dd6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_comment.result @@ -0,0 +1,29 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +select * from diaries where match(body) against("start"); +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result new file mode 100644 index 00000000000..6c04cae59f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_default.result @@ -0,0 +1,33 @@ +drop table if exists diaries; +set @mroonga_default_parser_backup=@@mroonga_default_parser; +set global mroonga_default_parser=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +insert into diaries (body) values ("finished groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +4 finished groonga. +select * from diaries where match(body) against("start"); +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +drop table diaries; +set global mroonga_default_parser=@mroonga_default_parser_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result new file mode 100644 index 00000000000..77765f61dc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_parser_off.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS variables; +CREATE TABLE variables ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +FULLTEXT INDEX (name) COMMENT 'parser "off"' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE variables; +Table Create Table +variables CREATE TABLE `variables` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `name` (`name`) COMMENT 'parser "off"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +INSERT INTO variables (name) VALUES ("mroonga_default_parser"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); +SELECT * FROM variables; +id name +1 mroonga_database_path_prefix +2 mroonga_default_parser +3 mroonga_default_wrapper_engine +4 mroonga_dry_write +5 mroonga_enable_optimization +6 mroonga_libgroonga_version +7 mroonga_log_file +8 mroonga_log_level +9 mroonga_match_escalation_threshold +10 mroonga_version +SELECT * FROM variables +WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); +id name +3 mroonga_default_wrapper_engine +2 mroonga_default_parser +DROP TABLE variables; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result new file mode 100644 index 00000000000..290f96df35d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_token_filters_skip.result @@ -0,0 +1,23 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +CREATE TABLE terms ( +term VARCHAR(64) NOT NULL PRIMARY KEY, +is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content TEXT NOT NULL, +FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; +INSERT INTO terms VALUES ("and", true); +INSERT INTO memos VALUES (1, "Hello"); +INSERT INTO memos VALUES (2, "Hello and Good-bye"); +INSERT INTO memos VALUES (3, "Good-bye"); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("+\"Hello and\"" IN BOOLEAN MODE); +id content +1 Hello +2 Hello and Good-bye +DROP TABLE memos; +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result new file mode 100644 index 00000000000..e39790ed5be --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_two_inner_join.result @@ -0,0 +1,41 @@ +DROP TABLE IF EXISTS users, posts, comments; +SET NAMES utf8; +CREATE TABLE users ( +id int NOT NULL, +name varchar(50) NOT NULL, +PRIMARY KEY (id), +KEY (name) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE posts ( +id int NOT NULL, +content mediumtext, +user_id int NOT NULL, +PRIMARY KEY (id), +FULLTEXT KEY (content) +) DEFAULT CHARSET=utf8; +CREATE TABLE comments ( +id int NOT NULL, +user_id int NOT NULL, +post_id int NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"), +(2, "Bob"), +(3, "Calros"); +INSERT INTO posts VALUES (1, "Hello!", 1), +(2, "World!", 2), +(3, "Great!", 3); +INSERT INTO comments VALUES (1, 1, 1), +(2, 2, 1), +(3, 3, 3); +SELECT * +FROM comments +INNER JOIN posts +ON posts.id = comments.post_id AND +MATCH (posts.content) AGAINST ("Hello!" IN BOOLEAN MODE) +INNER JOIN users +ON users.id = comments.user_id AND +users.name = "Alice"; +id user_id post_id id content user_id id name +1 1 1 1 Hello! 1 1 Alice +DROP TABLE users, posts, comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_100_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_100_no_such_key.result new file mode 100644 index 00000000000..d3ac2387586 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_100_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_55_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_55_no_such_key.result new file mode 100644 index 00000000000..5f7bc98a3d3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_55_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +id title body +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_56_no_such_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_56_no_such_key.result new file mode 100644 index 00000000000..d3ac2387586 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/fulltext_version_56_no_such_key.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries FORCE INDEX(primary) +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result new file mode 100644 index 00000000000..1551d32c971 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_command_select.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT mroonga_command('select diaries --match_columns "title" --query "groonga"'); +mroonga_command('select diaries --match_columns "title" --query "groonga"') +[[[2],[["_id","UInt32"],["title","LongText"]],[1,"Start groonga"],[3,"Start groonga and Ruby"]]] +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result new file mode 100644 index 00000000000..98213e81eb9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_missing.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape() AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): Incorrect number of arguments: 0 for 1..2 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result new file mode 100644 index 00000000000..c1762458199 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_query_is_not_string.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape(29) AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 1st argument must be query as string diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result new file mode 100644 index 00000000000..77dc420f0c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_error_target_characters_is_not_string.result @@ -0,0 +1,3 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:', 29) AS escaped_query; +ERROR HY000: Can't initialize function 'mroonga_escape'; mroonga_escape(): The 2st argument must be escape target characters as string diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_all.result new file mode 100644 index 00000000000..b002262a83f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_all.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:') AS escaped_query; +escaped_query +\+\-\>\<\~\*\(\)\"\\\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_custom.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_custom.result new file mode 100644 index 00000000000..c2e7d8f50ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_custom.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_escape('+-><~*()\"\\:', '()<>~') AS escaped_query; +escaped_query ++-\>\<\~*\(\)"\: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_nested.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_nested.result new file mode 100644 index 00000000000..5a57c144891 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_escape_success_nested.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries( +title TEXT, +FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); +SELECT mroonga_escape(mroonga_escape('*groonga*')); +mroonga_escape(mroonga_escape('*groonga*')) +\\\*groonga\\\* +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result new file mode 100644 index 00000000000..42064b7f189 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_grn_id.result @@ -0,0 +1,28 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int); +select last_insert_grn_id(); +last_insert_grn_id() +0 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +2 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +4 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +6 +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +last_insert_grn_id() +8 +select last_insert_grn_id(1); +ERROR HY000: Can't initialize function 'last_insert_grn_id'; last_insert_grn_id must not have arguments +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result new file mode 100644 index 00000000000..b0db86cb5ec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_reference.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +); +SELECT last_insert_id(); +last_insert_id() +0 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result new file mode 100644 index 00000000000..ec6f2f98462 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_last_insert_id_set.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +); +SELECT last_insert_id(); +last_insert_id() +0 +SELECT last_insert_id(10); +last_insert_id(10) +10 +SELECT last_insert_id(); +last_insert_id() +10 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result new file mode 100644 index 00000000000..5766f822ee3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_ascii.result @@ -0,0 +1,120 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa bb cc dd ee >< ff gg hh ii jj kk ll mm nn"); +insert into t1 values(2,20,"nn mm ll kk jj >< ii hh gg ff ee dd cc bb aa"); +insert into t1 values(3,30,"cc dd ee ff gg >< hh ii jj kk ll mm nn oo pp"); +insert into t1 values(4,40,"ee ff gg hh ii >< jj kk ll mm nn oo pp qq rr"); +insert into t1 values(5,50,"AA BB CC DD EE >< FF GG HH II JJ KK LL MM NN"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ...a bb cc dd...
+...e >< ff gg...
+ +2 20 ...g ff ee dd...
+... cc bb aa...
+ +3 30 ...c dd ee ff...
+ +4 40 ...ee ff gg h...
+ +5 50 ...A BB CC DD...
+...E >< FF GG...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 ... BB CC DD ...
+... >< FF GG ...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') +1 10 ... bb cc dd ...
+... >< ff gg ...
+ +2 20 ... ff ee dd ...
+...cc bb aa...
+ +3 30 ... dd ee ff ...
+ +4 40 ...ee ff gg h...
+ +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ...a(w1)[ bb] cc(w3)[ dd]... +...e ><(w2)[ ff] gg... + +2 20 ...g(w2)[ ff] ee(w3)[ dd]... +... cc(w1)[ bb] aa... + +3 30 ...c(w3)[ dd] ee(w2)[ ff]... + +4 40 ...ee(w2)[ ff] gg h... + +5 50 ...A(w1)[ BB] CC(w3)[ DD]... +...E ><(w2)[ FF] GG... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 ... (w1)[BB] CC (w3)[DD] ... +... >< (w2)[FF] GG ... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') +1 10 ... (w1)[bb] cc (w3)[dd] ... +... >< (w2)[ff] gg ... + +2 20 ... (w2)[ff] ee (w3)[dd] ... +...cc (w1)[bb] aa... + +3 30 ... (w3)[dd] ee (w2)[ff] ... + +4 40 ...ee (w2)[ff] gg h... + +5 50 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result new file mode 100644 index 00000000000..a21157a0a18 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_cp932.result @@ -0,0 +1,91 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "‚ ‚ ‚ ‚ ‚ ","‚Q‚X“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä"); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","‚Q‚X“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "‚¤‚¤‚¤‚¤‚¤","29“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') +1 ‚ ‚ ‚ ‚ ‚  ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚É‚Â...
+ +2 ‚¢‚¢‚¢‚¢‚¢ ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚Í•ª...
+ +3 ‚¤‚¤‚¤‚¤‚¤ ...29“ú‚Ì•xŽm...
+...‚Ì“V‹C‚É‚Â...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') +1 ‚ ‚ ‚ ‚ ‚  ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚É‚Â...
+ +2 ‚¢‚¢‚¢‚¢‚¢ ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚Í•ª...
+ +3 ‚¤‚¤‚¤‚¤‚¤ ...‚Ì•xŽmŽR‚Ì...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') +1 ‚ ‚ ‚ ‚ ‚  ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚É‚Â...
+ +2 ‚¢‚¢‚¢‚¢‚¢ ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚Í•ª...
+ +3 ‚¤‚¤‚¤‚¤‚¤ ...29“ú‚Ì•xŽm...
+...‚Ì“V‹C‚É‚Â...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') +1 ‚ ‚ ‚ ‚ ‚  ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚É‚Â...
+ +2 ‚¢‚¢‚¢‚¢‚¢ ...‚Q‚X“ú‚Ì•x...
+...‚Ì“V‹C‚Í•ª...
+ +3 ‚¤‚¤‚¤‚¤‚¤ ...‚Ì•xŽmŽR‚Ì...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') +1 ‚ ‚ ‚ ‚ ‚  ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚É‚Â... + +2 ‚¢‚¢‚¢‚¢‚¢ ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚Í•ª... + +3 ‚¤‚¤‚¤‚¤‚¤ ...(w1)[29“ú]‚Ì•xŽm... +...‚Ì(w2)[“V‹C]‚É‚Â... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') +1 ‚ ‚ ‚ ‚ ‚  ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚É‚Â... + +2 ‚¢‚¢‚¢‚¢‚¢ ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚Í•ª... + +3 ‚¤‚¤‚¤‚¤‚¤ ...‚Ì(w3)[•xŽmŽR]‚Ì... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') +1 ‚ ‚ ‚ ‚ ‚  ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚É‚Â... + +2 ‚¢‚¢‚¢‚¢‚¢ ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚Í•ª... + +3 ‚¤‚¤‚¤‚¤‚¤ ...(w1)[29“ú]‚Ì•xŽm... +...‚Ì(w2)[“V‹C]‚É‚Â... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') +1 ‚ ‚ ‚ ‚ ‚  ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚É‚Â... + +2 ‚¢‚¢‚¢‚¢‚¢ ...(w1)[‚Q‚X“ú]‚Ì•x... +...‚Ì(w2)[“V‹C]‚Í•ª... + +3 ‚¤‚¤‚¤‚¤‚¤ ...‚Ì(w3)[•xŽmŽR]‚Ì... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result new file mode 100644 index 00000000000..e4c6a41773e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_eucjpms.result @@ -0,0 +1,91 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "¤¢¤¢¤¢¤¢¤¢","£²£¹Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","£²£¹Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "¤¦¤¦¤¦¤¦¤¦","29Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') +1 ¤¢¤¢¤¢¤¢¤¢ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +2 ¤¤¤¤¤¤¤¤¤¤ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ïʬ...
+ +3 ¤¦¤¦¤¦¤¦¤¦ ...29Æü¤ÎÉÙ»Î...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') +1 ¤¢¤¢¤¢¤¢¤¢ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +2 ¤¤¤¤¤¤¤¤¤¤ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ïʬ...
+ +3 ¤¦¤¦¤¦¤¦¤¦ ...¤ÎÉٻ볤Î...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') +1 ¤¢¤¢¤¢¤¢¤¢ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +2 ¤¤¤¤¤¤¤¤¤¤ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ïʬ...
+ +3 ¤¦¤¦¤¦¤¦¤¦ ...29Æü¤ÎÉÙ»Î...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') +1 ¤¢¤¢¤¢¤¢¤¢ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ë¤Ä...
+ +2 ¤¤¤¤¤¤¤¤¤¤ ...£²£¹Æü¤ÎÉÙ...
+...¤ÎÅ·µ¤¤Ïʬ...
+ +3 ¤¦¤¦¤¦¤¦¤¦ ...¤ÎÉٻ볤Î...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') +1 ¤¢¤¢¤¢¤¢¤¢ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +2 ¤¤¤¤¤¤¤¤¤¤ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ïʬ... + +3 ¤¦¤¦¤¦¤¦¤¦ ...(w1)[29Æü]¤ÎÉÙ»Î... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') +1 ¤¢¤¢¤¢¤¢¤¢ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +2 ¤¤¤¤¤¤¤¤¤¤ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ïʬ... + +3 ¤¦¤¦¤¦¤¦¤¦ ...¤Î(w3)[Éٻλ³]¤Î... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') +1 ¤¢¤¢¤¢¤¢¤¢ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +2 ¤¤¤¤¤¤¤¤¤¤ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ïʬ... + +3 ¤¦¤¦¤¦¤¦¤¦ ...(w1)[29Æü]¤ÎÉÙ»Î... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') +1 ¤¢¤¢¤¢¤¢¤¢ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ë¤Ä... + +2 ¤¤¤¤¤¤¤¤¤¤ ...(w1)[£²£¹Æü]¤ÎÉÙ... +...¤Î(w2)[Å·µ¤]¤Ïʬ... + +3 ¤¦¤¦¤¦¤¦¤¦ ...¤Î(w3)[Éٻλ³]¤Î... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result new file mode 100644 index 00000000000..78cee62696f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_nonexistent_charset.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_snippet("Invalid charset test", 10, 2, "nonexistent_charset", +1, 0, "...", "...", "charset", "<", ">"); +ERROR HY000: Can't initialize function 'mroonga_snippet'; Unknown charset: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result new file mode 100644 index 00000000000..bf967adbf46 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_invalid_unsupported_charset.result @@ -0,0 +1,4 @@ +SET NAMES UTF8; +SELECT mroonga_snippet("Unsuppported charset test", 10, 2, "big5", +1, 0, "...", "...", "charset", "<", ">"); +ERROR HY000: Can't initialize function 'mroonga_snippet'; Unknown charset: diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result new file mode 100644 index 00000000000..05a63a3d597 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/function_snippet_japanese.result @@ -0,0 +1,95 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "ã‚ã‚ã‚ã‚ã‚","29日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","29日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "ã†ã†ã†ã†ã†","29æ—¥ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 ã‚ã‚ã‚ã‚ã‚ ...29日...
+...富士山...
+ +2 ã„ã„ã„ã„ã„ ...29日...
+...富士山...
+ +3 ã†ã†ã†ã†ã† ...29æ—¥ã®...
+...天気ã«...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 ã‚ã‚ã‚ã‚ã‚ ...29日...
+...富士山...
+ +2 ã„ã„ã„ã„ã„ ...29日...
+...富士山...
+ +3 ã†ã†ã†ã†ã† ...富士山...
+...天気ã«...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 ã‚ã‚ã‚ã‚ã‚ ...29日...
+...富士山...
+ +2 ã„ã„ã„ã„ã„ ...29日...
+...富士山...
+ +3 ã†ã†ã†ã†ã† ...29æ—¥ã®...
+...天気ã«...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') +1 ã‚ã‚ã‚ã‚ã‚ ...29日...
+...富士山...
+ +2 ã„ã„ã„ã„ã„ ...29日...
+...富士山...
+ +3 ã†ã†ã†ã†ã† ...富士山...
+...天気ã«...
+ +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 ã‚ã‚ã‚ã‚ã‚ ...(w1)[29日]... +...(w3)[富士山]... + +2 ã„ã„ã„ã„ã„ ...(w1)[29日]... +...(w3)[富士山]... + +3 ã†ã†ã†ã†ã† ...(w1)[29æ—¥]ã®... +...(w2)[天気]ã«... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 ã‚ã‚ã‚ã‚ã‚ ...(w1)[29日]... +...(w3)[富士山]... + +2 ã„ã„ã„ã„ã„ ...(w1)[29日]... +...(w3)[富士山]... + +3 ã†ã†ã†ã†ã† ...(w3)[富士山]... +...(w2)[天気]ã«... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 ã‚ã‚ã‚ã‚ã‚ ...(w1)[29日]... +...(w3)[富士山]... + +2 ã„ã„ã„ã„ã„ ...(w1)[29日]... +...(w3)[富士山]... + +3 ã†ã†ã†ã†ã† ...(w1)[29æ—¥]ã®... +...(w2)[天気]ã«... + +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +c1 c2 mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') +1 ã‚ã‚ã‚ã‚ã‚ ...(w1)[29日]... +...(w3)[富士山]... + +2 ã„ã„ã„ã„ã„ ...(w1)[29日]... +...(w3)[富士山]... + +3 ã†ã†ã†ã†ã† ...(w3)[富士山]... +...(w2)[天気]ã«... + +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result new file mode 100644 index 00000000000..2e9314db109 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_bulk_insert_null.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +location GEOMETRY NOT NULL +); +INSERT INTO shops VALUES (NULL), (NULL); +Warnings: +Warning 1048 Column 'location' cannot be null +Warning 1048 Column 'location' cannot be null +SELECT AsText(location) FROM shops; +AsText(location) +POINT(0 0) +POINT(0 0) +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result new file mode 100644 index 00000000000..e88402a10b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result @@ -0,0 +1,170 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL, +SPATIAL KEY location_index (location) +); +SHOW CREATE TABLE shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +GeomFromText('POINT(139.711517 35.647701)')); +SELECT id, name, AsText(location) AS location_text FROM shops; +id name location_text +1 nezu-no-taiyaki POINT(139.76257305555555 35.72025305555556) +2 taiyaki-kataoka POINT(139.7155911111111 35.712521111111116) +3 soba-taiyaki-ku POINT(139.65908805555557 35.68371194444445) +4 kuruma POINT(139.70620694444446 35.72151611111111) +5 hirose-ya POINT(139.68560805555555 35.71484388888889) +6 sazare POINT(139.68504305555555 35.71465305555556) +7 omede-taiyaki POINT(139.8171538888889 35.70051611111111) +8 onaga-ya POINT(139.81105 35.69825388888889) +9 shiro-ya POINT(139.63861111111112 35.70551694444445) +10 fuji-ya POINT(139.637115 35.703938055555554) +11 miyoshi POINT(139.53732305555556 35.644538888888896) +12 juju-ya POINT(139.69575500000002 35.62892194444445) +13 tatsumi-ya POINT(139.63865694444445 35.66550111111111) +14 tetsuji POINT(139.76857 35.680911944444446) +15 gazuma-ya POINT(139.64759805555553 35.70081694444444) +16 honma-mon POINT(139.65257305555556 35.72273611111111) +17 naniwa-ya POINT(139.79623388888888 35.73006111111111) +18 kuro-dai POINT(139.70483388888888 35.650345) +19 daruma POINT(139.7705988888889 35.68146111111111) +20 yanagi-ya POINT(139.78398111111113 35.685341111111114) +21 sharaku POINT(139.79484611111113 35.71696888888889) +22 takane POINT(139.56091305555555 35.69860111111112) +23 chiyoda POINT(139.65281694444442 35.64260111111111) +24 da-ka-po POINT(139.72735611111113 35.62734611111111) +25 matsushima-ya POINT(139.73738111111112 35.64055611111111) +26 kazuya POINT(139.760895 35.67350805555556) +27 furuya-kogane-an POINT(139.67607111111113 35.68060305555556) +28 hachi-no-ie POINT(139.66810611111111 35.608021111111114) +29 azuki-chan POINT(139.67320305555555 35.641510000000004) +30 kuriko-an POINT(139.79682888888888 35.71201305555556) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.71252388888888 35.61619888888889) +32 naze-ya POINT(139.66583305555557 35.60903888888889) +33 sanoki-ya POINT(139.7707211111111 35.66592) +34 shigeta POINT(139.78027305555557 35.67262611111111) +35 nishimi-ya POINT(139.77462805555555 35.671825) +36 hiiragi POINT(139.71151694444444 35.64770111111111) +SELECT id, name, AsText(location) AS location_text FROM shops +WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) +ORDER BY id; +id name location_text +14 tetsuji POINT(139.76857 35.680911944444446) +19 daruma POINT(139.7705988888889 35.68146111111111) +26 kazuya POINT(139.760895 35.67350805555556) +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result new file mode 100644 index 00000000000..78ed69f0ef8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_datetime.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +created_at datetime, +title varchar(256), +KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); +SELECT * +FROM diaries FORCE INDEX(created_at_key) +WHERE created_at = "2012-10-25 16:18:29"; +created_at title +2012-10-25 16:18:29 Today is shiny day. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result new file mode 100644 index 00000000000..a55a184d17a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_time.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS timer; +CREATE TABLE timer ( +id int PRIMARY KEY, +elapsed time, +KEY elapsed_key(elapsed) +); +INSERT INTO timer VALUES (1, "00:00:00"); +INSERT INTO timer VALUES (2, "15:11:12"); +INSERT INTO timer VALUES (3, "838:59:59"); +INSERT INTO timer VALUES (4, "-838:59:59"); +SELECT * +FROM timer FORCE INDEX(elapsed_key) +WHERE elapsed = "-838:59:59"; +id elapsed +4 -838:59:59 +DROP TABLE timer; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result new file mode 100644 index 00000000000..57eb6ae2cee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_equal_timestamp.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +created_at timestamp, +title varchar(256), +KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES ("1970-01-01 12:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-05 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("2038-01-18 15:14:07", "The end"); +SELECT * +FROM diaries FORCE INDEX(created_at_key) +WHERE created_at = "2012-10-05 16:18:29"; +created_at title +2012-10-05 16:18:29 Today is shiny day. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result new file mode 100644 index 00000000000..043d1e3c1bc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_btree_normal_column_insert.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, index using btree (c2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) USING BTREE +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +flush tables; +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result new file mode 100644 index 00000000000..5f92c086ea3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_normal.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, a int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id a +1 100 +2 100 +3 100 +4 100 +select * from t1 where _id = 2; +_id a +2 100 +select * from t1 where _id = 20; +_id a +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result new file mode 100644 index 00000000000..508ee135ef2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_primary.result @@ -0,0 +1,28 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, a int, primary key (_id) using hash); +insert into t1 values(null, 100); +ERROR 23000: Column '_id' cannot be null +insert into t1 values(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +insert into t1 values(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +insert into t1 values(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +insert into t1 values(1,100); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +select * from t1; +_id a +1 100 +2 100 +3 100 +4 100 +select * from t1 where _id = 2; +_id a +2 100 +select * from t1 where _id = 20; +_id a +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result new file mode 100644 index 00000000000..1a30a1ecbf4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_id_unique.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, a int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id a +1 100 +2 100 +3 100 +4 100 +select * from t1 where _id = 2; +_id a +2 100 +select * from t1 where _id = 20; +_id a +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result new file mode 100644 index 00000000000..6e642ce1272 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_hash_normal_column_insert.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, index using hash (c2)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `c2` (`c2`) USING HASH +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +flush tables; +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result new file mode 100644 index 00000000000..c680a3733f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_delete.result @@ -0,0 +1,32 @@ +drop table if exists listing; +set names utf8; +create table scores ( +id int primary key auto_increment not null, +name char(30) not null, +score int not null, +index property (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +id name score +2 Taro Yamada -12 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result new file mode 100644 index 00000000000..a627f432068 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_smallint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 SMALLINT, +c2 SMALLINT, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` smallint(6) DEFAULT NULL, + `c2` smallint(6) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result new file mode 100644 index 00000000000..368f88a64e1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_bigint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 BIGINT UNSIGNED, +c2 BIGINT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` bigint(20) unsigned DEFAULT NULL, + `c2` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result new file mode 100644 index 00000000000..6d5516f7eea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_int.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 INT UNSIGNED, +c2 INT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` int(10) unsigned DEFAULT NULL, + `c2` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result new file mode 100644 index 00000000000..b0edfb9eea1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_unsigned_smallint.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 SMALLINT UNSIGNED, +c2 SMALLINT UNSIGNED, +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` smallint(5) unsigned DEFAULT NULL, + `c2` smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +(1999, 12), +(2000, 11), +(2001, 10), +(2002, 9), +(2003, 8), +(2004, 7), +(2005, 6), +(2006, 5), +(2007, 4), +(2008, 3), +(2009, 2), +(2010, 1); +SELECT * FROM t1 WHERE c1 > 2005; +id c1 c2 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 >= 2005; +id c1 c2 +7 2005 6 +8 2006 5 +9 2007 4 +10 2008 3 +11 2009 2 +12 2010 1 +SELECT * FROM t1 WHERE c1 = 2005; +id c1 c2 +7 2005 6 +SELECT * FROM t1 WHERE c1 <= 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +7 2005 6 +SELECT * FROM t1 WHERE c1 < 2005; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 9 +5 2003 8 +6 2004 7 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result new file mode 100644 index 00000000000..587e3c5fd4d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_nullable_varchar.result @@ -0,0 +1,65 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +id INT PRIMARY KEY AUTO_INCREMENT, +c1 VARCHAR(10), +c2 VARCHAR(10), +KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `c1` varchar(10) DEFAULT NULL, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx1` (`c1`,`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO t1 (c1, c2) VALUES +('1999', '12'), +('2000', '11'), +('2001', '10'), +('2002', '09'), +('2003', '08'), +('2004', '07'), +('2005', '06'), +('2006', '05'), +('2007', '04'), +('2008', '03'), +('2009', '02'), +('2010', '01'); +SELECT * FROM t1 WHERE c1 > '2005'; +id c1 c2 +8 2006 05 +9 2007 04 +10 2008 03 +11 2009 02 +12 2010 01 +SELECT * FROM t1 WHERE c1 >= '2005'; +id c1 c2 +7 2005 06 +8 2006 05 +9 2007 04 +10 2008 03 +11 2009 02 +12 2010 01 +SELECT * FROM t1 WHERE c1 = '2005'; +id c1 c2 +7 2005 06 +SELECT * FROM t1 WHERE c1 <= '2005'; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 09 +5 2003 08 +6 2004 07 +7 2005 06 +SELECT * FROM t1 WHERE c1 < '2005'; +id c1 c2 +1 1999 12 +2 2000 11 +3 2001 10 +4 2002 09 +5 2003 08 +6 2004 07 +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result new file mode 100644 index 00000000000..ac673bac52c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_delete.result @@ -0,0 +1,29 @@ +drop table if exists listing; +set names utf8; +create table scores ( +name char(30) not null, +score int not null, +primary key (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +name score +Taro Yamada -12 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result new file mode 100644 index 00000000000..20b45861e4e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_select_int.result @@ -0,0 +1,37 @@ +drop table if exists listing; +set names utf8; +create table scores ( +name char(30) not null, +score int not null, +primary key (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where name = "Taro Yamada"; +name score +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where name = "Taro Yamada" and score = 29; +name score +Taro Yamada 29 +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result new file mode 100644 index 00000000000..86b06bc94dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_primary_update.result @@ -0,0 +1,32 @@ +drop table if exists listing; +set names utf8; +create table scores ( +name char(30) not null, +score int not null, +primary key (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +Warnings: +Warning 1265 data truncated for primary key column: +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +name score +Taro Yamada -12 +Taro Yamada 10 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than.result new file mode 100644 index 00000000000..870c5ba73e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at > "2014-09-11 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.result new file mode 100644 index 00000000000..06661210817 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at >= "2014-09-11 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than.result new file mode 100644 index 00000000000..f528f90b7dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at < "2014-09-12 00:00:00" + ORDER BY created_at DESC; +id score created_at +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.result new file mode 100644 index 00000000000..9250ecb8dbc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS items; +CREATE TABLE items ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +score INT, +created_at DATETIME, +INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; +Table Create Table +items CREATE TABLE `items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `score` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `score` (`score`,`created_at`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); +SELECT * +FROM items +WHERE score = 2 AND created_at <= "2014-09-12 00:00:00" + ORDER BY created_at DESC; +id score created_at +4 2 2014-09-12 00:00:00 +2 2 2014-09-11 00:00:00 +3 2 2014-09-11 00:00:00 +DROP TABLE items; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result new file mode 100644 index 00000000000..02222965755 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_recreate.result @@ -0,0 +1,39 @@ +drop table if exists listing; +set names utf8; +create table listing ( +id int primary key auto_increment not null, +last_name char(30) not null, +first_name char(30) not null, +index name (last_name, first_name) +) default charset utf8; +show create table listing; +Table Create Table +listing CREATE TABLE `listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `last_name` char(30) NOT NULL, + `first_name` char(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `name` (`last_name`,`first_name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop index name on listing; +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +create index new_name_index on listing (last_name, first_name); +select * from listing +where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop table listing; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result new file mode 100644 index 00000000000..df67c8a397e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_replace.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +INDEX property (NAME, SCORE) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +REPLACE scores (id, name, score) VALUES (3, "Taro Yamada", 28); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Taro Yamada 28 +4 Taro Yamada 10 +SELECT * FROM scores WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +3 Taro Yamada 28 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result new file mode 100644 index 00000000000..c75733f49fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_double.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS temperatures; +CREATE TABLE temperatures ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(20), +temperature DOUBLE, +KEY temperature_index(temperature), +KEY multi_index(temperature, title) +); +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +temperature +12.7 +28.2 +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +temperature +-2.8 +12.7 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +title temperature +Rainy! 12.7 +Hot! 28.2 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +title temperature +Snow! -2.8 +Rainy! 12.7 +DROP TABLE temperatures; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result new file mode 100644 index 00000000000..452cae2d651 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_float.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS temperatures; +CREATE TABLE temperatures ( +id INT PRIMARY KEY AUTO_INCREMENT, +title VARCHAR(20), +temperature FLOAT, +KEY temperature_index(temperature), +KEY multi_index(temperature, title) +); +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +temperature +12.7 +28.2 +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +temperature +-2.8 +12.7 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +title temperature +Rainy! 12.7 +Hot! 28.2 +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; +title temperature +Snow! -2.8 +Rainy! 12.7 +DROP TABLE temperatures; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result new file mode 100644 index 00000000000..ecf7706bd8e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_int.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS listing; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +INDEX property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`score`,`name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +SELECT * FROM scores WHERE score = 29; +id name score +1 Taro Yamada 29 +SELECT * FROM scores WHERE score = 29 AND name = "Taro Yamada"; +id name score +1 Taro Yamada 29 +SELECT * FROM scores WHERE (score >= -12 AND score < 29) AND name = "Taro Yamada"; +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result new file mode 100644 index 00000000000..ad73669e40b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_string.result @@ -0,0 +1,40 @@ +drop table if exists listing; +set names utf8; +create table listing ( +id int primary key auto_increment not null, +last_name char(30) not null, +first_name char(30) not null, +index name (last_name, first_name) +) default charset utf8; +show create table listing; +Table Create Table +listing CREATE TABLE `listing` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `last_name` char(30) NOT NULL, + `first_name` char(30) NOT NULL, + PRIMARY KEY (`id`), + KEY `name` (`last_name`,`first_name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing; +id last_name first_name +1 Taro Yamada +2 Taro Suzuki +3 Jiro Yamada +4 Taro Tanaka +select * from listing where last_name = "Taro"; +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +1 Taro Yamada +select * from listing where last_name = "Taro" and first_name = "Suzuki"; +id last_name first_name +2 Taro Suzuki +select * from listing where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +id last_name first_name +2 Taro Suzuki +4 Taro Tanaka +drop table listing; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result new file mode 100644 index 00000000000..53fbccda2b4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result @@ -0,0 +1,39 @@ +drop table if exists scores; +set names utf8; +create table scores ( +given_name varchar(30) not null, +family_name varchar(30) not null, +score int not null, +primary key property (given_name, family_name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `given_name` varchar(30) NOT NULL, + `family_name` varchar(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`given_name`,`family_name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores values("Taro", "Yamada", 29); +insert into scores values("Taro", "Yamada", -12); +insert into scores values("Jiro", "Yamada", 27); +insert into scores values("Taro", "Yamada", 10); +select * from scores; +given_name family_name score +Jiro Yamada 27 +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada"; +given_name family_name score +Taro Yamada -12 +Taro Yamada 10 +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada" and score = 29; +given_name family_name score +Taro Yamada 29 +select * from scores where given_name = "Taro" and family_name = "Yamada" and (score >= -12 and score < 29); +given_name family_name score +Taro Yamada -12 +Taro Yamada 10 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result new file mode 100644 index 00000000000..2174efc1b4f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_32bit_equal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = "1000-01-01" AND end = "9999-12-31"; +id start end +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result new file mode 100644 index 00000000000..869ced05d25 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_64bit_equal.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = "1000-01-01" AND end = "9999-12-31"; +id start end +2 1000-01-01 9999-12-31 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result new file mode 100644 index 00000000000..8e480d4844a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1000-01-01 2012-10-05 +1000-01-01 9999-12-31 +2012-10-25 9999-12-31 +9999-12-31 1000-01-01 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result new file mode 100644 index 00000000000..0a64a822fb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_asc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970-01-01 2012-10-05 +4 1970-01-01 1970-01-01 +1 2012-10-25 1970-01-01 +3 1970-01-01 1970-01-01 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result new file mode 100644 index 00000000000..24439fdf5fa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_32bit_desc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 1970-01-01 1970-01-01 +1 2012-10-25 1970-01-01 +4 1970-01-01 1970-01-01 +2 1970-01-01 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result new file mode 100644 index 00000000000..92e7f51ff6e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1000-01-01 2012-10-05 +4 1000-01-01 9999-12-31 +1 2012-10-25 9999-12-31 +3 9999-12-31 1000-01-01 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result new file mode 100644 index 00000000000..ddd694c3863 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_order_64bit_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 9999-12-31 1000-01-01 +1 2012-10-25 9999-12-31 +4 1000-01-01 9999-12-31 +2 1000-01-01 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result new file mode 100644 index 00000000000..bd1bdc33325 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_date_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start DATE, +end DATE, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; +id start end +1 2010-01-01 2012-10-05 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; +id start end +1 2010-01-01 2012-10-05 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result new file mode 100644 index 00000000000..1aa710882cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1000-01-01 00:00:00 2012-10-05 16:18:29 +1000-01-01 00:00:00 9999-12-31 23:59:59 +2012-10-25 16:18:29 9999-12-31 23:59:59 +9999-12-31 23:59:59 1000-01-01 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result new file mode 100644 index 00000000000..d18f1858932 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1000-01-01 00:00:00 2012-10-05 16:18:29 +4 1000-01-01 00:00:00 9999-12-31 23:59:59 +1 2012-10-25 16:18:29 9999-12-31 23:59:59 +3 9999-12-31 23:59:59 1000-01-01 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result new file mode 100644 index 00000000000..c159aeab4ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_order_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 9999-12-31 23:59:59 1000-01-01 00:00:00 +1 2012-10-25 16:18:29 9999-12-31 23:59:59 +4 1000-01-01 00:00:00 9999-12-31 23:59:59 +2 1000-01-01 00:00:00 2012-10-05 16:18:29 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result new file mode 100644 index 00000000000..50d5da49955 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_datetime_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start datetime, +end datetime, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result new file mode 100644 index 00000000000..015afdb5cf6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_decimal.result @@ -0,0 +1,36 @@ +drop table if exists t1; +create table t1 (c1 int primary key, c2 decimal(65,30), c3 decimal(65,30), unique key uk1(c2,c3)); +insert into t1 values(1,123.456,0.000000000000000000000000000001); +insert into t1 values(2,-123.456,123.456); +insert into t1 values(3,98765432109876543210987654321098765.432109876543210987654321098765,-123.456); +insert into t1 values(4,-98765432109876543210987654321098765.432109876543210987654321098765,98765432109876543210987654321098765.432109876543210987654321098765); +insert into t1 values(5,0.000000000000000000000000000001,-98765432109876543210987654321098765.432109876543210987654321098765); +select c1, c2, c3 from t1 force index(uk1) where c2 = -98765432109876543210987654321098765.432109876543210987654321098765 and c3 = 98765432109876543210987654321098765.432109876543210987654321098765; +c1 c2 c3 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +c1 c2 c3 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +2 -123.456000000000000000000000000000 123.456000000000000000000000000000 +5 0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +1 123.456000000000000000000000000000 0.000000000000000000000000000001 +3 98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +c1 c2 c3 +3 98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +1 123.456000000000000000000000000000 0.000000000000000000000000000001 +5 0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +2 -123.456000000000000000000000000000 123.456000000000000000000000000000 +4 -98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +select c2, c3 from t1 force index(uk1) order by c2, c3; +c2 c3 +-98765432109876543210987654321098765.432109876543210987654321098765 98765432109876543210987654321098765.432109876543210987654321098765 +-123.456000000000000000000000000000 123.456000000000000000000000000000 +0.000000000000000000000000000001 -98765432109876543210987654321098765.432109876543210987654321098765 +123.456000000000000000000000000000 0.000000000000000000000000000001 +98765432109876543210987654321098765.432109876543210987654321098765 -123.456000000000000000000000000000 +insert into t1 values(6,123.456,0.000000000000000000000000000001); +ERROR 23000: Duplicate entry '123.456000000000000000000000000000-0.000000000000000000000000000' for key 'uk1' +delete from t1 where c1 = 1; +insert into t1 values(1,123.456,0.000000000000000000000000000001); +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result new file mode 100644 index 00000000000..4e0dec32a28 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_index_read.result @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (2, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (3, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (4, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +-838:59:59 838:59:59 +00:00:00 15:11:11 +00:00:00 838:59:59 +15:11:12 838:59:59 +838:59:59 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result new file mode 100644 index 00000000000..3c6520a69c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_asc.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +5 -838:59:59 838:59:59 +2 00:00:00 15:11:11 +4 00:00:00 838:59:59 +1 15:11:12 838:59:59 +3 838:59:59 00:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result new file mode 100644 index 00000000000..c1be80309b8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_order_desc.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 838:59:59 00:00:00 +1 15:11:12 838:59:59 +4 00:00:00 838:59:59 +2 00:00:00 15:11:11 +5 -838:59:59 838:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result new file mode 100644 index 00000000000..0613de3e2f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_time_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start time, +end time, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; +id start end +1 13:21:48 15:11:12 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; +id start end +1 13:21:48 15:11:12 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result new file mode 100644 index 00000000000..d833fb44024 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp, +end timestamp, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (4, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1970-01-01 12:00:00 2012-10-05 16:18:29 +1970-01-01 12:00:00 2038-01-18 15:14:07 +2012-10-25 16:18:29 2038-01-18 15:14:07 +2038-01-18 15:14:07 1970-01-01 12:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result new file mode 100644 index 00000000000..1e4ee102c9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp, +end timestamp, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970-01-01 12:00:00 2012-10-05 16:18:29 +4 1970-01-01 12:00:00 2038-01-18 15:14:07 +1 2012-10-25 16:18:29 2038-01-18 15:14:07 +3 2038-01-18 15:14:07 1970-01-01 12:00:00 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result new file mode 100644 index 00000000000..23a5522320a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_order_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp, +end timestamp, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 2038-01-18 15:14:07 1970-01-01 12:00:00 +1 2012-10-25 16:18:29 2038-01-18 15:14:07 +4 1970-01-01 12:00:00 2038-01-18 15:14:07 +2 1970-01-01 12:00:00 2012-10-05 16:18:29 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result new file mode 100644 index 00000000000..3f3277f5e64 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_timestamp_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id int PRIMARY KEY, +start timestamp, +end timestamp, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; +id start end +1 2010-01-01 00:00:00 2012-10-05 23:59:59 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result new file mode 100644 index 00000000000..5c9cd959472 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_varchar.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result new file mode 100644 index 00000000000..04b3ba38395 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_32bit_equal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (2, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (3, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = 1901 AND end = 2155; +id start end +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result new file mode 100644 index 00000000000..e96754e5e21 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_64bit_equal.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); +SELECT * FROM ranges FORCE INDEX(range_key) +WHERE start = 1901 AND end = 2155; +id start end +2 1901 2155 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result new file mode 100644 index 00000000000..997c5e7db8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_index_read.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); +SELECT start, end +FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +start end +1901 2012 +1901 2155 +2012 2155 +2155 1901 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result new file mode 100644 index 00000000000..9a84d115a87 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_asc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (2, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (3, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1970 2012 +4 1970 1970 +1 2012 1970 +3 1970 1970 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result new file mode 100644 index 00000000000..3deb7435030 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_32bit_desc.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +Warnings: +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (2, 1901, 2012); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +INSERT INTO ranges VALUES (3, 2155, 1901); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +INSERT INTO ranges VALUES (4, 1901, 2155); +Warnings: +Warning 1265 Data truncated for column 'start' at row 1 +Warning 1265 Data truncated for column 'end' at row 1 +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 1970 1970 +1 2012 1970 +4 1970 1970 +2 1970 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result new file mode 100644 index 00000000000..335b9eb9486 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_asc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start, end; +id start end +2 1901 2012 +4 1901 2155 +1 2012 2155 +3 2155 1901 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result new file mode 100644 index 00000000000..524456b74bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_order_64bit_desc.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); +SELECT * FROM ranges FORCE INDEX(range_key) +ORDER BY start DESC, end DESC; +id start end +3 2155 1901 +1 2012 2155 +4 1901 2155 +2 1901 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result new file mode 100644 index 00000000000..7362411d7cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_unique_year_reinsert.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ranges; +CREATE TABLE ranges ( +id INT PRIMARY KEY, +start YEAR, +end YEAR, +UNIQUE KEY range_key(start, end) +); +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; +id start end +1 2010 2012 +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; +id start end +1 2010 2012 +DROP TABLE ranges; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result new file mode 100644 index 00000000000..bfc30a1f871 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_int.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS scores; +CREATE TABLE scores ( +id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, +name CHAR(30) NOT NULL, +score INT NOT NULL, +KEY property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`score`,`name`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores WHERE score = 29; +id name score +3 Jiro Yamada 29 +1 Taro Yamada 29 +UPDATE scores SET name = "Saburo YAMADA" WHERE id = 3; +SELECT * FROM scores WHERE score = 29; +id name score +3 Saburo YAMADA 29 +1 Taro Yamada 29 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result new file mode 100644 index 00000000000..550551d0052 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_update_string.result @@ -0,0 +1,34 @@ +drop table if exists listing; +set names utf8; +create table scores ( +id int primary key auto_increment not null, +name char(30) not null, +score int not null, +index property (name, score) +) default charset utf8; +show create table scores; +Table Create Table +scores CREATE TABLE `scores` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` char(30) NOT NULL, + `score` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `property` (`name`,`score`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +id name score +1 Taro Yamada 29 +2 Taro Yamada -12 +3 Jiro Yamada 27 +4 Taro Yamada 10 +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +id name score +2 Taro Yamada -12 +4 Taro Yamada 10 +3 Taro Yamada 27 +drop table scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result new file mode 100644 index 00000000000..95d7c78bbb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_exact_length.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id char(10) CHARACTER SET latin1 PRIMARY KEY +); +INSERT INTO ids VALUES('abcdefghij'); +INSERT INTO ids VALUES('klmnopqrst'); +INSERT INTO ids VALUES('uvwxyz0123'); +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; +id +abcdefghij +klmnopqrst +uvwxyz0123 +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = 'abcdefghij'; +id +abcdefghij +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result new file mode 100644 index 00000000000..f7a802060d5 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_null_character.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result new file mode 100644 index 00000000000..fb08c6601bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_char_short.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id char(6) CHARACTER SET latin1 PRIMARY KEY +); +INSERT INTO ids VALUES("abcdef"); +INSERT INTO ids VALUES( "cdef"); +INSERT INTO ids VALUES( "ef"); +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; +id +abcdef +cdef +ef +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "cdef"; +id +cdef +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result new file mode 100644 index 00000000000..a460c7d99d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_date.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `day` date NOT NULL, + `title` text, + PRIMARY KEY (`day`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "cloudy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "duplicated day"); +ERROR 23000: Duplicate entry '2012-01-31' for key 'PRIMARY' +SELECT * FROM diaries; +day title +2012-01-29 clear day +2012-01-30 rainy day +2012-01-31 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29" AND "2012-01-30"; +day title +2012-01-29 clear day +2012-01-30 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result new file mode 100644 index 00000000000..ffbbfe3f460 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_with_fractional_seconds.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATETIME(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `day` datetime(6) NOT NULL, + `title` text, + PRIMARY KEY (`day`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (day, title) +VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); +SELECT * FROM diaries; +day title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +2012-01-31 08:32:10.555500 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +day title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result new file mode 100644 index 00000000000..76c529f7fbb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_datetime_without_fractional_seconds.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATETIME PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `day` datetime NOT NULL, + `title` text, + PRIMARY KEY (`day`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (day, title) +VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (day, title) +VALUES ("2012-01-31 08:32:10", "cloudy day"); +SELECT * FROM diaries; +day title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +2012-01-31 08:32:10 cloudy day +SELECT * FROM diaries +WHERE day BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +day title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result new file mode 100644 index 00000000000..9b1e8e7d7e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_with_fractional_seconds.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS releases; +CREATE TABLE releases ( +version DECIMAL(6, 3) PRIMARY KEY, +message TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE releases; +Table Create Table +releases CREATE TABLE `releases` ( + `version` decimal(6,3) NOT NULL, + `message` text, + PRIMARY KEY (`version`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); +INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); +INSERT INTO releases (version, message) VALUES (999.999, "the last release!"); +SELECT * FROM releases; +version message +10.000 10th release! +10.001 minor fix. +999.999 the last release! +SELECT * FROM releases WHERE version BETWEEN "9.000" AND "10.001"; +version message +10.000 10th release! +10.001 minor fix. +DROP TABLE releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result new file mode 100644 index 00000000000..0624ab2f2b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_decimal_without_fractional_seconds.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS releases; +CREATE TABLE releases ( +version DECIMAL PRIMARY KEY, +message TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE releases; +Table Create Table +releases CREATE TABLE `releases` ( + `version` decimal(10,0) NOT NULL, + `message` text, + PRIMARY KEY (`version`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); +INSERT INTO releases (version, message) VALUES (10, "10th release!"); +INSERT INTO releases (version, message) VALUES (999, "the last release!"); +SELECT * FROM releases; +version message +1 the first release!!! +10 10th release! +999 the last release! +SELECT * FROM releases WHERE version BETWEEN "1" AND "10"; +version message +1 the first release!!! +10 10th release! +DROP TABLE releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result new file mode 100644 index 00000000000..639114875e9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_with_fractional_seconds.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +time TIME(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; +Table Create Table +running_records CREATE TABLE `running_records` ( + `time` time(6) NOT NULL, + `title` text, + PRIMARY KEY (`time`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO running_records (time, title) +VALUES ("01:00:00.000001", "normal condition"); +INSERT INTO running_records (time, title) +VALUES ("12:23:34.123456", "bad condition"); +INSERT INTO running_records (time, title) +VALUES ("-838:59:59.000000", "record failure"); +SELECT * FROM running_records; +time title +-838:59:59.000000 record failure +01:00:00.000001 normal condition +12:23:34.123456 bad condition +SELECT * FROM running_records +WHERE time BETWEEN "00:59:59.999999" AND "12:23:34.123456"; +time title +01:00:00.000001 normal condition +12:23:34.123456 bad condition +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result new file mode 100644 index 00000000000..6a89cdc33dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_time_without_fractional_seconds.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS running_records; +CREATE TABLE running_records ( +time TIME PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; +Table Create Table +running_records CREATE TABLE `running_records` ( + `time` time NOT NULL, + `title` text, + PRIMARY KEY (`time`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO running_records (time, title) +VALUES ("01:00:00", "normal condition"); +INSERT INTO running_records (time, title) +VALUES ("12:23:34", "bad condition"); +INSERT INTO running_records (time, title) +VALUES ("-838:59:59", "record failure"); +SELECT * FROM running_records; +time title +-838:59:59 record failure +01:00:00 normal condition +12:23:34 bad condition +SELECT * FROM running_records +WHERE time BETWEEN "00:59:59" AND "12:23:34"; +time title +01:00:00 normal condition +12:23:34 bad condition +DROP TABLE running_records; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result new file mode 100644 index 00000000000..7040cc22b2e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +time TIMESTAMP(6) PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `title` text, + PRIMARY KEY (`time`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (time, title) +VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (time, title) +VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (time, title) +VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); +SELECT * FROM diaries; +time title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +2012-01-31 08:32:10.555500 cloudy day +SELECT * FROM diaries +WHERE time BETWEEN "2012-01-29 00:00:00.123456" AND +"2012-01-31 00:00:00.999999"; +time title +2012-01-29 21:51:01.111111 clear day +2012-01-30 01:23:45.333000 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result new file mode 100644 index 00000000000..38017f6f8cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +time TIMESTAMP PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` text, + PRIMARY KEY (`time`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-31 08:32:10", "cloudy day"); +SELECT * FROM diaries; +time title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +2012-01-31 08:32:10 cloudy day +SELECT * FROM diaries +WHERE time BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; +time title +2012-01-29 21:51:01 clear day +2012-01-30 01:23:45 rainy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result new file mode 100644 index 00000000000..9079d9c4064 Binary files /dev/null and b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_varchar_null_character.result differ diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result new file mode 100644 index 00000000000..af9b3a2dbfb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_year.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS aniversary_memos; +CREATE TABLE aniversary_memos ( +party_year YEAR PRIMARY KEY, +title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; +Table Create Table +aniversary_memos CREATE TABLE `aniversary_memos` ( + `party_year` year(4) NOT NULL, + `title` text, + PRIMARY KEY (`party_year`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO aniversary_memos (party_year, title) +VALUES ("11", "We need a big cake!"); +INSERT INTO aniversary_memos (party_year, title) +VALUES ("2012", "Invitations are sent."); +INSERT INTO aniversary_memos (party_year, title) +VALUES ("13", "Wow! Today is the anniversary party day!"); +SELECT * FROM aniversary_memos; +party_year title +2011 We need a big cake! +2012 Invitations are sent. +2013 Wow! Today is the anniversary party day! +SELECT * FROM aniversary_memos +WHERE party_year BETWEEN "12" AND "2013"; +party_year title +2012 Invitations are sent. +2013 Wow! Today is the anniversary party day! +DROP TABLE aniversary_memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_asc.result new file mode 100644 index 00000000000..1ca4b145f54 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id > 1 ORDER BY ids.id ASC LIMIT 3; +id +2 +3 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_desc.result new file mode 100644 index 00000000000..80dcb25ffe6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_desc.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id > 3 ORDER BY ids.id DESC LIMIT 3; +id +5 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_asc.result new file mode 100644 index 00000000000..4c1ff997d79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id >= 2 ORDER BY ids.id ASC LIMIT 3; +id +2 +3 +4 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_desc.result new file mode 100644 index 00000000000..4998725aef5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_greater_than_or_equal_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id >= 3 ORDER BY ids.id DESC LIMIT 3; +id +5 +4 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_asc.result new file mode 100644 index 00000000000..8b142f30610 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id ASC LIMIT 3; +id +1 +2 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_desc.result new file mode 100644 index 00000000000..eaf5b87e62c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id DESC LIMIT 3; +id +3 +2 +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_asc.result new file mode 100644 index 00000000000..e1e96c9ca8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_asc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id ASC LIMIT 3; +id +1 +2 +3 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_desc.result new file mode 100644 index 00000000000..e8124ca14c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_range_less_than_or_equal_desc.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS ids; +SET NAMES UTF8; +CREATE TABLE ids ( +id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id DESC LIMIT 3; +id +4 +3 +2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result new file mode 100644 index 00000000000..77b321015c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT, +value BIGINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result new file mode 100644 index 00000000000..b0004a3c87a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_bigint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id BIGINT UNSIGNED, +value BIGINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result new file mode 100644 index 00000000000..862a314c9c2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_double.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id DOUBLE, +value DOUBLE, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); +SELECT * FROM ids; +id value +-16.6 1.1 +-8.8 2.2 +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +16.6 -1.1 +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; +id value +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result new file mode 100644 index 00000000000..04d44130ed4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_float.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id FLOAT, +value FLOAT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); +SELECT * FROM ids; +id value +-16.6 1.1 +-8.8 2.2 +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +16.6 -1.1 +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; +id value +-4.4 4.4 +-2.2 8.8 +-1.1 16.16 +1.1 -16.16 +2.2 -8.8 +4.4 -4.4 +8.8 -2.2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result new file mode 100644 index 00000000000..8d3f6f7ff9e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +value INT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result new file mode 100644 index 00000000000..d09f97e0d06 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_int_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT UNSIGNED, +value INT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result new file mode 100644 index 00000000000..5242f10ff02 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id MEDIUMINT, +value MEDIUMINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result new file mode 100644 index 00000000000..41d9c0ebeeb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_mediumint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id MEDIUMINT UNSIGNED, +value MEDIUMINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result new file mode 100644 index 00000000000..e34b7b7ddab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id SMALLINT, +value SMALLINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result new file mode 100644 index 00000000000..9014f9afaec --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_smallint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id SMALLINT UNSIGNED, +value SMALLINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result new file mode 100644 index 00000000000..63b27fdd4ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id TINYINT, +value TINYINT, +KEY (id, value) +); +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); +SELECT * FROM ids; +id value +-16 1 +-8 2 +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +16 -1 +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; +id value +-4 4 +-2 8 +-1 16 +1 -16 +2 -8 +4 -4 +8 -2 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result new file mode 100644 index 00000000000..412b9b7c0c8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_tinyint_unsigned.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id TINYINT UNSIGNED, +value TINYINT UNSIGNED, +KEY (id, value) +); +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); +SELECT * FROM ids; +id value +1 1 +2 2 +4 3 +8 4 +16 5 +32 6 +64 7 +128 8 +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; +id value +4 3 +8 4 +16 5 +32 6 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result new file mode 100644 index 00000000000..c08522d0dab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(5), +value VARCHAR(10), +KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_bin; +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); +SELECT * FROM ids; +id value +ABC aBC +ACD AbC +ADE ABc +AEF ABC +abc Abc +acd aBc +ade abC +aef abc +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; +id value +abc Abc +acd aBc +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result new file mode 100644 index 00000000000..9882f2b1598 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_multiple_varchar_collation.result @@ -0,0 +1,31 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(5), +value VARCHAR(10), +KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); +SELECT * FROM ids; +id value +abc Abc +acd aBc +ade abC +aef abc +ABC aBC +ACD AbC +ADE ABc +AEF ABC +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; +id value +abc Abc +ABC aBC +acd aBc +ACD AbC +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result new file mode 100644 index 00000000000..67f1f4f8268 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_int.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +KEY (id) +); +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; +SELECT * FROM ids; +id +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 +32 +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result new file mode 100644 index 00000000000..2cdde6c4086 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_normal_varchar.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(10), +KEY (id) +); +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; +SELECT * FROM ids; +id +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 +32 +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result new file mode 100644 index 00000000000..23f63d2ffca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_int.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT, +PRIMARY KEY (id) +); +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; +SELECT * FROM ids; +id +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 +32 +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result new file mode 100644 index 00000000000..7fa17bd79d9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_read_primary_varchar.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id VARCHAR(10), +PRIMARY KEY (id) +); +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; +SELECT * FROM ids; +id +1 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +2 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +3 +30 +31 +32 +4 +5 +6 +7 +8 +9 +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; +id +10 +11 +12 +13 +14 +15 +16 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result new file mode 100644 index 00000000000..4e10cf72415 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_delete_by_primary_key.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"); +DELETE FROM users WHERE id = 1; +INSERT INTO users VALUES (1, "Alice"); +SELECT * FROM users; +id name +1 Alice +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result new file mode 100644 index 00000000000..7b2c0b86214 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_insert_after_error.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, "Alice"); +INSERT INTO users VALUES (1, "Bob"); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +INSERT INTO users VALUES (2, "Bob"); +SELECT * FROM users; +id name +1 Alice +2 Bob +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result new file mode 100644 index 00000000000..155cdf15959 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_unique_varchar.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +CREATE TABLE users ( +name varchar(100) NOT NULL, +UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; +INSERT INTO users VALUES ("Alice"); +INSERT INTO users VALUES ("Bob"); +SELECT * FROM users; +name +Alice +Bob +SELECT * FROM users WHERE name = "aLiCe"; +name +Alice +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result new file mode 100644 index 00000000000..9165ca26fea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_multiple_column.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +deleted BOOLEAN, +value INT, +INDEX (deleted, value) +); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 2); +SELECT count(*) FROM scores WHERE deleted = FALSE; +count(*) +3 +UPDATE scores SET deleted = TRUE WHERE value = 1; +SELECT count(*) FROM scores WHERE deleted = FALSE; +count(*) +1 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result new file mode 100644 index 00000000000..b283af17f94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_update_single_column.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS scores; +SET NAMES utf8; +CREATE TABLE scores ( +value INT, +INDEX (value) +); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (22); +SELECT count(*) FROM scores WHERE value >= 20; +count(*) +3 +UPDATE scores SET value = 11 WHERE value = 21; +SELECT count(*) FROM scores WHERE value >= 20; +count(*) +1 +DROP TABLE scores; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result new file mode 100644 index 00000000000..8d3decfa32a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE +Mroonga 4.6 STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in new file mode 100644 index 00000000000..f1020453183 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE +Mroonga @MRN_PLUGIN_VERSION@ STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result new file mode 100644 index 00000000000..c23dab5e4a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_none.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY +); +SELECT AUTO_INCREMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "ids"; +AUTO_INCREMENT +NULL +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result new file mode 100644 index 00000000000..96d1b0ad32e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_auto_increment_use.result @@ -0,0 +1,10 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT AUTO_INCREMENT PRIMARY KEY +); +SELECT AUTO_INCREMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "ids"; +AUTO_INCREMENT +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result new file mode 100644 index 00000000000..d58afb1f6d4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_tables_data_length.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT COUNT(*) +FROM INFORMATION_SCHEMA.TABLES +WHERE TABLE_NAME = "diaries" AND DATA_LENGTH > 0; +COUNT(*) +1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..00466f19bb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_TODO_SPLIT_ME.result @@ -0,0 +1,90 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 tinyint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 smallint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 mediumint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 int); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 bigint); +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 float); +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 double); +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 date); +insert into t1 values("2010/03/26"); +select * from t1; +c1 +2010-03-26 +drop table t1; +create table t1 (c1 time); +insert into t1 values("11:22:33"); +select * from t1; +c1 +11:22:33 +drop table t1; +create table t1 (c1 year); +insert into t1 values("2010"); +select * from t1; +c1 +2010 +drop table t1; +create table t1 (c1 datetime); +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +c1 +2010-03-26 11:22:33 +drop table t1; +create table t1 (c1 int, _id int); +set sql_mode=""; +insert into t1 (c1,_id) values (1,1); +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +set sql_mode="strict_all_tables"; +insert into t1 (c1,_id) values (4,1); +ERROR 01000: Data truncated for column '_id' at row 1 +select * from t1; +c1 _id +1 1 +drop table t1; +create table t1 (c1 int primary key, c2 int); +insert into t1 values(1,100); +select * from t1; +c1 c2 +1 100 +insert into t1 values(1,200); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1; +c1 c2 +1 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result new file mode 100644 index 00000000000..eb11e26e566 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_delayed.result @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; +INSERT DELAYED INTO ids (id) VALUES (1); +ERROR HY000: DELAYED option not supported for table 'ids' +SELECT * FROM ids; +id +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result new file mode 100644 index 00000000000..0d2c9dd7987 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS numbers; +CREATE TABLE numbers ( +id INT, +count INT, +UNIQUE (id) +); +INSERT INTO numbers (id, count) VALUES (1, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (1, 3) ON DUPLICATE KEY UPDATE count = 4; +SELECT * FROM numbers; +id count +1 4 +INSERT INTO numbers (id, count) VALUES (2, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (2, 3) ON DUPLICATE KEY UPDATE count = 4; +SELECT * FROM numbers; +id count +1 4 +2 4 +DROP TABLE numbers; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result new file mode 100644 index 00000000000..12d4b173eaa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_primary_key.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +title TEXT +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `day` date NOT NULL, + `title` text, + PRIMARY KEY (`day`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "clear day") +ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "rainy day") +ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-15", "cloudy day") +ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; +SELECT * FROM diaries; +day title +2012-02-14 rainy day (duplicated) +2012-02-15 cloudy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result new file mode 100644 index 00000000000..288e9e3a2c8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/insert_on_duplicate_key_update_unique_key.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +day DATE, +title TEXT, +UNIQUE KEY day (day) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `day` date DEFAULT NULL, + `title` text, + PRIMARY KEY (`id`), + UNIQUE KEY `day` (`day`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "clear day") +ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-14", "rainy day") +ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) +VALUES ("2012-02-15", "cloudy day") +ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; +SELECT * FROM diaries; +id day title +1 2012-02-14 rainy day (duplicated) +3 2012-02-15 cloudy day +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result b/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result new file mode 100644 index 00000000000..1cc1d92451d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/like_unicode_ci.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS terms; +SET NAMES utf8; +CREATE TABLE terms ( +content varchar(64) NOT NULL COLLATE 'utf8_unicode_ci', +INDEX (content) +) DEFAULT CHARSET=utf8; +INSERT INTO terms VALUES ('track'); +INSERT INTO terms VALUES ('trackback'); +SELECT * FROM terms WHERE content LIKE 'TRACK%'; +content +track +trackback +DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result b/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result new file mode 100644 index 00000000000..4e1db465c63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/lock_tables_read.result @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS counts; +CREATE TABLE counts ( +id INT PRIMARY KEY AUTO_INCREMENT +); +LOCK TABLES counts READ; +UNLOCK TABLES; +DROP TABLE counts; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result new file mode 100644 index 00000000000..da15588ccd5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_disabled.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SET mroonga_enable_optimization=FALSE; +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +month = 11 +ORDER BY day LIMIT 1,2; +id year month day title content +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +4 2011 11 12 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +SET mroonga_enable_optimization=TRUE; +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result new file mode 100644 index 00000000000..0794b104a62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_not_optimized_no_limit.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day; +id year month day title content +7 2011 12 2 åˆé›ª 今日ã®å¤©æ°—ã¯é›ªï¼ +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +4 2011 11 12 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +5 2011 11 13 ã¯ã‚Œ 天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result new file mode 100644 index 00000000000..bd34b040ad7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result new file mode 100644 index 00000000000..f495a3b5956 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_between_over.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result new file mode 100644 index 00000000000..b5be750690d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:34", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:34", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date = "2011-11-11 12:23:34" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:34 I will do something today! +4 2011-11-11 12:23:34 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result new file mode 100644 index 00000000000..6f20f3b8b35 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date > "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; +id date content +4 2011-11-11 12:23:33 I don't want to anything today... +5 2011-11-11 12:23:34 I'm sleepy today. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result new file mode 100644 index 00000000000..5df3c12ccd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_greater_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date >= "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; +id date content +3 2011-11-11 12:23:32 I will do something today! +4 2011-11-11 12:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result new file mode 100644 index 00000000000..c12e69bf686 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date < "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +2 2011-11-11 12:23:31 Today's lucky item is flower! +3 2011-11-11 12:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result new file mode 100644 index 00000000000..6d00bac66eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_datetime_less_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +date DATETIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `date` datetime DEFAULT NULL, + `content` text, + KEY `date` (`date`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +date <= "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; +id date content +2 2011-11-11 12:23:31 Today's lucky item is flower! +3 2011-11-11 12:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result new file mode 100644 index 00000000000..529f0d521ee --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_have_primary_key.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +6 2011 12 2 åˆé›ª 今日ã®å¤©æ°—ã¯é›ªï¼ +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+4 2011 11 11 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result new file mode 100644 index 00000000000..ed86c0e1e37 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED, +content TEXT, +FULLTEXT INDEX(content), +KEY(id) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +id BETWEEN 2 AND 4 +ORDER BY id LIMIT 1,2; +id content +3 I will do something today! +4 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result new file mode 100644 index 00000000000..a18e2a15863 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_between_over.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED, +content TEXT, +FULLTEXT INDEX(content), +KEY(id) +) DEFAULT CHARSET UTF8; +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +id BETWEEN 2 AND 6 +ORDER BY id LIMIT 1,2; +id content +3 I will do something today! +4 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result new file mode 100644 index 00000000000..2320b0ffbc4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_equal.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +month = 11 +ORDER BY day LIMIT 1,2; +id year month day title content +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +4 2011 11 12 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result new file mode 100644 index 00000000000..c367aef808a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day > 10 +ORDER BY day LIMIT 1,2; +id year month day title content +4 2011 11 12 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +5 2011 11 13 ã¯ã‚Œ 天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result new file mode 100644 index 00000000000..b00a4e2a2c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_greater_than_or_equal.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day >= 10 +ORDER BY day LIMIT 1,2; +id year month day title content +4 2011 11 12 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +5 2011 11 13 ã¯ã‚Œ 天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result new file mode 100644 index 00000000000..5bf6bca4985 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day < 12 +ORDER BY day LIMIT 1,2; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result new file mode 100644 index 00000000000..5d6a19a936e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_int_less_than_or_equal.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +day <= 12 +ORDER BY day LIMIT 1,2; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result new file mode 100644 index 00000000000..6ee2991e51a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_primary_key.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; +id year month day title content +5 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +6 2011 12 2 åˆé›ª 今日ã®å¤©æ°—ã¯é›ªï¼ +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+4 2011 11 11 å¸°ã‚Šé“ ä»Šæ—¥ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result new file mode 100644 index 00000000000..9730069c849 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_no_where_clause.result @@ -0,0 +1,19 @@ +drop table if exists t1; +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, _id int, key idx1(c2), fulltext index ft(c3)) default charset utf8; +insert into t1 values(1,10,"aa ii uu ee oo",null); +insert into t1 values(2,20,"ka ki ku ke ko",null); +insert into t1 values(3,30,"ii si ii se ii",null); +insert into t1 values(4,40,"ta ti tu te to",null); +insert into t1 values(5,50,"aa ii uu ii oo",null); +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select *, match(c3) against("ii") from t1 order by c1 desc limit 2; +c1 c2 c3 _id match(c3) against("ii") +5 50 aa ii uu ii oo 5 349526 +4 40 ta ti tu te to 4 0 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result new file mode 100644 index 00000000000..e91e8af5391 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_asc.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day ASC LIMIT 1; +id year month day title content +7 2011 12 2 åˆé›ª 今日ã®å¤©æ°—ã¯é›ªï¼ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result new file mode 100644 index 00000000000..da01145e45a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_desc.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY day DESC LIMIT 1; +id year month day title content +5 2011 11 13 ã¯ã‚Œ 天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result new file mode 100644 index 00000000000..bb541c014bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_id.result @@ -0,0 +1,46 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +_id INT, +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `_id` int(11) DEFAULT NULL, + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(NULL, 3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(NULL, 4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(NULL, 5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(NULL, 6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(NULL, 7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY _id +LIMIT 1; +_id id year month day title content +1 1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result new file mode 100644 index 00000000000..fb9393687dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_order_by_match_against.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result new file mode 100644 index 00000000000..75ad884a268 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_select_match_against.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT *, MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +LIMIT 1; +id year month day title content MATCH(content) AGAINST("今日" IN BOOLEAN MODE) +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ 1 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result new file mode 100644 index 00000000000..bb4ac9c3b33 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time BETWEEN "1:23:31" AND "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result new file mode 100644 index 00000000000..1b4d38e0107 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_between_over.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time BETWEEN "1:23:31" AND "1:23:43" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result new file mode 100644 index 00000000000..4fff9f9185f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); +INSERT INTO memos VALUES(3, "1:23:34", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:34", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time = "1:23:34" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:34 I will do something today! +4 01:23:34 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result new file mode 100644 index 00000000000..61119b2b74e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time > "1:23:31" + ORDER BY id LIMIT 1,2; +id writing_time content +4 01:23:33 I don't want to anything today... +5 01:23:34 I'm sleepy today. +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result new file mode 100644 index 00000000000..9bf8b91ea07 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_greater_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time >= "1:23:31" + ORDER BY id LIMIT 1,2; +id writing_time content +3 01:23:32 I will do something today! +4 01:23:33 I don't want to anything today... +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result new file mode 100644 index 00000000000..e4d41f5867e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time < "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +2 01:23:31 Today's lucky item is flower! +3 01:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result new file mode 100644 index 00000000000..31a497ef8bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_time_less_than_or_equal.result @@ -0,0 +1,35 @@ +DROP TABLE IF EXISTS memos; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE memos ( +id INT UNSIGNED NOT NULL, +writing_time TIME, +content TEXT, +FULLTEXT INDEX(content), +KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(10) unsigned NOT NULL, + `writing_time` time DEFAULT NULL, + `content` text, + KEY `writing_time` (`writing_time`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); +SELECT * FROM memos +WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND +writing_time <= "1:23:33" + ORDER BY id LIMIT 1,2; +id writing_time content +2 01:23:31 Today's lucky item is flower! +3 01:23:32 I will do something today! +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result new file mode 100644 index 00000000000..46c80ddcce7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_with_index.result @@ -0,0 +1,46 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(title), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `title` (`title`), + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +title = "hello" + ORDER BY day LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result new file mode 100644 index 00000000000..38263c1083f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_varchar_equal_without_index.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(month), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + KEY `month` (`month`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); +SELECT * FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND +title = "hello" + ORDER BY day LIMIT 1; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result new file mode 100644 index 00000000000..5a1b1bda2ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year BETWEEN "11" AND "2013" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +2 Rename Groonga storage engine to Mroonga 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result new file mode 100644 index 00000000000..b0ad41fbbba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_between_over.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year BETWEEN "11" AND "2015" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +4 Mroonga 3.0 has been released 2013 +3 Mroonga 2.0 has been released 2012 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result new file mode 100644 index 00000000000..08db6b384e8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_equal.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 1.0 has been released", "11"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 1.11 has been released", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year = "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +1 Groonga storage engine (code name Mroonga) 1.0 has been released 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result new file mode 100644 index 00000000000..a33cd484865 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year > "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id ASC LIMIT 2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +4 Mroonga 3.0 has been released 2013 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result new file mode 100644 index 00000000000..7d2471b3aa0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_greater_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year >= "11" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id ASC LIMIT 2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +3 Mroonga 2.0 has been released 2012 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result new file mode 100644 index 00000000000..cac3d6f4356 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year < "13" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +2 Rename Groonga storage engine to Mroonga 2011 +1 Groonga storage engine (code name Mroonga) 0.1 has been released 2010 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result new file mode 100644 index 00000000000..df57f51e5d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_order_limit_optimized_year_less_than_or_equal.result @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS mroonga_releases; +FLUSH STATUS; +CREATE TABLE mroonga_releases ( +id INT PRIMARY KEY AUTO_INCREMENT, +release_title TEXT, +release_year YEAR, +KEY (release_year), +FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) +VALUES ("Mroonga 4.0 will be released", "2014"); +SELECT * FROM mroonga_releases +WHERE release_year <= "13" AND +MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) +ORDER BY id DESC LIMIT 1,2; +id release_title release_year +3 Mroonga 2.0 has been released 2012 +2 Rename Groonga storage engine to Mroonga 2011 +SHOW STATUS LIKE 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +DROP TABLE mroonga_releases; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..b66801094bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_TODO_SPLIT_ME.result @@ -0,0 +1,106 @@ +drop table if exists t1, t2, t3; +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +select count(*) from t1; +count(*) +5 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +select * from t1 force index(primary) where c1 between 2 and 4; +c1 c2 c3 +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +select count(*) from t1 force index(primary) where c1 between 2 and 4; +count(*) +3 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +select c1 from t1 force index(primary) where c1 < 3; +c1 +1 +2 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +select count(c1) from t1 force index(primary) where c1 < 3; +count(c1) +2 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +select 1 from t1 force index(primary) where c1 > 3; +1 +1 +1 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +select count(1) from t1 force index(primary) where c1 > 3; +count(1) +2 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 2 +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 2 +select count(*) from t1 where match(c3) against("su"); +count(*) +1 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 3 +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 3 +select count(*) from t1 where match(c3) against("+su" in boolean mode); +count(*) +1 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 4 +select * from t1 force index(idx1) where c2 between 20 and 40; +c1 c2 c3 +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 4 +select count(*) from t1 force index(idx1) where c2 between 20 and 40; +count(*) +3 +show status like 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 5 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_multithread.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_multithread.result new file mode 100644 index 00000000000..c09ec340ccb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_multithread.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX ft(title) +); +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_single_thread.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_single_thread.result new file mode 100644 index 00000000000..c09ec340ccb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_after_insert_single_thread.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +CREATE TABLE diaries ( +title TEXT, +FULLTEXT INDEX ft(title) +); +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +COUNT(*) +1 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result new file mode 100644 index 00000000000..9971d21e386 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_disabled.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +FLUSH STATUS; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +SET mroonga_enable_optimization=FALSE; +SELECT COUNT(*) FROM diaries +WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE); +COUNT(*) +4 +SHOW STATUS LIKE 'mroonga_count_skip'; +Variable_name Value +Mroonga_count_skip 0 +SET mroonga_enable_optimization=TRUE; +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_index_view.result b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_index_view.result new file mode 100644 index 00000000000..407347a4fa2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/optimization_skip_count_index_view.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries, users; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +user_id INT NOT NULL, +title VARCHAR(45) NOT NULL, +KEY (user_id), +FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET=UTF8; +CREATE TABLE users ( +id INT PRIMARY KEY AUTO_INCREMENT, +name VARCHAR(45) NOT NULL, +INDEX (name) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8; +INSERT INTO users (id, name) VALUES (1, "Alice"), (2, "Bob"); +INSERT INTO diaries (user_id, title) VALUES (1, "survey"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (1)"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (2)"); +CREATE VIEW articles AS +SELECT diaries.user_id AS user_id, +diaries.title AS title, +users.name AS name +FROM diaries, users +WHERE diaries.user_id = users.id; +SELECT COUNT(*) FROM articles WHERE name = 'Bob'; +COUNT(*) +2 +DROP VIEW articles; +DROP TABLE diaries, users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result new file mode 100644 index 00000000000..94bd5167dbc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_geometry.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS geo_replace; +CREATE TABLE geo_replace ( +id INT NOT NULL, +geo GEOMETRY NOT NULL, +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO geo_replace VALUES(1, POINT(100,100)); +SELECT id, ASTEXT(geo) FROM geo_replace; +id ASTEXT(geo) +1 POINT(100 100) +REPLACE INTO geo_replace VALUES(1, POINT(100,200)); +SELECT id, ASTEXT(geo) FROM geo_replace; +id ASTEXT(geo) +1 POINT(100 200) +INSERT INTO geo_replace VALUES(1, POINT(200,200)) ON DUPLICATE KEY UPDATE geo = POINT(200,200); +SELECT id, ASTEXT(geo) FROM geo_replace; +id ASTEXT(geo) +1 POINT(200 200) +UPDATE geo_replace SET geo = POINT(200,300); +SELECT id, ASTEXT(geo) FROM geo_replace; +id ASTEXT(geo) +1 POINT(200 300) +DROP TABLE geo_replace; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result new file mode 100644 index 00000000000..9cbe11c5574 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_select_varchar.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS videos_master, videos_groonga; +CREATE TABLE `videos_master` ( +`id` bigint(1) unsigned NOT NULL, +`video_id` varchar(64) NOT NULL, +`description` text, +`tags_unpack` text, +PRIMARY KEY (`video_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE `videos_groonga` ( +`id` bigint(1) unsigned NOT NULL, +`video_id` varchar(64) NOT NULL, +`description` text, +`tags_unpack` text, +PRIMARY KEY (`video_id`), +FULLTEXT INDEX (`description`), +FULLTEXT INDEX (`tags_unpack`) +) DEFAULT CHARSET=utf8; +INSERT INTO videos_master VALUES (1, "video-1", "My Familly", "familly human"); +INSERT INTO videos_master VALUES (2, "video-2", "My Cat", "family cat"); +REPLACE INTO videos_groonga +SELECT v.id, v.video_id, v.description, NULL +FROM videos_master AS v +WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("cat") FROM videos_groonga +WHERE MATCH(description) AGAINST("cat"); +id video_id description tags_unpack MATCH(description) AGAINST("cat") +2 video-2 My Cat 1048577 +INSERT INTO videos_master VALUES (3, "video-3", "My Dog", "family dog"); +REPLACE INTO videos_groonga +SELECT v.id, v.video_id, v.description, NULL +FROM videos_master AS v +WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga +WHERE MATCH(description) AGAINST("my"); +id video_id description tags_unpack MATCH(description) AGAINST("my") +1 video-1 My Familly 209716 +2 video-2 My Cat 209716 +3 video-3 My Dog 209716 +DROP TABLE videos_master, videos_groonga; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result new file mode 100644 index 00000000000..f2cf9667ac7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_text.result @@ -0,0 +1,33 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content text, +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +select * from diaries; +id content +1 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +select * from diaries where match(content) against("天気"); +id content +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +replace into diaries values(2, "明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。"); +select * from diaries where match(content) against("天気"); +id content +2 明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。 +3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result new file mode 100644 index 00000000000..090ea9b84d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_varchar.result @@ -0,0 +1,33 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content varchar(256), +fulltext index (content) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `content` varchar(256) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +select * from diaries; +id content +1 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +select * from diaries where match(content) against("天気"); +id content +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +replace into diaries values(2, "明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。"); +select * from diaries where match(content) against("天気"); +id content +2 明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。 +3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result b/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result new file mode 100644 index 00000000000..3e987631dba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/replace_vector.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS vector_replace; +DROP TABLE IF EXISTS vector_replace_vec; +CREATE TABLE vector_replace_vec ( +vec CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE vector_replace ( +id INT NOT NULL, +vec TEXT COMMENT 'flags "COLUMN_VECTOR", type "vector_replace_vec"', +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO vector_replace VALUES(1, 'first second third'); +SELECT id, vec FROM vector_replace; +id vec +1 FIRST SECOND THIRD +REPLACE INTO vector_replace VALUES(1, 'fourth fifth'); +SELECT id, vec FROM vector_replace; +id vec +1 FOURTH FIFTH +INSERT INTO vector_replace VALUES(1, 'sixth seventh') ON DUPLICATE KEY UPDATE vec = 'sixth seventh'; +SELECT id, vec FROM vector_replace; +id vec +1 SIXTH SEVENTH +UPDATE vector_replace SET vec = 'eighth nineth tenth'; +SELECT id, vec FROM vector_replace; +id vec +1 EIGHTH NINETH TENTH +DROP TABLE vector_replace; +DROP TABLE vector_replace_vec; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result new file mode 100644 index 00000000000..18318bdbc4e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_all.result @@ -0,0 +1,198 @@ +drop table if exists t1, t2, t3; +create table t1(c1 int, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); +select * from t1; +c1 c2 c3 +1 10 100 +2 30 500 +5 20 200 +3 60 300 +4 50 600 +6 40 400 +select c1 from t1; +c1 +1 +2 +5 +3 +4 +6 +select c2 from t1; +c2 +10 +30 +20 +60 +50 +40 +select c3 from t1; +c3 +100 +500 +200 +300 +600 +400 +select * from t1 where c1 <= 3; +c1 c2 c3 +1 10 100 +2 30 500 +3 60 300 +select * from t1 where c2 > 40; +c1 c2 c3 +3 60 300 +4 50 600 +select * from t1 where c3 = 300; +c1 c2 c3 +3 60 300 +select * from t1 order by c1; +c1 c2 c3 +1 10 100 +2 30 500 +3 60 300 +4 50 600 +5 20 200 +6 40 400 +select * from t1 order by c2 desc; +c1 c2 c3 +3 60 300 +4 50 600 +6 40 400 +2 30 500 +5 20 200 +1 10 100 +select * from t1 order by c3, c1; +c1 c2 c3 +1 10 100 +5 20 200 +3 60 300 +6 40 400 +2 30 500 +4 50 600 +drop table t1; +create table t1 (c1 int, c2 varchar(100)); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); +select * from t1; +c1 c2 +1 hoge +4 hogefuga +2 fuga +5 moge +3 mo +select * from t1 order by c1; +c1 c2 +1 hoge +2 fuga +3 mo +4 hogefuga +5 moge +select * from t1 order by c1 desc; +c1 c2 +5 moge +4 hogefuga +3 mo +2 fuga +1 hoge +select * from t1 order by c2; +c1 c2 +2 fuga +1 hoge +4 hogefuga +3 mo +5 moge +drop table t1; +create table t1 (c1 int, c2 text); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); +select * from t1; +c1 c2 +1 hoge +4 hogefuga +2 fuga +5 moge +3 mo +drop table t1; +create table t1 (c1 int, c2 int, c3 text); +insert into t1 values(1, 20, "hoge"); +insert into t1 values(4, 60, "hogefuga"); +insert into t1 values(2, 50, "fuga"); +insert into t1 values(5, 30, "moge"); +insert into t1 values(3, 40, "mo"); +select * from t1 order by c1 asc; +c1 c2 c3 +1 20 hoge +2 50 fuga +3 40 mo +4 60 hogefuga +5 30 moge +select * from t1 order by c1 desc; +c1 c2 c3 +5 30 moge +4 60 hogefuga +3 40 mo +2 50 fuga +1 20 hoge +select * from t1 order by c2 asc; +c1 c2 c3 +1 20 hoge +5 30 moge +3 40 mo +2 50 fuga +4 60 hogefuga +select * from t1 order by c2 desc; +c1 c2 c3 +4 60 hogefuga +2 50 fuga +3 40 mo +5 30 moge +1 20 hoge +select * from t1 order by c3 asc; +c1 c2 c3 +2 50 fuga +1 20 hoge +4 60 hogefuga +3 40 mo +5 30 moge +select * from t1 order by c3 desc; +c1 c2 c3 +5 30 moge +3 40 mo +4 60 hogefuga +1 20 hoge +2 50 fuga +drop table t1; +create table t1 (_id int, c1 int); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +5 100 +select * from t1 where _id < 3; +_id c1 +1 100 +2 100 +select * from t1 where _id >= 3; +_id c1 +3 100 +4 100 +5 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result new file mode 100644 index 00000000000..e0e3e21c620 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_equal.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS tags; +CREATE TABLE tags ( +name VARCHAR(16) NOT NULL, +KEY index_name (name) +); +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); +SELECT * FROM tags WHERE name = ""; +name + +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result new file mode 100644 index 00000000000..3732cb28184 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_empty_key_where_not_equal.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS tags; +CREATE TABLE tags ( +name VARCHAR(16) NOT NULL, +KEY index_name (name) +); +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); +SELECT * FROM tags WHERE name != ""; +name +mroonga +mysql +DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result new file mode 100644 index 00000000000..400156cec7b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_with_index.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +name varchar(40), +age int, +KEY (age) +); +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); +SELECT *, COUNT(*) FROM users GROUP BY age; +name age COUNT(*) +Alice 20 2 +Charry 29 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result new file mode 100644 index 00000000000..04f63d0e779 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_group_by_without_index.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +name varchar(40), +age int +); +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); +EXPLAIN SELECT *, COUNT(*) FROM users GROUP BY age; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE users ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +SELECT *, COUNT(*) FROM users GROUP BY age; +name age COUNT(*) +Alice 20 2 +Charry 29 1 +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result new file mode 100644 index 00000000000..99f69f49aba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_pkey.result @@ -0,0 +1,27 @@ +drop table if exists t1, t2, t3; +create table t1(c1 int primary key, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); +select * from t1 where c1=1; +c1 c2 c3 +1 10 100 +select * from t1 where c1=2; +c1 c2 c3 +2 30 500 +select * from t1 where c1=3; +c1 c2 c3 +3 60 300 +select * from t1 where c1=4; +c1 c2 c3 +4 50 600 +select * from t1 where c1=5; +c1 c2 c3 +5 20 200 +select * from t1 where c1=6; +c1 c2 c3 +6 40 400 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result b/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result new file mode 100644 index 00000000000..1c24089ef71 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/select_secondary_key.result @@ -0,0 +1,55 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 force index(idx1) where c2 = 30; +c1 c2 c3 +3 30 sa si su se so +select * from t1 force index(idx1) where c2 = 20; +c1 c2 c3 +2 20 ka ki ku ke ko +insert into t1 values(6,30,"aa bb cc dd ee"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +6 30 aa bb cc dd ee +select * from t1 force index(idx1) where c2 = 30; +c1 c2 c3 +3 30 sa si su se so +6 30 aa bb cc dd ee +drop table t1; +create table t1 (c1 varchar(5) primary key, c2 varchar(5), c3 text, key idx1(c2), fulltext index ft(c3))engine=mroonga; +insert into t1 values('ab','ijk',"aa ii uu ee oo"); +insert into t1 values('bc','ghi',"ka ki ku ke ko"); +insert into t1 values('cd','efg',"sa si su se so"); +insert into t1 values('de','cde',"ta ti tu te to"); +insert into t1 values('ef','abc',"aa ii uu ee oo"); +select * from t1 force index(idx1) where c2 < 'e' order by c1 asc; +c1 c2 c3 +de cde ta ti tu te to +ef abc aa ii uu ee oo +select * from t1 force index(idx1) where c2 > 'e' order by c1 asc; +c1 c2 c3 +ab ijk aa ii uu ee oo +bc ghi ka ki ku ke ko +cd efg sa si su se so +select * from t1 force index(idx1) where c2 between 'c' and 'h' order by c1 asc; +c1 c2 c3 +bc ghi ka ki ku ke ko +cd efg sa si su se so +de cde ta ti tu te to +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..ef87703e716 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/show_create_table_TODO_SPLIT_ME.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int primary key, c2 varchar(100)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` varchar(100) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result new file mode 100644 index 00000000000..4f24d0d74b0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/sub_query_fulltext.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS diaries, users; +CREATE TABLE users ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT +) DEFAULT CHARSET UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +user_id INT UNSIGNED NOT NULL, +title TEXT, +FULLTEXT INDEX (title) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(10) unsigned NOT NULL, + `title` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO users (name) VALUES ("alice"); +INSERT INTO users (name) VALUES ("bob"); +INSERT INTO users (name) VALUES ("carlos"); +SELECT * FROM users; +id name +1 alice +2 bob +3 carlos +INSERT INTO diaries (user_id, title) VALUES (1, "Hello!"); +INSERT INTO diaries (user_id, title) VALUES (2, "my name is bob"); +INSERT INTO diaries (user_id, title) VALUES (3, "my name is carlos"); +SELECT * FROM diaries; +id user_id title +1 1 Hello! +2 2 my name is bob +3 3 my name is carlos +SELECT * FROM users +WHERE id IN (SELECT user_id FROM diaries +WHERE MATCH(title) AGAINST("name")) +ORDER BY id DESC; +id name +3 carlos +2 bob +DROP TABLE diaries, users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result new file mode 100644 index 00000000000..f6c036bbf9f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/temporary_table.result @@ -0,0 +1,21 @@ +DROP TEMPORARY TABLE IF EXISTS diaries; +CREATE TEMPORARY TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TEMPORARY TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); +SELECT * FROM diaries; +id title +1 clear day +2 rainy day +3 cloudy day +DROP TEMPORARY TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result new file mode 100644 index 00000000000..0e33976eb17 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/truncate.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+TRUNCATE TABLE diaries; +SELECT * FROM diaries; +id year month day title content +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +id year month day title content +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 11 å¸°ã‚Šé“ ã¤ã‹ã‚ŒãŸãƒ¼ +2 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +3 2011 12 2 åˆé›ª 今年ã¯ã˜ã‚ã¦ã®é›ªï¼ +SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE); +id year month day title content +2 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result new file mode 100644 index 00000000000..bf81d5e0a8d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_fulltext.result @@ -0,0 +1,22 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +20 ta ti tu te +30 sa si su se +select * from t1 where match(c2) against("ti"); +c1 c2 +20 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result new file mode 100644 index 00000000000..35d8843afbe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_hash_index.result @@ -0,0 +1,20 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +update t1 set c1 = 200 where _id = 2; +select * from t1; +_id c1 +1 100 +2 200 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result new file mode 100644 index 00000000000..dba9c964270 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_id_unique_hash_index.result @@ -0,0 +1,20 @@ +drop table if exists t1, t2, t3; +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +_id c1 +1 100 +2 100 +3 100 +4 100 +update t1 set c1 = 200 where _id = 2; +select * from t1; +_id c1 +1 100 +2 200 +3 100 +4 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result new file mode 100644 index 00000000000..e022fa237bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_int.result @@ -0,0 +1,42 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int, c2 int); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL +) ENGINE=Mroonga DEFAULT CHARSET=latin1 +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +update t1 set c2=c2+100 where c1=1; +select * from t1; +c1 c2 +1 200 +2 101 +3 102 +update t1 set c2=c2+100 where c1=2; +select * from t1; +c1 c2 +1 200 +2 201 +3 102 +update t1 set c2=c2+100 where c1=3; +select * from t1; +c1 c2 +1 200 +2 201 +3 202 +flush tables; +update t1 set c1=5, c2=50; +select * from t1; +c1 c2 +5 50 +5 50 +5 50 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result new file mode 100644 index 00000000000..af5926313c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_last_insert_grn_id.result @@ -0,0 +1,29 @@ +drop table if exists memos; +create table memos ( +_id int, +content varchar(255), +unique key (_id) using hash +); +insert into memos values (null, "今夜ã¯ã•ã‚“ã¾ã€‚"); +insert into memos values (null, "明日ã¯groongaをアップデート。"); +insert into memos values (null, "帰りã«ãŠã ã‚“ã”。"); +insert into memos values (null, "金曜日ã¯è‚‰ã®æ—¥ã€‚"); +select * from memos; +_id content +1 今夜ã¯ã•ã‚“ã¾ã€‚ +2 明日ã¯groongaをアップデート。 +3 帰りã«ãŠã ã‚“ã”。 +4 金曜日ã¯è‚‰ã®æ—¥ã€‚ +insert into memos values (null, "冷蔵庫ã«ç‰›ä¹³ãŒæ®‹ã‚Š1本。"); +select last_insert_grn_id(); +last_insert_grn_id() +5 +update memos set content = "冷蔵庫ã«ç‰›ä¹³ã¯ã¾ã ãŸãã•ã‚“ã‚る。" where _id = last_insert_grn_id(); +select * from memos; +_id content +1 今夜ã¯ã•ã‚“ã¾ã€‚ +2 明日ã¯groongaをアップデート。 +3 帰りã«ãŠã ã‚“ã”。 +4 金曜日ã¯è‚‰ã®æ—¥ã€‚ +5 冷蔵庫ã«ç‰›ä¹³ã¯ã¾ã ãŸãã•ã‚“ã‚る。 +drop table memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result new file mode 100644 index 00000000000..11e6ee21949 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/update_virtual_column.result @@ -0,0 +1,28 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int, _id int); +insert into t1 values(1,null); +insert into t1 values(2,null); +insert into t1 values(3,null); +select * from t1; +c1 _id +1 1 +2 2 +3 3 +set sql_mode=""; +update t1 set _id = 10 where c1 = 1; +Warnings: +Warning 1265 Data truncated for column '_id' at row 1 +select * from t1; +c1 _id +1 1 +2 2 +3 3 +set sql_mode="strict_all_tables"; +update t1 set _id = 11 where c1 = 1; +ERROR 01000: Data truncated for column '_id' at row 1 +select * from t1; +c1 _id +1 1 +2 2 +3 3 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result new file mode 100644 index 00000000000..4536dded9d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_database_path_prefix.result @@ -0,0 +1,17 @@ +SET GLOBAL mroonga_database_path_prefix = "test/mroonga.data/"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_database_path_prefix'; +Variable_name Value +mroonga_database_path_prefix test/mroonga.data/ +CREATE DATABASE clean_test; +USE clean_test; +CREATE TABLE counts ( +id INT PRIMARY KEY AUTO_INCREMENT +); +INSERT INTO counts VALUES (NULL); +SELECT * FROM counts; +id +1 +DROP TABLE counts; +DROP DATABASE clean_test; +USE test; +SET GLOBAL mroonga_database_path_prefix = NULL; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result new file mode 100644 index 00000000000..959383ee6d9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_default_parser_backup = @@mroonga_default_parser; +SET GLOBAL mroonga_default_parser = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +Variable_name Value +mroonga_default_parser TokenBigramSplitAlpha +SET GLOBAL mroonga_default_parser = @mroonga_default_parser_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result new file mode 100644 index 00000000000..7f441b4b86d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_default_parser_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_default_parser = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +Variable_name Value +mroonga_default_parser TokenBigram diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result new file mode 100644 index 00000000000..6e690f45e61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_delete.result @@ -0,0 +1,28 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=true; +delete from diaries where id = 1; +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +delete from diaries where id = 1; +select * from diaries; +id body +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result new file mode 100644 index 00000000000..8de55efaccc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_insert.result @@ -0,0 +1,30 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result new file mode 100644 index 00000000000..dd3ee5b333c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_dry_write_update.result @@ -0,0 +1,26 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +insert into diaries (body) values ("will start groonga!"); +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 will start groonga! +set mroonga_dry_write=false; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 starting groonga... +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result new file mode 100644 index 00000000000..789316d83ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_disable.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = -1; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout -1 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result new file mode 100644 index 00000000000..029b1ab17f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_invalid.result @@ -0,0 +1,6 @@ +SET GLOBAL mroonga_lock_timeout = -2; +Warnings: +Warning 1292 Truncated incorrect mroonga_lock_timeout value: '-2' +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout -1 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result new file mode 100644 index 00000000000..f47a2e6625b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_no_retry.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = 0; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout 0 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result new file mode 100644 index 00000000000..6ec1004f752 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_lock_timeout_valid.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_lock_timeout = 1000; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; +Variable_name Value +mroonga_lock_timeout 1000 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result new file mode 100644 index 00000000000..db4694797b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_new_value.result @@ -0,0 +1,6 @@ +SET @mroonga_log_file_backup = @@mroonga_log_file; +SET GLOBAL mroonga_log_file = "new-mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file new-mroonga.log +SET GLOBAL mroonga_log_file = @mroonga_log_file_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result new file mode 100644 index 00000000000..1dbec1f850e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_nonexistent_path.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_log_file = "nonexistent/mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file groonga.log diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result new file mode 100644 index 00000000000..5824f09053e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_file_same_value.result @@ -0,0 +1,4 @@ +SET GLOBAL mroonga_log_file = "groonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +Variable_name Value +mroonga_log_file groonga.log diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..cb646eceaf3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_log_level_TODO_SPLIT_ME.result @@ -0,0 +1,49 @@ +set @mroonga_log_level_backup=@@mroonga_log_level; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NOTICE +set global mroonga_log_level=NONE; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NONE +set global mroonga_log_level=EMERG; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level EMERG +set global mroonga_log_level=ALERT; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level ALERT +set global mroonga_log_level=CRIT; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level CRIT +set global mroonga_log_level=ERROR; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level ERROR +set global mroonga_log_level=WARNING; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level WARNING +set global mroonga_log_level=NOTICE; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level NOTICE +set global mroonga_log_level=INFO; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level INFO +set global mroonga_log_level=DEBUG; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level DEBUG +set global mroonga_log_level=DUMP; +show global variables like 'mroonga_log_level'; +Variable_name Value +mroonga_log_level DUMP +set global mroonga_log_level=dummy; +ERROR 42000: Variable 'mroonga_log_level' can't be set to the value of 'dummy' +set session mroonga_log_level=NOTICE; +ERROR HY000: Variable 'mroonga_log_level' is a GLOBAL variable and should be set with SET GLOBAL +set global mroonga_log_level=@mroonga_log_level_backup; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result new file mode 100644 index 00000000000..04b22c22ea6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_global.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +SET GLOBAL mroonga_match_escalation_threshold = -1; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `tags` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result new file mode 100644 index 00000000000..25a1aba61e2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_match_escalation_threshold_session.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `tags` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +SET mroonga_match_escalation_threshold = -1; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result new file mode 100644 index 00000000000..f3c8f1e8628 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_vector_column_delimiter.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS document; +DROP TABLE IF EXISTS category; +CREATE TABLE category ( +category CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='default_tokenizer "TokenDelimit"'; +CREATE TABLE document ( +id INT NOT NULL, +title TEXT, +categories TEXT COMMENT 'flags "COLUMN_VECTOR", type "category"', +PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; +Variable_name Value +mroonga_vector_column_delimiter +INSERT INTO document VALUES(1, "Mroonga is the fastest search engine", "it database fulltext"); +SELECT id, title, categories FROM document; +id title categories +1 Mroonga is the fastest search engine IT DATABASE FULLTEXT +SET GLOBAL mroonga_vector_column_delimiter = ';'; +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; +Variable_name Value +mroonga_vector_column_delimiter ; +SELECT id, title, categories FROM document; +id title categories +1 Mroonga is the fastest search engine IT;DATABASE;FULLTEXT +DROP TABLE document; +DROP TABLE category; +SET GLOBAL mroonga_vector_column_delimiter = ' '; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result new file mode 100644 index 00000000000..aae83fe2b38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result @@ -0,0 +1,3 @@ +show variables like 'mroonga_version'; +Variable_name Value +mroonga_version 4.06 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in new file mode 100644 index 00000000000..26ff300a759 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in @@ -0,0 +1,3 @@ +show variables like 'mroonga_version'; +Variable_name Value +mroonga_version @MRN_VERSION@ diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.opt b/storage/mroonga/mysql-test/mroonga/storage/suite.opt new file mode 100644 index 00000000000..d5a1e5190a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/suite.opt @@ -0,0 +1 @@ +--loose-plugin-load-add=$HA_MROONGA_SO --loose-plugin-mroonga=ON diff --git a/storage/mroonga/mysql-test/mroonga/storage/suite.pm b/storage/mroonga/mysql-test/mroonga/storage/suite.pm new file mode 100644 index 00000000000..528ccc5d693 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/suite.pm @@ -0,0 +1,23 @@ +package My::Suite::Mroonga; + +@ISA = qw(My::Suite); + +return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or + $::mysqld_variables{'mroonga'} eq "ON"; + +sub is_default { 1 } + +my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql'; +my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins'; + +if (-d $groonga_normalizer_mysql_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_dir; +} +elsif (-d $groonga_normalizer_mysql_install_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_install_dir; +} + +bless { }; + diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test new file mode 100644 index 00000000000..e70dcb92e12 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_after.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries ADD title TEXT AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test new file mode 100644 index 00000000000..dac06ff6719 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_first.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries ADD title TEXT FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test new file mode 100644 index 00000000000..ebf8ac5d581 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multiple.test @@ -0,0 +1,50 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries + ADD COLUMN body TEXT FIRST, + ADD COLUMN published BOOLEAN AFTER id, + ADD COLUMN created_at DATETIME; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body, published, created_at) + VALUES ("groonga (1)", "starting groonga...", TRUE, "2014-2-9 02:09:00"); +INSERT INTO diaries (title, body, published, created_at) + VALUES ("groonga (2)", "started groonga.", FALSE, "2014-2-9 12:19:00"); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test new file mode 100644 index 00000000000..01f13799c02 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_plain.test @@ -0,0 +1,45 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test new file mode 100644 index 00000000000..c93ae13a19e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_flags.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; + +SELECT mroonga_command("dump"); + +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test new file mode 100644 index 00000000000..2f39d52777a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_with_type.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; + +SELECT mroonga_command("dump"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test new file mode 100644 index 00000000000..aee355fdfc1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test new file mode 100644 index 00000000000..1dd6b31fb64 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_unique_duplicated.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT +) DEFAULT CHARSET UTF8; + +INSERT INTO ids (id) values (1), (1); + +--error ER_DUP_UNIQUE +ALTER TABLE ids ADD UNIQUE INDEX (id); +SHOW CREATE TABLE ids; + +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test new file mode 100644 index 00000000000..ba06e55e1ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_key_multiple_column_with_data.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE scores ( + id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +ALTER TABLE scores ADD KEY property (name, score); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test new file mode 100644 index 00000000000..7b9fc783244 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_comment_not_for_mroonga.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs + CHANGE COLUMN + tag + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test new file mode 100644 index 00000000000..3a86d23facf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_have_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(32), + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE bugs CHANGE COLUMN title title VARCHAR(64); + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test new file mode 100644 index 00000000000..16e98a9769e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_after.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description TEXT AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test new file mode 100644 index 00000000000..86c94afd281 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_first.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description TEXT FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test new file mode 100644 index 00000000000..a9bbe403da1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_multiple.test @@ -0,0 +1,43 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries + CHANGE body description TEXT FIRST, + CHANGE title subject TEXT AFTER internal_id, + CHANGE id internal_id INT; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (subject, description) + VALUES ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test new file mode 100644 index 00000000000..12ba5606b25 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_column_rename_no_order.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +ALTER TABLE diaries CHANGE body description TEXT; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, description) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test new file mode 100644 index 00000000000..867c6722d36 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_engine.test @@ -0,0 +1,54 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries ENGINE = mroonga; +SHOW CREATE TABLE diaries; + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test new file mode 100644 index 00000000000..fd47d2a60f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -0,0 +1,49 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test new file mode 100644 index 00000000000..06cdb13ba16 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_create_fulltext.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + WHERE MATCH (title) AGAINST ("富士山"); + +CREATE FULLTEXT INDEX title_index on diaries (title); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test new file mode 100644 index 00000000000..d6e32e0f004 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_ujis.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES ujis; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "Å·µ¤"); +INSERT INTO diaries VALUES (3, "Éٻλ³"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("Éٻλ³"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("Éٻλ³"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test new file mode 100644 index 00000000000..fb89d678b75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_utf8.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test new file mode 100644 index 00000000000..2112828684a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_multiple_column.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test new file mode 100644 index 00000000000..f599767ab8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_normal.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test new file mode 100644 index 00000000000..4bc5fb1f643 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_primary.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test new file mode 100644 index 00000000000..ab990a549b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_truncate.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + first_name VARCHAR(32) NOT NULL, + last_name VARCHAR(32) NOT NULL, + KEY (first_name, last_name) +); + +INSERT INTO users VALUES("Taro", "Yamada"); +INSERT INTO users VALUES("Hanako", "Tanaka"); +INSERT INTO users VALUES("Joe", "Honda"); + +SELECT * FROM users; + +ALTER TABLE users DISABLE KEYS; +TRUNCATE users; + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test new file mode 100644 index 00000000000..b172ff303c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_updating.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + c1 int NOT NULL, + c2 text NOT NULL, + c3 int NOT NULL, + c4 int NOT NULL, + PRIMARY KEY(c1), + KEY idx1(c3,c4), + FULLTEXT KEY ft1(c2) +); +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test new file mode 100644 index 00000000000..549a5540450 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_multiple.test @@ -0,0 +1,45 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries + DROP COLUMN title, + DROP COLUMN body; +SHOW CREATE TABLE diaries; +SELECT * FROM diaries; + +INSERT INTO diaries () VALUES (); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test new file mode 100644 index 00000000000..1e7248125cf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_column_one.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +SELECT * FROM diaries; + +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test new file mode 100644 index 00000000000..992606b4f62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_drop_key_multiple_column_with_data.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE scores ( + id BIGINT(20) PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + KEY property (name, score) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +ALTER TABLE scores DROP KEY property; +SELECT * FROM scores + WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test new file mode 100644 index 00000000000..136acfcebf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test new file mode 100644 index 00000000000..e14400808e5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_ujis.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES ujis; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=ujis; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "Å·µ¤"); +INSERT INTO diaries VALUES (3, "Éٻλ³"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("Éٻλ³"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("Éٻλ³"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test new file mode 100644 index 00000000000..136acfcebf2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_utf8.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test new file mode 100644 index 00000000000..35e6366ed62 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_multiple_column.test @@ -0,0 +1,53 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test new file mode 100644 index 00000000000..ec45b48f61e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_normal.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test new file mode 100644 index 00000000000..b1ebb668391 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_primary.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test new file mode 100644 index 00000000000..fc07085df5b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_engine_decimal.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL(6, 3) +) ENGINE InnoDB DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +SELECT * FROM diaries; + +ALTER TABLE diaries ENGINE = mroonga; +SELECT * FROM diaries; + +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test new file mode 100644 index 00000000000..fb52105411d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_no_primary_key.test @@ -0,0 +1,39 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE memos ( + content varchar(32) +) DEFAULT CHARSET="utf8"; + +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); + +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; + +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test new file mode 100644 index 00000000000..3bcd1259236 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_normal.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT +) DEFAULT CHARSET="utf8"; + +INSERT INTO memos (content) values ("Starting Groonga..."); +INSERT INTO memos (content) values ("Started Groonga."); +INSERT INTO memos (content) values ("Starting Mroonga..."); + +ALTER TABLE memos ADD FULLTEXT INDEX content_index (content); +SHOW CREATE TABLE memos; + +SELECT * FROM memos WHERE MATCH(content) AGAINST("groonga"); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test new file mode 100644 index 00000000000..efd0d9928d2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_add_table.test @@ -0,0 +1,47 @@ +# Copyright(C) 2014 HAYASHI Kentaro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); + +SELECT * FROM bugs; + +ALTER TABLE bugs ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; + +SELECT * FROM bugs + WHERE MATCH(tags) AGAINST("Groonga"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test new file mode 100644 index 00000000000..ebc30945062 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_fulltext_drop_table.test @@ -0,0 +1,48 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags"', + FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO tags (name) VALUES ("Groonga"); +INSERT INTO bugs (id, tags) VALUES (1, "Groonga Mroonga"); + +ALTER TABLE bugs DROP INDEX bugs_tags_index; +ALTER TABLE bugs + ADD FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"'; + +SELECT * FROM bugs + WHERE MATCH(tags) AGAINST("Groonga"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test new file mode 100644 index 00000000000..710161397d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_after.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY body TEXT AFTER id; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test new file mode 100644 index 00000000000..a810b7457a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_first.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY body TEXT FIRST; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test new file mode 100644 index 00000000000..7dc75e180c1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_modify_column_no_order.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries MODIFY title VARCHAR(100); +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test new file mode 100644 index 00000000000..0c391219426 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_recreate_anonymous_index_at_once.test @@ -0,0 +1,51 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("survey", "will start mroonga!"); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries + DROP INDEX body, + ADD FULLTEXT INDEX (body); + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH (body) AGAINST ("+groonga" IN BOOLEAN MODE); + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test new file mode 100644 index 00000000000..20fa7f35463 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_rename_table.test @@ -0,0 +1,49 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, memos; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +SELECT * FROM memos + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +SHOW CREATE TABLE memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test new file mode 100644 index 00000000000..8a41792bdae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_spatial.test @@ -0,0 +1,150 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL +); + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + GeomFromText('POINT(139.711517 35.647701)')); + +ALTER TABLE shops ADD SPATIAL KEY location_index (location); + +SELECT id, name, AsText(location) AS location_text FROM shops + WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) + ORDER BY id; + +SHOW CREATE TABLE shops; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..8ce709b1187 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_TODO_SPLIT_ME.test @@ -0,0 +1,53 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int auto_increment, primary key(c1)); +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(10); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(6); +select c1 from t1 order by c1 desc limit 1; +insert into t1 values(null); +select c1 from t1 order by c1 desc limit 1; +drop table t1; + +create table t1 (c1 int, c2 int auto_increment, primary key(c1), key idx1(c2)); +insert into t1 values(1, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(2, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(3, 10); +select * from t1 order by c2 desc limit 1; +insert into t1 values(4, null); +select * from t1 order by c2 desc limit 1; +insert into t1 values(5, 6); +select * from t1 order by c2 desc limit 1; +insert into t1 values(6, null); +select * from t1 order by c2 desc limit 1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test new file mode 100644 index 00000000000..59727f4abaa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_table_param.test @@ -0,0 +1,49 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int auto_increment, primary key(c1)) auto_increment=34129; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +show create table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +insert into t1 values(10); +select c1 from t1 order by c1 desc; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +insert into t1 values(6); +select c1 from t1 order by c1 desc; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +truncate table t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +delete from t1; +insert into t1 values(null); +select c1 from t1 order by c1 desc; +rename table t1 to t2; +insert into t2 values(null); +select c1 from t2 order by c1 desc; +show create table t2; +drop table t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test new file mode 100644 index 00000000000..83f9f745019 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/auto_increment_text.test @@ -0,0 +1,33 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text +); +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..57d57347205 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/binlog_TODO_SPLIT_ME.test @@ -0,0 +1,53 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_log_bin.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +show variables like 'log_bin'; + +set binlog_format="STATEMENT"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="ROW"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="MIXED"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test new file mode 100644 index 00000000000..8b4c7d6eaf7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_general_ci_french.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_general_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("Je suis un garçon."); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test new file mode 100644 index 00000000000..6cebc9ebce9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_french.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_unicode_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("Je suis un garçon."); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("garcon"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test new file mode 100644 index 00000000000..dacb1cba74f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/collation_utf8_unicode_ci_japanese.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + content varchar(256) COLLATE utf8_unicode_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("ã²ã‚‰ãŒãªã¨ã‚«ã‚¿ã‚«ãƒŠã‚’覚ãˆã¾ã—ãŸã€‚"); + +SELECT * FROM diaries WHERE MATCH (content) AGAINST ("ã‹ãŸã‹ãª"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test new file mode 100644 index 00000000000..620d2a9fd56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_index_not_for_mroonga.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED, + INDEX (id) COMMENT 'ID search is required.' +) DEFAULT CHARSET=utf8; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test new file mode 100644 index 00000000000..695ac9cba61 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_comment_normal_not_for_mroonga.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test new file mode 100644 index 00000000000..fc2e58fdcd9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATE, + KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test new file mode 100644 index 00000000000..8dae21494db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_without_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) VALUES ("clear day", "2012-01-29"); +INSERT INTO diaries (title, created_at) VALUES ("rainy day", "2012-01-30"); +INSERT INTO diaries (title, created_at) VALUES ("cloudy day", "2012-01-31"); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE created_at BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test new file mode 100644 index 00000000000..b6225075959 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_date_zero_date.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATE +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01"); +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00"); + +SELECT * FROM timestamps; + +SELECT * FROM timestamps WHERE create_dt = "2012-01-01"; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test new file mode 100644 index 00000000000..9c3344cbe98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_2038.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-18 03:14:07', '2038-01-18 03:14:07'); +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-20 03:14:08', '2038-01-20 03:14:08'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test new file mode 100644 index 00000000000..61eecbb2ac8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_before_unix_epoch.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test new file mode 100644 index 00000000000..7bbfcbe7a3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_max.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test new file mode 100644 index 00000000000..2cc99562231 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_32bit_out_of_range.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test new file mode 100644 index 00000000000..75c757f147a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_2038.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-19 03:14:07', '2038-01-19 03:14:07'); +INSERT INTO diaries (title, created_at) + VALUES ('2038-01-19 03:14:08', '2038-01-19 03:14:08'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test new file mode 100644 index 00000000000..b2b30462ca9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test new file mode 100644 index 00000000000..661d145087c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_max.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('9999-12-31 23:59:59', '9999-12-31 23:59:59'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test new file mode 100644 index 00000000000..14a4483a96e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_55_out_of_range.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_version_55.inc +--source ../../include/mroonga/have_mysql.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test new file mode 100644 index 00000000000..6b90c39a853 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_version_56_or_later_out_of_range.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_version_56_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('2012', '2012'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test new file mode 100644 index 00000000000..ac10203a576 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_with_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME(6), + KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test new file mode 100644 index 00000000000..11a2b783038 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_fractional_seconds_without_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME(6) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01.111111"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45.333"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10.5555"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test new file mode 100644 index 00000000000..07b54bebc9d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_freebsd_before_unix_epoch.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_freebsd.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('1000-01-01 00:00:00', '1000-01-01 00:00:00'); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test new file mode 100644 index 00000000000..e1db5043319 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_null.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ('NULL', NULL); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test new file mode 100644 index 00000000000..992249b0fae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_with_index.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME, + KEY (created_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test new file mode 100644 index 00000000000..bc0b7b2e982 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_without_index.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at) + VALUES ("clear day", "2012-01-29 21:51:01"); +INSERT INTO diaries (title, created_at) + VALUES ("rainy day", "2012-01-30 01:23:45"); +INSERT INTO diaries (title, created_at) + VALUES ("cloudy day", "2012-01-31 08:32:10"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE created_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test new file mode 100644 index 00000000000..5c39086d452 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_zero_date.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timestamps; +--enable_warnings + +CREATE TABLE timestamps ( + id INT PRIMARY KEY AUTO_INCREMENT, + create_dt DATETIME +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE timestamps; + +INSERT INTO timestamps (create_dt) VALUES ("2012-00-01 00:00:00"); +INSERT INTO timestamps (create_dt) VALUES ("2012-01-00 00:00:00"); + +SELECT * FROM timestamps; + +SELECT * FROM timestamps WHERE create_dt = "2012-01-01 00:00:00"; + +DROP TABLE timestamps; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test new file mode 100644 index 00000000000..92636b4d773 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL(6, 3), + KEY (temperature) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test new file mode 100644 index 00000000000..b314342fdea --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_fractional_seconds_without_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL(6, 3) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21.281); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14.213); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17.821); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14.213" AND "17.821"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test new file mode 100644 index 00000000000..ffcf737fde9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL, + KEY (temperature) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test new file mode 100644 index 00000000000..d7df5c3c323 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_decimal_without_index.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + temperature DECIMAL +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, temperature) VALUES ("clear day", 21); +INSERT INTO diaries (title, temperature) VALUES ("rainy day", 14); +INSERT INTO diaries (title, temperature) VALUES ("cloudy day", 17); + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE temperature BETWEEN "14" AND "17"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test new file mode 100644 index 00000000000..0d96498ee04 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_less_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + size ENUM("small", "medium", "large"), + INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart for child", "small"); +INSERT INTO items VALUES ("leadies' coat", "medium"); +INSERT INTO items VALUES ("parka", "large"); +INSERT INTO items VALUES ("hat", "medium"); + +SELECT * FROM items; + +SELECT * FROM items WHERE size = "medium"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test new file mode 100644 index 00000000000..3f8b728105c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_enum_many_with_index.test @@ -0,0 +1,298 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + size ENUM("size1", + "size2", + "size3", + "size4", + "size5", + "size6", + "size7", + "size8", + "size9", + "size10", + "size11", + "size12", + "size13", + "size14", + "size15", + "size16", + "size17", + "size18", + "size19", + "size20", + "size21", + "size22", + "size23", + "size24", + "size25", + "size26", + "size27", + "size28", + "size29", + "size30", + "size31", + "size32", + "size33", + "size34", + "size35", + "size36", + "size37", + "size38", + "size39", + "size40", + "size41", + "size42", + "size43", + "size44", + "size45", + "size46", + "size47", + "size48", + "size49", + "size50", + "size51", + "size52", + "size53", + "size54", + "size55", + "size56", + "size57", + "size58", + "size59", + "size60", + "size61", + "size62", + "size63", + "size64", + "size65", + "size66", + "size67", + "size68", + "size69", + "size70", + "size71", + "size72", + "size73", + "size74", + "size75", + "size76", + "size77", + "size78", + "size79", + "size80", + "size81", + "size82", + "size83", + "size84", + "size85", + "size86", + "size87", + "size88", + "size89", + "size90", + "size91", + "size92", + "size93", + "size94", + "size95", + "size96", + "size97", + "size98", + "size99", + "size100", + "size101", + "size102", + "size103", + "size104", + "size105", + "size106", + "size107", + "size108", + "size109", + "size110", + "size111", + "size112", + "size113", + "size114", + "size115", + "size116", + "size117", + "size118", + "size119", + "size120", + "size121", + "size122", + "size123", + "size124", + "size125", + "size126", + "size127", + "size128", + "size129", + "size130", + "size131", + "size132", + "size133", + "size134", + "size135", + "size136", + "size137", + "size138", + "size139", + "size140", + "size141", + "size142", + "size143", + "size144", + "size145", + "size146", + "size147", + "size148", + "size149", + "size150", + "size151", + "size152", + "size153", + "size154", + "size155", + "size156", + "size157", + "size158", + "size159", + "size160", + "size161", + "size162", + "size163", + "size164", + "size165", + "size166", + "size167", + "size168", + "size169", + "size170", + "size171", + "size172", + "size173", + "size174", + "size175", + "size176", + "size177", + "size178", + "size179", + "size180", + "size181", + "size182", + "size183", + "size184", + "size185", + "size186", + "size187", + "size188", + "size189", + "size190", + "size191", + "size192", + "size193", + "size194", + "size195", + "size196", + "size197", + "size198", + "size199", + "size200", + "size201", + "size202", + "size203", + "size204", + "size205", + "size206", + "size207", + "size208", + "size209", + "size210", + "size211", + "size212", + "size213", + "size214", + "size215", + "size216", + "size217", + "size218", + "size219", + "size220", + "size221", + "size222", + "size223", + "size224", + "size225", + "size226", + "size227", + "size228", + "size229", + "size230", + "size231", + "size232", + "size233", + "size234", + "size235", + "size236", + "size237", + "size238", + "size239", + "size240", + "size241", + "size242", + "size243", + "size244", + "size245", + "size246", + "size247", + "size248", + "size249", + "size250", + "size251", + "size252", + "size253", + "size254", + "size255", + "size256"), + INDEX (size) +) ENGINE=Mroonga DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart for child", "size1"); +INSERT INTO items VALUES ("leadies' coat", "size1"); +INSERT INTO items VALUES ("parka", "size256"); +INSERT INTO items VALUES ("hat", "size256"); + +SELECT * FROM items; + +SELECT * FROM items WHERE size = "size1"; + +SELECT * FROM items WHERE size = "size256"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test new file mode 100644 index 00000000000..6efb3920695 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id__id.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +CREATE TABLE contents ( + _id INT, + content TEXT NOT NULL, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; +INSERT INTO contents (content) VALUES ('first'); +INSERT INTO contents (content) VALUES ('second'); +SELECT _id, content FROM contents; + +DROP TABLE contents; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test new file mode 100644 index 00000000000..9b2e59615f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga__id_invalid_id.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +--error ER_CANT_CREATE_TABLE +CREATE TABLE contents ( + _i INT, + content TEXT NOT NULL, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8; + +--disable_warnings +DROP TABLE IF EXISTS contents; +--enable_warnings + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test new file mode 100644 index 00000000000..805c744236f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_other_table.test @@ -0,0 +1,54 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE IF EXISTS mroonga; +--enable_warnings + +CREATE DATABASE mroonga; +USE mroonga; + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"', + FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); + +SELECT mroonga_command("dump"); + +SELECT *, MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE) AS score + FROM bugs + WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); + +DROP TABLE bugs; +DROP TABLE tags; + +DROP DATABASE mroonga; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test new file mode 100644 index 00000000000..91f204133dd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP DATABASE IF EXISTS mroonga; +--enable_warnings + +CREATE DATABASE mroonga; +USE mroonga; + +CREATE TABLE priorities ( + id INT PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + priority INT COMMENT 'type "priorities"', + INDEX bugs_priority_index (priority) COMMENT 'table "priorities"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, priority) VALUES (1, 10); +INSERT INTO bugs (id, priority) VALUES (2, 3); +INSERT INTO bugs (id, priority) VALUES (3, -2); + +SELECT mroonga_command("dump"); + +SELECT * + FROM bugs + WHERE priority = 3; + +DROP TABLE bugs; +DROP TABLE priorities; + +DROP DATABASE mroonga; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test new file mode 100644 index 00000000000..6e89c70c051 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_reference.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag TEXT COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test new file mode 100644 index 00000000000..059b8bc4bfa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_scalar_with_not_for_mroonga_comment.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag TEXT COMMENT 'It references to tags.name, type "tags"' +) DEFAULT CHARSET=utf8; + +SHOW FULL COLUMNS FROM bugs LIKE 'tag'; + +INSERT INTO bugs (id, tag) VALUES (1, "Linux"); +INSERT INTO bugs (id, tag) VALUES (2, "MySQL"); +INSERT INTO bugs (id, tag) VALUES (3, "groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test new file mode 100644 index 00000000000..0d3be3d663d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_order_by_with_function.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL Groonga"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL Mroonga"); +INSERT INTO bugs (id, tags) VALUES (3, "Ruby Rroonga"); + +SELECT * FROM tags ORDER BY SUBSTRING(name, 1, 1) ASC; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test new file mode 100644 index 00000000000..bb66e35f2d1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_vector_reference.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS tags, bugs; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR", type "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); + +SELECT * FROM bugs; +SELECT * FROM tags; + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test new file mode 100644 index 00000000000..aa33af05df3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_int_with_index_zero_value.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT KEY +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 200); +INSERT INTO items VALUES ("smile", 0); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price = 0; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test new file mode 100644 index 00000000000..9d7d40433d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_16_with_index.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "white,dark gray"); +INSERT INTO items VALUES ("parka", "chartreuse,orange"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "dark gray,white"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test new file mode 100644 index 00000000000..c555c4ced6a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_24_with_index.test @@ -0,0 +1,65 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,lawn green"); +INSERT INTO items VALUES ("parka", "gray,medium blue"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,lawn green"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test new file mode 100644 index 00000000000..0f772522eb6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_32_with_index.test @@ -0,0 +1,74 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet", + + "dark magenta", + "magenta", + "dark red", + "brown", + "firebrick", + "indian red", + "light coral", + "salmon"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white"); +INSERT INTO items VALUES ("hat", "white,dark violet"); +INSERT INTO items VALUES ("parka", "green,brown,red"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,dark violet"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test new file mode 100644 index 00000000000..6552c5da805 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_64_with_index.test @@ -0,0 +1,110 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white", + + "red", + "orange red", + "dark orange", + "orange", + "gold", + "yellow", + "chartreuse", + "lawn green", + + "green", + "spring green", + "medium spring green", + "cyan", + "deep sky blue", + "blue", + "medium blue", + "dark violet", + + "dark magenta", + "magenta", + "dark red", + "brown", + "firebrick", + "indian red", + "light coral", + "salmon", + + "light salmon", + "tomato", + "coral", + "dark salmon", + "rosy brown", + "sienna", + "saddle brown", + "chocolate", + + "peru", + "sandy brown", + "burlywood", + "tan", + "navajo white", + "wheat", + "dark goldenrod", + "goldenrod", + + "light goldenrod", + "pale goldenrod", + "cornsilk", + "dark khaki", + "khaki", + "lemon chiffon", + "dark olive green", + "olive drab", + + "yellow green", + "green yellow", + "light green", + "forest green", + "dark green", + "lime green", + "pale green", + "dark sea green"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,white,lawn green,dark violet"); +INSERT INTO items VALUES ("hat", "white,dark violet,yellow green"); +INSERT INTO items VALUES ("parka", "green,brown,red,lime green"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "white,dark violet,yellow green"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test new file mode 100644 index 00000000000..bd92f23deb0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_set_8_with_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + colors SET("black", + "dim gray", + "dark gray", + "gray", + "light gray", + "gainsboro", + "white smoke", + "white"), + INDEX (colors) +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE items; + +INSERT INTO items VALUES ("t-shart", "black,gray"); +INSERT INTO items VALUES ("hat", "dim gray,dark gray"); +INSERT INTO items VALUES ("parka", "white smoke,light gray"); + +SELECT * FROM items; + +SELECT * FROM items WHERE colors = "dim gray,dark gray"; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test new file mode 100644 index 00000000000..c8bd7df0a15 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_bigint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price BIGINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("house", 9223372036854775807); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -9223372036854775808); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 2147483648); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 2147483648; + +SELECT * FROM items WHERE price > 2147483647; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test new file mode 100644 index 00000000000..572f46ebbb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_int_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 2147483647); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -2147483647); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 16777216); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 16777216; + +SELECT * FROM items WHERE price > 16777215; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test new file mode 100644 index 00000000000..f43395cb0aa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_mediumint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price MEDIUMINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 8388607); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -8388608); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 32768); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 127; + +SELECT * FROM items WHERE price >= 32768; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test new file mode 100644 index 00000000000..4ddd446dc46 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_smallint_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price SMALLINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", -32768); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 20000); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 127; + +SELECT * FROM items WHERE price >= 128; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test new file mode 100644 index 00000000000..e2bca9328a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_signed_tinyint_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price TINYINT KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 120); +INSERT INTO items VALUES ("discount", -10); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test new file mode 100644 index 00000000000..2a920d7e387 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_fractional_seconds_with_index.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_fractional_seconds.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + average TIME(6), + max TIME(6), + KEY (average) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; + +INSERT INTO running_records (title, average, max) + VALUES ("normal condition", "01:00:00.000001", "01:05:00.000001"); +INSERT INTO running_records (title, average, max) + VALUES ("bad condition", "12:23:34.123456", "838:59:58.999999"); +INSERT INTO running_records (title, average, max) + VALUES ("record failure", "-838:59:59.000000", "-838:59:59.000000"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE average BETWEEN "00:59:59.999999" AND "100:10:10.101010"; + +SELECT * FROM running_records + WHERE average BETWEEN "-838:59:59.000000" AND "01:00:00.000001"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test new file mode 100644 index 00000000000..f5961825259 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_time_with_index.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + average TIME, + max TIME, + KEY (average) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; + +INSERT INTO running_records (title, average, max) + VALUES ("normal condition", "01:00:00", "01:05:00"); +INSERT INTO running_records (title, average, max) + VALUES ("bad condition", "12:23:34", "838:59:59"); +INSERT INTO running_records (title, average, max) + VALUES ("record failure", "-838:59:59", "-838:59:59"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE average BETWEEN "00:59:59" AND "100:10:10"; + +SELECT * FROM running_records + WHERE average BETWEEN "-838:59:59" AND "01:00:00"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test new file mode 100644 index 00000000000..6f5e0116eb7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_fractional_seconds_with_index.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_mariadb_55.inc +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at TIMESTAMP(6), + updated_at TIMESTAMP(6), + KEY (updated_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("clear day", + "2012-01-29 21:51:01.111111", + "2012-01-29 21:51:02.222222"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("rainy day", + "2012-01-30 01:23:45.333", + "2012-01-30 01:23:46.444"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("cloudy day", + "2012-01-31 08:32:10.5555", + "2012-01-31 08:32:11.6666"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE updated_at BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test new file mode 100644 index 00000000000..ae78befc466 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_timestamp_with_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + created_at TIMESTAMP, + updated_at TIMESTAMP, + KEY (updated_at) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("clear day", "2012-01-29 21:51:01", "2012-01-29 21:51:02"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("rainy day", "2012-01-30 01:23:45", "2012-01-30 01:23:46"); +INSERT INTO diaries (title, created_at, updated_at) + VALUES ("cloudy day", "2012-01-31 08:32:10", "2012-01-31 08:32:11"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE updated_at BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test new file mode 100644 index 00000000000..c658c873e02 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_tinyint_without_index.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists books; +--enable_warnings + +create table books(title varchar(255), published tinyint); +insert into books values ("MySQL", 1); +insert into books values ("groonga", 1); +insert into books values ("mroonga", 0); + +select count(*) from books where published = 0; +select count(*) from books where published = 1; +select count(*) from books where published != 2; +select count(*) from books where published != 1; + +drop table books; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test new file mode 100644 index 00000000000..1936842707c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price BIGINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("house", 18446744073709551615); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("super car", 9223372036854775808); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 9223372036854775808; + +SELECT * FROM items WHERE price > 9223372036854775807; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test new file mode 100644 index 00000000000..8ac9715ad76 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_bigint_without_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT UNSIGNED +) DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES (317173755057152000); +INSERT INTO ids VALUES (317173755057152002); + +SELECT * FROM ids; + +SELECT * FROM ids WHERE id = 317173755057152000; + +SELECT * FROM ids WHERE id = 317173755057152002; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test new file mode 100644 index 00000000000..a97024b48d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_int_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price INT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 4294967295); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 2147483648); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 2147483648; + +SELECT * FROM items WHERE price > 2147483647; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test new file mode 100644 index 00000000000..bec5917b410 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_mediumint_with_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price MEDIUMINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("car", 16777215); +INSERT INTO items VALUES ("note PC", 32767); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("bike", 8388607); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 8388608; + +SELECT * FROM items WHERE price >= 8388607; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test new file mode 100644 index 00000000000..8e389b98881 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_smallint_with_index.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price SMALLINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("note PC", 65535); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); +INSERT INTO items VALUES ("tablet PC", 32767); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 32768; + +SELECT * FROM items WHERE price >= 32767; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test new file mode 100644 index 00000000000..880bc2d7cd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_unsigned_tinyint_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + name VARCHAR(255), + price TINYINT UNSIGNED KEY +) DEFAULT CHARSET=utf8; + +INSERT INTO items VALUES ("hamburger", 255); +INSERT INTO items VALUES ("discount", 0); +INSERT INTO items VALUES ("coke", 100); + +SELECT * FROM items; + +SELECT * FROM items WHERE price <= 100; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test new file mode 100644 index 00000000000..a61dccc6439 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_with_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + party_year YEAR, + KEY (party_year) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; + +INSERT INTO aniversary_memos (title, party_year) + VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Wow! Today is the anniversary party day!", "13"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test new file mode 100644 index 00000000000..ce1e1c21921 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_year_without_index.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + party_year YEAR +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; + +INSERT INTO aniversary_memos (title, party_year) + VALUES ("We need a big cake!", "11"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Invitations are sent.", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Tommorow is the anniversary party day!", "2012"); +INSERT INTO aniversary_memos (title, party_year) + VALUES ("Wow! Today is the anniversary party day!", "13"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test new file mode 100644 index 00000000000..b731acda9c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_database_name_slash.test @@ -0,0 +1,60 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP DATABASE IF EXISTS `master/production`; +DROP DATABASE IF EXISTS `master/development`; +--enable_warnings + +CREATE DATABASE `master/production`; +USE `master/production`; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title) VALUES ("clear day (production)"); +INSERT INTO diaries (title) VALUES ("rainy day (production)"); +INSERT INTO diaries (title) VALUES ("cloudy day (production)"); + +SELECT * FROM diaries; + + +CREATE DATABASE `master/development`; +USE `master/development`; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; + +INSERT INTO diaries (title) VALUES ("clear day (development)"); +INSERT INTO diaries (title) VALUES ("rainy day (development)"); +INSERT INTO diaries (title) VALUES ("cloudy day (development)"); + +SELECT * FROM diaries; + + +USE test; + +DROP DATABASE `master/production`; +DROP DATABASE `master/development`; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..e448a66956f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_TODO_SPLIT_ME.test @@ -0,0 +1,147 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# simple test +create table t1 (c1 int); +create table t2 (c1 int); +create table t3 (c1 int); +drop table t1,t2,t3; +create table t1 (c1 int, c2 int, c3 int); +create table t2 (c1 int primary key, c2 int, c3 int); +drop table t1,t2; + +# data type support +create table t1 (c1 bit); +desc t1; +drop table t1; +create table t1 (c1 tinyint); +desc t1; +drop table t1; +create table t1 (c1 smallint); +desc t1; +drop table t1; +create table t1 (c1 mediumint); +desc t1; +drop table t1; +create table t1 (c1 int); +desc t1; +drop table t1; +create table t1 (c1 bigint); +desc t1; +drop table t1; +create table t1 (c1 double); +desc t1; +drop table t1; +create table t1 (c1 float); +desc t1; +drop table t1; +create table t1 (c1 decimal); +desc t1; +drop table t1; +create table t1 (c1 date); +desc t1; +drop table t1; +create table t1 (c1 time); +desc t1; +drop table t1; +create table t1 (c1 timestamp); +desc t1; +drop table t1; +create table t1 (c1 datetime); +desc t1; +drop table t1; +create table t1 (c1 year); +desc t1; +drop table t1; +create table t1 (c1 char(10)); +desc t1; +drop table t1; +create table t1 (c1 varchar(10)); +desc t1; +drop table t1; +create table t1 (c1 binary(10)); +desc t1; +drop table t1; +create table t1 (c1 varbinary(10)); +desc t1; +drop table t1; +create table t1 (c1 tinyblob); +desc t1; +drop table t1; +create table t1 (c1 blob); +desc t1; +drop table t1; +create table t1 (c1 mediumblob); +desc t1; +drop table t1; +create table t1 (c1 longblob); +desc t1; +drop table t1; +create table t1 (c1 tinytext); +desc t1; +drop table t1; +create table t1 (c1 text); +desc t1; +drop table t1; +create table t1 (c1 mediumtext); +desc t1; +drop table t1; +create table t1 (c1 longtext); +desc t1; +drop table t1; +create table t1 (c1 enum("yes","no")); +desc t1; +drop table t1; +create table t1 (c1 set("A","B","AB","O")); +desc t1; +drop table t1; + +# virtual columns +create table t1 (c1 int, `_id` int) engine = mroonga; +desc t1; +drop table t1; + +# error +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_score` float) engine = mroonga; + +# checking for virtual columns +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_id` text) engine = mroonga; +--error ER_CANT_CREATE_TABLE +create table t1 (c1 int, `_id` int, index(`_id`)) engine = mroonga; + +# index for _id +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, primary key (_id)); +create table t1 (_id int, c1 int, primary key (_id) using hash); +drop table t1; +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, unique key (_id)); +create table t1 (_id int, c1 int, unique key (_id) using hash); +drop table t1; +--error ER_CANT_CREATE_TABLE +create table t1 (_id int, c1 int, key (_id)); +create table t1 (_id int, c1 int, key (_id) using hash); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test new file mode 100644 index 00000000000..272485d3453 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_comment_normal.test @@ -0,0 +1,34 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED +) DEFAULT CHARSET=utf8 + COMMENT='Free style normal comment'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test new file mode 100644 index 00000000000..7c8cd3f32a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -0,0 +1,38 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +SELECT mroonga_command("dump"); + +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index.test new file mode 100644 index 00000000000..02e2cb9e81a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_fulltext_index.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); + +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.test new file mode 100644 index 00000000000..f28fb5b8695 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_no_utf8_charset_with_utf8_normalizer.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES latin1; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerMySQLGeneralCI"' +) DEFAULT CHARSET=latin1; + +--error ER_ERROR_ON_WRITE +INSERT INTO diaries VALUES ("2013-04-23", "I drunk a black cookie."); + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_table_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_table_comment.test new file mode 100644 index 00000000000..1da8026f56d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_normalizer_table_comment.test @@ -0,0 +1,46 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +DROP TABLE IF EXISTS terms; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY +) COMMENT='default_tokenizer "TokenBigram", normalizer "NormalizerAuto"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES (1, "1æ—¥ã®æ¶ˆè²»ãŒã¯ç´„2000㌔ãŒ"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+カロリー" IN BOOLEAN MODE); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test new file mode 100644 index 00000000000..eb1095e75a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_reference_type.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'type "tags"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE bugs; +DROP TABLE tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test new file mode 100644 index 00000000000..66bf9cef699 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_multiple_token_filters.test @@ -0,0 +1,40 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test new file mode 100644 index 00000000000..49a23ec6b74 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_index_comment_one_token_filter.test @@ -0,0 +1,40 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test new file mode 100644 index 00000000000..7d890aff9d3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_multiple_token_filters.test @@ -0,0 +1,45 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord,TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test new file mode 100644 index 00000000000..f391647a538 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_token_filters_table_comment_one_token_filter.test @@ -0,0 +1,45 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test new file mode 100644 index 00000000000..8707ce0e34b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_vector.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags TEXT COMMENT 'flags "COLUMN_VECTOR"' +) DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test new file mode 100644 index 00000000000..a43f5c6511b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_fulltext_column.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +select * from t1 where match(c2) against("ki"); +delete from t1 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test new file mode 100644 index 00000000000..224929fe308 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_btree_many_records.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE ids ( + id INT, + KEY (id) +) DEFAULT CHARSET UTF8; + +INSERT INTO ids VALUES(1); +INSERT INTO ids VALUES(2); +INSERT INTO ids VALUES(3); + +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 1; +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 2; +SELECT * FROM ids ORDER BY id; + +DELETE FROM ids WHERE id = 3; +SELECT * FROM ids ORDER BY id; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test new file mode 100644 index 00000000000..a23ca3bae5c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_no_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +delete from t1 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test new file mode 100644 index 00000000000..559b3a15be6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_index_hash_id_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +delete from t1 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test new file mode 100644 index 00000000000..2f94a8242d3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_normal_column.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int, c2 int); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; + +delete from t1 where c1=3; +select * from t1; + +flush tables; + +delete from t1 where c1=2; +select * from t1; + +delete from t1; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test new file mode 100644 index 00000000000..e174710934b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/delete_unsigned_bigint.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS numbers; +--enable_warnings + +CREATE TABLE numbers ( + data BIGINT UNSIGNED +); + +INSERT INTO numbers VALUES(18446744073709551615); + +SELECT * FROM numbers ORDER BY data; + +DELETE FROM numbers WHERE data = 18446744073709551615; +SELECT * FROM numbers ORDER BY data; + +DROP TABLE numbers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..74f840944f9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_database_TODO_SPLIT_ME.test @@ -0,0 +1,40 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop database if exists groonga; +--enable_warnings + +create database groonga; +drop database groonga; + +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop database groonga; + +create database groonga; +use groonga; +create table t1 (c1 int primary key, c2 varchar(255)) default charset utf8; +create table t2 (c1 int primary key, c2 varchar(255)) default charset utf8; +drop table t1, t2; +drop database groonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..a057f328453 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/drop_table_TODO_SPLIT_ME.test @@ -0,0 +1,29 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists alphabet, `with-hyphen`; +--enable_warnings + +create table alphabet (c1 int primary key, c2 int, c3 int); +drop table alphabet; + +create table `with-hyphen` (c1 int primary key, c2 int, c3 int); +drop table `with-hyphen`; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test new file mode 100644 index 00000000000..964217ae713 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/flush_logs.test @@ -0,0 +1,21 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +flush logs; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test new file mode 100644 index 00000000000..fe457562967 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_create.test @@ -0,0 +1,113 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_mysql_55.inc +--source ../../include/mroonga/skip_mariadb_55.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists articles2; +drop table if exists articles; +drop table if exists comments2; +drop table if exists comments; +--enable_warnings + +create table comments( + comment int unsigned, + content text not null, + primary key(comment) +); + +create table articles( + content text not null, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +insert into comments (comment, content) values +(1, 'aaa bbb'),(2, 'ccc ddd'),(3, 'eee fff'); + +insert into articles (content, comment) values +('111aaa', 1),('222bbb', 2),('222ccc', 2); + +select comment, content from comments; + +select content, comment from articles; + +show create table comments; + +show create table articles; + +select * from information_schema.referential_constraints; + +rename table comments to comments2; +rename table articles to articles2; + +create table comments( + comment int unsigned, + content text not null, + primary key(comment) +); + +create table articles( + content text not null, + comment int unsigned, + FOREIGN KEY (comment) REFERENCES comments (comment) +); + +insert into comments (comment, content) values +(1, 'ab'),(2, 'cd'),(3, 'ef'); + +insert into articles (content, comment) values +('1a', 1),('2b', 2),('2c', 2); + +select comment, content from comments; + +select content, comment from articles; + +select comment, content from comments2; + +select content, comment from articles2; + +show create table comments; + +show create table articles; + +show create table comments2; + +show create table articles2; + +select * from information_schema.referential_constraints; + +alter table articles drop foreign key comment; + +show create table articles; + +select content, comment from articles; + +alter table articles add FOREIGN KEY (comment) REFERENCES comments (comment); + +show create table articles; + +select content, comment from articles; + +drop table articles2; +drop table articles; +drop table comments2; +drop table comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test new file mode 100644 index 00000000000..75f1c3c38ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_empty_query.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST("" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test new file mode 100644 index 00000000000..1a27422aa81 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_escape.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("\\(groonga\\)*" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test new file mode 100644 index 00000000000..952749338ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_leading_not.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test new file mode 100644 index 00000000000..89adbd4b5f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test new file mode 100644 index 00000000000..76a72a5b865 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test new file mode 100644 index 00000000000..e2edfe780b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Yesterday was good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test new file mode 100644 index 00000000000..4d0f15b203a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test new file mode 100644 index 00000000000..ed93b543869 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test new file mode 100644 index 00000000000..3a078c7eccb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); +INSERT INTO memos VALUES ("Tomorrow will be fine."); +INSERT INTO memos VALUES ("Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test new file mode 100644 index 00000000000..fb2ec74a5e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test new file mode 100644 index 00000000000..30cf3e87491 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test new file mode 100644 index 00000000000..7268cc1921c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos VALUES ("Today is good day."); +INSERT INTO memos VALUES ("Tomorrow will be good day."); +INSERT INTO memos VALUES ("Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test new file mode 100644 index 00000000000..bec7944a82b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test new file mode 100644 index 00000000000..fa10ae7b73b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test new file mode 100644 index 00000000000..d7f1bde6ca4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test new file mode 100644 index 00000000000..6df0c13f111 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_ten_or_more_sections.test @@ -0,0 +1,63 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + title VARCHAR(255), + tag1 VARCHAR(10), + tag2 VARCHAR(10), + tag3 VARCHAR(10), + tag4 VARCHAR(10), + tag5 VARCHAR(10), + tag6 VARCHAR(10), + tag7 VARCHAR(10), + tag8 VARCHAR(10), + tag9 VARCHAR(10), + tag10 VARCHAR(10), + FULLTEXT INDEX (tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) +) DEFAULT CHARSET=utf8; + +INSERT INTO memos + VALUES("Groonga", + "tag 1", + "tag 2", + "tag 3", + "tag 4", + "tag 5", + "tag 6", + "tag 7", + "tag 8", + "tag 9", + "tag 10"); + +SELECT title, + MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) + AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE) AS score + FROM memos + WHERE MATCH(tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9, tag10) + AGAINST("*W1:2,2:4,3:6,4:8,5:10,6:12,7:14,8:16,9:18,10:20 +tag" + in BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test new file mode 100644 index 00000000000..9161ff6ff0d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_pragma_weight_three_or_more_sections.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + category VARCHAR(10), + content TEXT, + FULLTEXT INDEX (title, category, content) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES(1, "Hello", "日記", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気予報", "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "天気", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, category, content) + AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, category, content) + AGAINST("*W1:2,2:10,3:1 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test new file mode 100644 index 00000000000..f8d5e3fe6be --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +-- error ER_PARSE_ERROR +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test new file mode 100644 index 00000000000..1c0795bca58 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_error_and_log.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = ERROR_AND_LOG; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +-- error ER_PARSE_ERROR +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test new file mode 100644 index 00000000000..fef386cc42d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = "IGNORE"; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test new file mode 100644 index 00000000000..ac51f81a43a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_boolean_mode_syntax_error_ignore_and_log.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET GLOBAL mroonga_default_parser = TokenDelimit; +SET mroonga_action_on_fulltext_query_error = IGNORE_AND_LOG; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT PRIMARY KEY, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=UTF8; + +INSERT INTO memos VALUES(1, "(groonga) Installed!"); +INSERT INTO memos VALUES(2, "(mroonga) Installed!"); +INSERT INTO memos VALUES(3, "(groonga) Upgraded!"); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("(groonga" IN BOOLEAN MODE); + +DROP TABLE memos; + +SET GLOBAL mroonga_default_parser = TokenBigram; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test new file mode 100644 index 00000000000..42ef563105d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_ascii.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su"); +select * from t1 where match(c3) against("ii"); +select * from t1 where match(c3) against("+su" in boolean mode); +select * from t1 where match(c3) against("+ii" in boolean mode); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test new file mode 100644 index 00000000000..7396a66ecc0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_cp932.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä","‚ ‚ ‚ ‚ ‚ ‚ ‚ "); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("•xŽmŽR"); +select * from t1 where match(c3) against("•xŽmŽR"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test new file mode 100644 index 00000000000..2d8b094c43d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_eucjpms.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ","¤¢¤¢¤¢¤¢¤¢¤¢¤¢"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("Éٻλ³"); +select * from t1 where match(c3) against("Éٻλ³"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test new file mode 100644 index 00000000000..4b6ca756a29 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_japanese.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山"); +select * from t1 where match(c3) against("富士山"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test new file mode 100644 index 00000000000..d870affba4f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_charset_utf8mb4.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8mb4; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci, + content TEXT CHARSET utf8mb4 COLLATE utf8mb4_general_ci, + FULLTEXT INDEX (content) +) DEFAULT CHARSET utf8mb4; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "Alphabet", "ABCDE"); +INSERT INTO diaries VALUES(2, "Mathmatics", "ð€ðð‚ðƒð„ | U+1D400-U+1D405"); +INSERT INTO diaries VALUES(3, "ã²ã‚‰ãŒãª", "ã‚ã„ã†ãˆãŠ"); + +SELECT * + FROM diaries + WHERE MATCH (content) AGAINST("ABCDE" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test new file mode 100644 index 00000000000..59a274f942c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_empty_query.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST(""); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test new file mode 100644 index 00000000000..4d899201fb3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_found_rows.test @@ -0,0 +1,49 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT SQL_CALC_FOUND_ROWS * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SELECT FOUND_ROWS(); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test new file mode 100644 index 00000000000..19f82f644a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_groonga_varchar_vector.test @@ -0,0 +1,47 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs, tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(64) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COLLATE=utf8_bin + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tags VARCHAR(40) COMMENT 'type "tags", flags "COLUMN_VECTOR"', + FULLTEXT INDEX bugs_tags_index (tags) COMMENT 'table "tags"' +) DEFAULT CHARSET=utf8; + +INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL"); +INSERT INTO bugs (id, tags) VALUES (2, "MySQL groonga"); +INSERT INTO bugs (id, tags) VALUES (3, "mroonga"); + +SELECT * + FROM bugs + WHERE MATCH (tags) AGAINST ("MySQL" IN BOOLEAN MODE); + +DROP TABLE bugs, tags; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test new file mode 100644 index 00000000000..a8d4780fee3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_index_recreate.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title) +) default charset utf8; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title) against("富士山"); +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title) against("富士山"); +select * from diaries; +create fulltext index new_title_index on diaries (title); +select * from diaries where match(title) against("富士山"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test new file mode 100644 index 00000000000..641bbc3c4bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_select.test @@ -0,0 +1,45 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +select * from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +select * from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +select c1,c2,match(c2) against("ii") from t2 where match(c2) against("ii"); +drop table t1,t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test new file mode 100644 index 00000000000..0b52448bc45 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_insert_values.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)); +show create table t1; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test new file mode 100644 index 00000000000..9c083f57a80 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_delete.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test new file mode 100644 index 00000000000..ce2c2714e31 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_insert.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test new file mode 100644 index 00000000000..ffee108932a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_recreate.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +show create table diaries; + +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title, content) against("富士山"); + +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title, content) against("富士山"); + +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); + +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test new file mode 100644 index 00000000000..e9e6aa2bb6e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_column_index_update.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +update diaries set title = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒž" where id = 3; +update diaries set content = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±±" where id = 1; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test new file mode 100644 index 00000000000..19fd4f8d3ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_multiple_index.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + title text, + body text, + fulltext index title_index (title), + fulltext index body_index (body) +) default charset utf8; +show create table diaries; + +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); + +select * from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +select *, match(title) against("survey"), match(body) against("groonga") + from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test new file mode 100644 index 00000000000..7ef05efa3a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_no_primary_key.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES("Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES("天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES("富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("*D+ 今日 天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test new file mode 100644 index 00000000000..7b4e62ba0a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_not_match_against.test @@ -0,0 +1,46 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# for "not match against" +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select * from t1 where match(c3) against("uu"); +select * from t1 where not match(c3) against("uu"); +select * from t1 where match(c3) against("dummy"); +select * from t1 where not match(c3) against("dummy"); +select * from t1 where c1 = 4 and not match(c3) against("uu"); +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +select * from t1 where c1 > 4 and not match(c3) against("uu"); +select * from t1 where c2 = 10 and not match(c3) against("uu"); +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +select * from t1 where c2 < 15 and not match(c3) against("uu"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test new file mode 100644 index 00000000000..2b0f3bbb15c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_or.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT * + FROM diaries + WHERE MATCH(title) AGAINST("Ruby" IN BOOLEAN MODE) OR + MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_against.test new file mode 100644 index 00000000000..f2859f99dba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_against.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga mroonga" IN BOOLEAN MODE) + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_match.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_match.test new file mode 100644 index 00000000000..dc97db87487 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_different_match.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + body TEXT, + FULLTEXT KEY (title), + FULLTEXT KEY (body) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga", "I read groonga's tutorial."); +INSERT INTO diaries VALUES("Start mroonga", "I read mroonga's tutorial."); +INSERT INTO diaries VALUES("Start groonga and Ruby", "I installed rroonga."); + +SELECT * FROM diaries; + +SELECT *, MATCH(body) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) + ORDER BY MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_no_where.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_no_where.test new file mode 100644 index 00000000000..50dd652e2d0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_no_where.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_same_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_same_match_against.test new file mode 100644 index 00000000000..0873849a1e7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_order_same_match_against.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT * FROM diaries; + +SELECT *, MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) + ORDER BY MATCH(title) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test new file mode 100644 index 00000000000..24cc173485a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_comment.test @@ -0,0 +1,38 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) + comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) default charset utf8; +show create table diaries; +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +select * from diaries where match(body) against("start"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test new file mode 100644 index 00000000000..1e08cc46221 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_default.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set @mroonga_default_parser_backup=@@mroonga_default_parser; +set global mroonga_default_parser=TokenBigramSplitSymbolAlphaDigit; +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +show create table diaries; +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +insert into diaries (body) values ("finished groonga."); +select * from diaries; +select * from diaries where match(body) against("start"); +drop table diaries; +set global mroonga_default_parser=@mroonga_default_parser_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test new file mode 100644 index 00000000000..0dcf494c684 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_parser_off.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS variables; +--enable_warnings + +CREATE TABLE variables ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + FULLTEXT INDEX (name) COMMENT 'parser "off"' +) DEFAULT CHARSET=utf8; +SHOW CREATE TABLE variables; + +INSERT INTO variables (name) VALUES ("mroonga_database_path_prefix"); +INSERT INTO variables (name) VALUES ("mroonga_default_parser"); +INSERT INTO variables (name) VALUES ("mroonga_default_wrapper_engine"); +INSERT INTO variables (name) VALUES ("mroonga_dry_write"); +INSERT INTO variables (name) VALUES ("mroonga_enable_optimization"); +INSERT INTO variables (name) VALUES ("mroonga_libgroonga_version"); +INSERT INTO variables (name) VALUES ("mroonga_log_file"); +INSERT INTO variables (name) VALUES ("mroonga_log_level"); +INSERT INTO variables (name) VALUES ("mroonga_match_escalation_threshold"); +INSERT INTO variables (name) VALUES ("mroonga_version"); + +SELECT * FROM variables; +SELECT * FROM variables + WHERE MATCH (name) AGAINST ("mroonga_default*" IN BOOLEAN MODE); + +DROP TABLE variables; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test new file mode 100644 index 00000000000..b27fb5b70d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_token_filters_skip.test @@ -0,0 +1,52 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +CREATE TABLE terms ( + term VARCHAR(64) NOT NULL PRIMARY KEY, + is_stop_word BOOL NOT NULL +) COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"' DEFAULT CHARSET=utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content TEXT NOT NULL, + FULLTEXT INDEX (content) COMMENT 'table "terms"' +) DEFAULT CHARSET=utf8; + +INSERT INTO terms VALUES ("and", true); + +INSERT INTO memos VALUES (1, "Hello"); +INSERT INTO memos VALUES (2, "Hello and Good-bye"); +INSERT INTO memos VALUES (3, "Good-bye"); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("+\"Hello and\"" IN BOOLEAN MODE); + +DROP TABLE memos; +DROP TABLE terms; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test new file mode 100644 index 00000000000..745720d1fe6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_two_inner_join.test @@ -0,0 +1,69 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users, posts, comments; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + id int NOT NULL, + name varchar(50) NOT NULL, + PRIMARY KEY (id), + KEY (name) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE posts ( + id int NOT NULL, + content mediumtext, + user_id int NOT NULL, + PRIMARY KEY (id), + FULLTEXT KEY (content) +) DEFAULT CHARSET=utf8; + +CREATE TABLE comments ( + id int NOT NULL, + user_id int NOT NULL, + post_id int NOT NULL, + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"), + (2, "Bob"), + (3, "Calros"); +INSERT INTO posts VALUES (1, "Hello!", 1), + (2, "World!", 2), + (3, "Great!", 3); +INSERT INTO comments VALUES (1, 1, 1), + (2, 2, 1), + (3, 3, 3); + +SELECT * + FROM comments + INNER JOIN posts + ON posts.id = comments.post_id AND + MATCH (posts.content) AGAINST ("Hello!" IN BOOLEAN MODE) + INNER JOIN users + ON users.id = comments.user_id AND + users.name = "Alice"; + +DROP TABLE users, posts, comments; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test new file mode 100644 index 00000000000..aab09c18b79 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_100_no_such_key.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_100.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +-- error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test new file mode 100644 index 00000000000..d447b1f85dc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_55_no_such_key.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_55.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test new file mode 100644 index 00000000000..1187b189244 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/fulltext_version_56_no_such_key.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_56.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +-- error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries FORCE INDEX(primary) + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test new file mode 100644 index 00000000000..f1a1777d92b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_select.test @@ -0,0 +1,41 @@ +# Copyright(C) 2013 Kouhei Sutou +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT mroonga_command('select diaries --match_columns "title" --query "groonga"'); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test new file mode 100644 index 00000000000..a37e601e92d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_missing.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape() AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test new file mode 100644 index 00000000000..683efb7e25c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_query_is_not_string.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape(29) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test new file mode 100644 index 00000000000..5e04ae2a615 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_error_target_characters_is_not_string.test @@ -0,0 +1,27 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +-- error ER_CANT_INITIALIZE_UDF +SELECT mroonga_escape('+-><~*()\"\\:', 29) AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test new file mode 100644 index 00000000000..6d328fa8434 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_all.test @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:') AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test new file mode 100644 index 00000000000..2ad633b43f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_custom.test @@ -0,0 +1,26 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +SELECT mroonga_escape('+-><~*()\"\\:', '()<>~') AS escaped_query; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test new file mode 100644 index 00000000000..82f7410d909 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_escape_success_nested.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries( + title TEXT, + FULLTEXT KEY (title) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES("Start groonga"); +INSERT INTO diaries VALUES("Start mroonga"); +INSERT INTO diaries VALUES("Start groonga and Ruby"); + +SELECT mroonga_escape(mroonga_escape('*groonga*')); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test new file mode 100644 index 00000000000..ef6b0077976 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_grn_id.test @@ -0,0 +1,48 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); +insert into t1 values(null,100); +insert into t1 values(null,100); +select last_insert_grn_id(); + +--error ER_CANT_INITIALIZE_UDF +select last_insert_grn_id(1); + +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test new file mode 100644 index 00000000000..a515757ab55 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_reference.test @@ -0,0 +1,35 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +); + +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test new file mode 100644 index 00000000000..2eb75ac3b60 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_last_insert_id_set.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +); + +SELECT last_insert_id(); +SELECT last_insert_id(10); +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test new file mode 100644 index 00000000000..f273a38c13a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_ascii.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)); +insert into t1 values(1,10,"aa bb cc dd ee >< ff gg hh ii jj kk ll mm nn"); +insert into t1 values(2,20,"nn mm ll kk jj >< ii hh gg ff ee dd cc bb aa"); +insert into t1 values(3,30,"cc dd ee ff gg >< hh ii jj kk ll mm nn oo pp"); +insert into t1 values(4,40,"ee ff gg hh ii >< jj kk ll mm nn oo pp qq rr"); +insert into t1 values(5,50,"AA BB CC DD EE >< FF GG HH II JJ KK LL MM NN"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 1, '...', '...
\n', 'bb', '', '', 'ff', '', '', 'dd', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 0, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_general_ci', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'ascii_bin', 1, 0, '...', '...\n', 'bb', '(w1)[', ']', 'ff', '(w2)[', ']', 'dd', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test new file mode 100644 index 00000000000..eb67245e7c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_cp932.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932; +insert into t1 values(1, "‚ ‚ ‚ ‚ ‚ ","‚Q‚X“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä"); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","‚Q‚X“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "‚¤‚¤‚¤‚¤‚¤","29“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 1, '...', '...
\n', '‚Q‚X“ú', '', '', '“V‹C', '', '', '•xŽmŽR', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 0, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_japanese_ci', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'cp932_bin', 1, 0, '...', '...\n', '‚Q‚X“ú', '(w1)[', ']', '“V‹C', '(w2)[', ']', '•xŽmŽR', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test new file mode 100644 index 00000000000..8864d6adffc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_eucjpms.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms; +insert into t1 values(1, "¤¢¤¢¤¢¤¢¤¢","£²£¹Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","£²£¹Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "¤¦¤¦¤¦¤¦¤¦","29Æü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 1, '...', '...
\n', '£²£¹Æü', '', '', 'Å·µ¤', '', '', 'Éٻλ³', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 0, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_japanese_ci', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'eucjpms_bin', 1, 0, '...', '...\n', '£²£¹Æü', '(w1)[', ']', 'Å·µ¤', '(w2)[', ']', 'Éٻλ³', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test new file mode 100644 index 00000000000..bf6b4df5871 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_nonexistent_charset.test @@ -0,0 +1,28 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--error ER_CANT_INITIALIZE_UDF +SELECT mroonga_snippet("Invalid charset test", 10, 2, "nonexistent_charset", + 1, 0, "...", "...", "charset", "<", ">"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test new file mode 100644 index 00000000000..451737c900c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_invalid_unsupported_charset.test @@ -0,0 +1,28 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +SET NAMES UTF8; + +--error ER_CANT_INITIALIZE_UDF +SELECT mroonga_snippet("Unsuppported charset test", 10, 2, "big5", + 1, 0, "...", "...", "charset", "<", ">"); + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test new file mode 100644 index 00000000000..354d5f5a2d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_japanese.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012-2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8; +insert into t1 values(1, "ã‚ã‚ã‚ã‚ã‚","29日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","29日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "ã†ã†ã†ã†ã†","29æ—¥ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 1, '...', '...
\n', '29日', '', '', '天気', '', '', '富士山', '', '') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 0, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_general_ci', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +select c1, c2, mroonga_snippet(c3, 10, 2, 'utf8_bin', 1, 0, '...', '...\n', '29日', '(w1)[', ']', '天気', '(w2)[', ']', '富士山', '(w3)[', ']') from t1; +drop table t1; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test new file mode 100644 index 00000000000..39462257f9d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_bulk_insert_null.test @@ -0,0 +1,34 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + location GEOMETRY NOT NULL +); + +INSERT INTO shops VALUES (NULL), (NULL); + +SELECT AsText(location) FROM shops; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test new file mode 100644 index 00000000000..c8ec649f181 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/geometry_contains.test @@ -0,0 +1,148 @@ +# Copyright(C) 2011-2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL, + SPATIAL KEY location_index (location) +); +SHOW CREATE TABLE shops; + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + GeomFromText('POINT(139.711517 35.647701)')); + +SELECT id, name, AsText(location) AS location_text FROM shops; +SELECT id, name, AsText(location) AS location_text FROM shops + WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) + ORDER BY id; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test new file mode 100644 index 00000000000..2fd1fa7471c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_datetime.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + created_at datetime, + title varchar(256), + KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); + +SELECT * + FROM diaries FORCE INDEX(created_at_key) + WHERE created_at = "2012-10-25 16:18:29"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test new file mode 100644 index 00000000000..51737fcf375 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_time.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS timer; +--enable_warnings + +CREATE TABLE timer ( + id int PRIMARY KEY, + elapsed time, + KEY elapsed_key(elapsed) +); + +INSERT INTO timer VALUES (1, "00:00:00"); +INSERT INTO timer VALUES (2, "15:11:12"); +INSERT INTO timer VALUES (3, "838:59:59"); +INSERT INTO timer VALUES (4, "-838:59:59"); + +SELECT * + FROM timer FORCE INDEX(elapsed_key) + WHERE elapsed = "-838:59:59"; + +DROP TABLE timer; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test new file mode 100644 index 00000000000..f8848ce196d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_equal_timestamp.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + created_at timestamp, + title varchar(256), + KEY created_at_key(created_at) +) DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES ("1970-01-01 12:00:00", "The start"); +INSERT INTO diaries VALUES ("2012-10-05 16:18:29", "Today is shiny day."); +INSERT INTO diaries VALUES ("2038-01-18 15:14:07", "The end"); + +SELECT * + FROM diaries FORCE INDEX(created_at_key) + WHERE created_at = "2012-10-05 16:18:29"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test new file mode 100644 index 00000000000..0215807b9db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_btree_normal_column_insert.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, index using btree (c2)); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test new file mode 100644 index 00000000000..29a937054a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_normal.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, a int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +select * from t1 where _id = 2; +select * from t1 where _id = 20; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test new file mode 100644 index 00000000000..60ca970aa45 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_primary.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, a int, primary key (_id) using hash); +--error ER_BAD_NULL_ERROR +insert into t1 values(null, 100); +insert into t1 values(1,100); +insert into t1 values(1,100); +insert into t1 values(1,100); +insert into t1 values(1,100); +select * from t1; +select * from t1 where _id = 2; +select * from t1 where _id = 20; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test new file mode 100644 index 00000000000..28922bc3644 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_id_unique.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, a int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +select * from t1 where _id = 2; +select * from t1 where _id = 20; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test new file mode 100644 index 00000000000..5138c6c9698 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_hash_normal_column_insert.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, index using hash (c2)); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test new file mode 100644 index 00000000000..f39ead56541 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_delete.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + id int primary key auto_increment not null, + name char(30) not null, + score int not null, + index property (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test new file mode 100644 index 00000000000..055f2b20f22 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_smallint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 SMALLINT, + c2 SMALLINT, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test new file mode 100644 index 00000000000..9c9f3dfc283 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_bigint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 BIGINT UNSIGNED, + c2 BIGINT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test new file mode 100644 index 00000000000..c78aec6d6e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_int.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 INT UNSIGNED, + c2 INT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test new file mode 100644 index 00000000000..0b9b7dd3a3c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_unsigned_smallint.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 SMALLINT UNSIGNED, + c2 SMALLINT UNSIGNED, + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + (1999, 12), + (2000, 11), + (2001, 10), + (2002, 9), + (2003, 8), + (2004, 7), + (2005, 6), + (2006, 5), + (2007, 4), + (2008, 3), + (2009, 2), + (2010, 1); + +SELECT * FROM t1 WHERE c1 > 2005; +SELECT * FROM t1 WHERE c1 >= 2005; +SELECT * FROM t1 WHERE c1 = 2005; +SELECT * FROM t1 WHERE c1 <= 2005; +SELECT * FROM t1 WHERE c1 < 2005; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test new file mode 100644 index 00000000000..2307c490fda --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_nullable_varchar.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY AUTO_INCREMENT, + c1 VARCHAR(10), + c2 VARCHAR(10), + KEY idx1(c1, c2) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE t1; + +INSERT INTO t1 (c1, c2) VALUES + ('1999', '12'), + ('2000', '11'), + ('2001', '10'), + ('2002', '09'), + ('2003', '08'), + ('2004', '07'), + ('2005', '06'), + ('2006', '05'), + ('2007', '04'), + ('2008', '03'), + ('2009', '02'), + ('2010', '01'); + +SELECT * FROM t1 WHERE c1 > '2005'; +SELECT * FROM t1 WHERE c1 >= '2005'; +SELECT * FROM t1 WHERE c1 = '2005'; +SELECT * FROM t1 WHERE c1 <= '2005'; +SELECT * FROM t1 WHERE c1 < '2005'; + +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test new file mode 100644 index 00000000000..75e77b597e0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_delete.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + name char(30) not null, + score int not null, + primary key (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +delete from scores where name = "Taro Yamada" and score = 10; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test new file mode 100644 index 00000000000..0b3a7362c0e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_select_int.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + name char(30) not null, + score int not null, + primary key (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +select * from scores where name = "Taro Yamada"; +select * from scores where name = "Taro Yamada" and score = 29; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test new file mode 100644 index 00000000000..26c76dd5207 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_primary_update.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + name char(30) not null, + score int not null, + primary key (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test new file mode 100644 index 00000000000..aff138eb45e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at > "2014-09-11 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test new file mode 100644 index 00000000000..0177c1a1479 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_greater_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at >= "2014-09-11 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test new file mode 100644 index 00000000000..987db143da5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at < "2014-09-12 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test new file mode 100644 index 00000000000..0a4eded6710 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_range_not_used_in_order_by_less_than_or_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS items; +--enable_warnings + +CREATE TABLE items ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + score INT, + created_at DATETIME, + INDEX (score, created_at) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE items; + +INSERT INTO items (score, created_at) VALUES(1, "2014-09-10 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-11 00:00:00"); +INSERT INTO items (score, created_at) VALUES(2, "2014-09-12 00:00:00"); +INSERT INTO items (score, created_at) VALUES(3, "2014-09-13 00:00:00"); + +SELECT * + FROM items + WHERE score = 2 AND created_at <= "2014-09-12 00:00:00" + ORDER BY created_at DESC; + +DROP TABLE items; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test new file mode 100644 index 00000000000..90a1fdf6c49 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_recreate.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table listing ( + id int primary key auto_increment not null, + last_name char(30) not null, + first_name char(30) not null, + index name (last_name, first_name) +) default charset utf8; +show create table listing; + +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); + +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +drop index name on listing; +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +create index new_name_index on listing (last_name, first_name); +select * from listing + where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); + +drop table listing; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test new file mode 100644 index 00000000000..b5e592938a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_replace.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + INDEX property (NAME, SCORE) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores; +REPLACE scores (id, name, score) VALUES (3, "Taro Yamada", 28); +SELECT * FROM scores; +SELECT * FROM scores WHERE name = "Taro Yamada" AND (score >= -12 AND score < 29); + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test new file mode 100644 index 00000000000..4f9c60d14b2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_double.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS temperatures; +--enable_warnings + +CREATE TABLE temperatures ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(20), + temperature DOUBLE, + KEY temperature_index(temperature), + KEY multi_index(temperature, title) +); + +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); + +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +DROP TABLE temperatures; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test new file mode 100644 index 00000000000..941fddbc5a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_float.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS temperatures; +--enable_warnings + +CREATE TABLE temperatures ( + id INT PRIMARY KEY AUTO_INCREMENT, + title VARCHAR(20), + temperature FLOAT, + KEY temperature_index(temperature), + KEY multi_index(temperature, title) +); + +INSERT INTO temperatures VALUES (NULL, "Hot!", 28.2); +INSERT INTO temperatures VALUES (NULL, "Snow!", -2.8); +INSERT INTO temperatures VALUES (NULL, "Rainy!", 12.7); + +SELECT temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN 10 AND 30; +SELECT title, temperature FROM temperatures WHERE temperature BETWEEN -10 AND 20; + +DROP TABLE temperatures; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test new file mode 100644 index 00000000000..478be9a90db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_int.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS listing; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + INDEX property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 27); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores; + +SELECT * FROM scores WHERE score = 29; + +SELECT * FROM scores WHERE score = 29 AND name = "Taro Yamada"; + +SELECT * FROM scores WHERE (score >= -12 AND score < 29) AND name = "Taro Yamada"; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test new file mode 100644 index 00000000000..6e0278f3910 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_string.test @@ -0,0 +1,41 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table listing ( + id int primary key auto_increment not null, + last_name char(30) not null, + first_name char(30) not null, + index name (last_name, first_name) +) default charset utf8; +show create table listing; +insert into listing (last_name, first_name) values("Taro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Suzuki"); +insert into listing (last_name, first_name) values("Jiro", "Yamada"); +insert into listing (last_name, first_name) values("Taro", "Tanaka"); +select * from listing; +select * from listing where last_name = "Taro"; +select * from listing where last_name = "Taro" and first_name = "Suzuki"; +select * from listing where last_name = "Taro" and (first_name >= "S" and first_name <= "Y"); +drop table listing; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test new file mode 100644 index 00000000000..9822ec18f4a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_select_varchar.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists scores; +--enable_warnings + +set names utf8; +create table scores ( + given_name varchar(30) not null, + family_name varchar(30) not null, + score int not null, + primary key property (given_name, family_name, score) +) default charset utf8; +show create table scores; + +insert into scores values("Taro", "Yamada", 29); +insert into scores values("Taro", "Yamada", -12); +insert into scores values("Jiro", "Yamada", 27); +insert into scores values("Taro", "Yamada", 10); + +select * from scores; +select * from scores where given_name = "Taro" and family_name = "Yamada"; +select * from scores where given_name = "Taro" and family_name = "Yamada" and score = 29; +select * from scores where given_name = "Taro" and family_name = "Yamada" and (score >= -12 and score < 29); + +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test new file mode 100644 index 00000000000..b206333d28d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_32bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = "1000-01-01" AND end = "9999-12-31"; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test new file mode 100644 index 00000000000..c425b882482 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = "1000-01-01" AND end = "9999-12-31"; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test new file mode 100644 index 00000000000..ea095f1c085 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_index_read.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (2, "1000-01-01", "9999-12-31"); +INSERT INTO ranges VALUES (3, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (4, "9999-12-31", "1000-01-01"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test new file mode 100644 index 00000000000..b877ed2f01a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test new file mode 100644 index 00000000000..c3185bb0fdc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_32bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test new file mode 100644 index 00000000000..7fa17dbc2b3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test new file mode 100644 index 00000000000..ef3d9eee548 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25", "9999-12-31"); +INSERT INTO ranges VALUES (2, "1000-01-01", "2012-10-05"); +INSERT INTO ranges VALUES (3, "9999-12-31", "1000-01-01"); +INSERT INTO ranges VALUES (4, "1000-01-01", "9999-12-31"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test new file mode 100644 index 00000000000..58ec29f07e9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start DATE, + end DATE, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01", "2012-10-05"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test new file mode 100644 index 00000000000..efa0c0288bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (4, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test new file mode 100644 index 00000000000..55d910cc820 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test new file mode 100644 index 00000000000..5868ade2228 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_freebsd.inc +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "9999-12-31 23:59:59"); +INSERT INTO ranges VALUES (2, "1000-01-01 00:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "9999-12-31 23:59:59", "1000-01-01 00:00:00"); +INSERT INTO ranges VALUES (4, "1000-01-01 00:00:00", "9999-12-31 23:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test new file mode 100644 index 00000000000..ab9ed122862 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start datetime, + end datetime, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test new file mode 100644 index 00000000000..85645967fbd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_decimal.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int primary key, c2 decimal(65,30), c3 decimal(65,30), unique key uk1(c2,c3)); +insert into t1 values(1,123.456,0.000000000000000000000000000001); +insert into t1 values(2,-123.456,123.456); +insert into t1 values(3,98765432109876543210987654321098765.432109876543210987654321098765,-123.456); +insert into t1 values(4,-98765432109876543210987654321098765.432109876543210987654321098765,98765432109876543210987654321098765.432109876543210987654321098765); +insert into t1 values(5,0.000000000000000000000000000001,-98765432109876543210987654321098765.432109876543210987654321098765); +select c1, c2, c3 from t1 force index(uk1) where c2 = -98765432109876543210987654321098765.432109876543210987654321098765 and c3 = 98765432109876543210987654321098765.432109876543210987654321098765; +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +select c2, c3 from t1 force index(uk1) order by c2, c3; +--error ER_DUP_ENTRY +insert into t1 values(6,123.456,0.000000000000000000000000000001); +delete from t1 where c1 = 1; +insert into t1 values(1,123.456,0.000000000000000000000000000001); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test new file mode 100644 index 00000000000..f9b2d2b6f5c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_index_read.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (2, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (3, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (4, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test new file mode 100644 index 00000000000..94e2fa39946 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_asc.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test new file mode 100644 index 00000000000..d9d31cf3386 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_order_desc.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "15:11:12", "838:59:59"); +INSERT INTO ranges VALUES (2, "00:00:00", "15:11:11"); +INSERT INTO ranges VALUES (3, "838:59:59", "00:00:00"); +INSERT INTO ranges VALUES (4, "00:00:00", "838:59:59"); +INSERT INTO ranges VALUES (5, "-838:59:59", "838:59:59"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test new file mode 100644 index 00000000000..e0a18ae792b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_time_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start time, + end time, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "13:21:48", "15:11:12"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test new file mode 100644 index 00000000000..c660f6aef6e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_index_read.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp, + end timestamp, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (3, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (4, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test new file mode 100644 index 00000000000..5ec630b56df --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp, + end timestamp, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test new file mode 100644 index 00000000000..9ca7440da88 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_order_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp, + end timestamp, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2012-10-25 16:18:29", "2038-01-18 15:14:07"); +INSERT INTO ranges VALUES (2, "1970-01-01 12:00:00", "2012-10-05 16:18:29"); +INSERT INTO ranges VALUES (3, "2038-01-18 15:14:07", "1970-01-01 12:00:00"); +INSERT INTO ranges VALUES (4, "1970-01-01 12:00:00", "2038-01-18 15:14:07"); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test new file mode 100644 index 00000000000..559cf958804 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_timestamp_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id int PRIMARY KEY, + start timestamp, + end timestamp, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, "2010-01-01 00:00:00", "2012-10-05 23:59:59"); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test new file mode 100644 index 00000000000..900de61feac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_varchar.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(10), c3 varchar(10), unique key uk1(c2,c3)) default charset=utf8 collate utf8_bin; +insert into t1 values(1,'abcde','abc '); +insert into t1 values(2,'abc\0','abcde'); +insert into t1 values(3,'abc','abc\0'); +insert into t1 values(4,'abc ','abc'); +insert into t1 values(5,'abc ','abc '); +select c1, c2, c3 from t1 force index(uk1) where c2 = 'abc ' and c3 = 'abc'; +select c1, c2, c3 from t1 force index(uk1) order by c2, c3; +select c1, c2, c3 from t1 force index(uk1) order by c2 desc, c3 desc; +select c2, c3 from t1 force index(uk1) order by c2, c3; +--error ER_DUP_ENTRY +insert into t1 values(6,'abcde','abc '); +delete from t1 where c1 = 1; +insert into t1 values(1,'abcde','abc '); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test new file mode 100644 index 00000000000..3daf3fa4153 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_32bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = 1901 AND end = 2155; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test new file mode 100644 index 00000000000..57ab0534147 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_64bit_equal.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); + +SELECT * FROM ranges FORCE INDEX(range_key) + WHERE start = 1901 AND end = 2155; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test new file mode 100644 index 00000000000..efa92728a63 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_index_read.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 1901, 2012); +INSERT INTO ranges VALUES (2, 1901, 2155); +INSERT INTO ranges VALUES (3, 2012, 2155); +INSERT INTO ranges VALUES (4, 2155, 1901); + +SELECT start, end + FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test new file mode 100644 index 00000000000..774c06772a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test new file mode 100644 index 00000000000..bd0d20fe973 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_32bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_32bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test new file mode 100644 index 00000000000..225188e05c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_asc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start, end; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test new file mode 100644 index 00000000000..dcf905e9286 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_order_64bit_desc.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_64bit.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2012, 2155); +INSERT INTO ranges VALUES (2, 1901, 2012); +INSERT INTO ranges VALUES (3, 2155, 1901); +INSERT INTO ranges VALUES (4, 1901, 2155); + +SELECT * FROM ranges FORCE INDEX(range_key) + ORDER BY start DESC, end DESC; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test new file mode 100644 index 00000000000..250ef00b5b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_year_reinsert.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ranges; +--enable_warnings + +CREATE TABLE ranges ( + id INT PRIMARY KEY, + start YEAR, + end YEAR, + UNIQUE KEY range_key(start, end) +); + +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; + +DELETE FROM ranges WHERE id = 1; +INSERT INTO ranges VALUES (1, 2010, 2012); +SELECT * FROM ranges; + +DROP TABLE ranges; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test new file mode 100644 index 00000000000..e1efd0c992c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_int.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +CREATE TABLE scores ( + id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, + name CHAR(30) NOT NULL, + score INT NOT NULL, + KEY property (score, name) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE scores; + +INSERT INTO scores (name, score) VALUES("Taro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", -12); +INSERT INTO scores (name, score) VALUES("Jiro Yamada", 29); +INSERT INTO scores (name, score) VALUES("Taro Yamada", 10); + +SELECT * FROM scores WHERE score = 29; + +UPDATE scores SET name = "Saburo YAMADA" WHERE id = 3; +SELECT * FROM scores WHERE score = 29; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test new file mode 100644 index 00000000000..bcbbe82914b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_update_string.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists listing; +--enable_warnings + +set names utf8; +create table scores ( + id int primary key auto_increment not null, + name char(30) not null, + score int not null, + index property (name, score) +) default charset utf8; +show create table scores; +insert into scores (name, score) values("Taro Yamada", 29); +insert into scores (name, score) values("Taro Yamada", -12); +insert into scores (name, score) values("Jiro Yamada", 27); +insert into scores (name, score) values("Taro Yamada", 10); +select * from scores; +update scores set name = "Taro Yamada" where name = "Jiro Yamada" and score = 27; +select * from scores where name = "Taro Yamada" and (score >= -12 and score < 29); +drop table scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test new file mode 100644 index 00000000000..ba52b4b4138 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_exact_length.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(10) CHARACTER SET latin1 PRIMARY KEY +); + +INSERT INTO ids VALUES('abcdefghij'); +INSERT INTO ids VALUES('klmnopqrst'); +INSERT INTO ids VALUES('uvwxyz0123'); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = 'abcdefghij'; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test new file mode 100644 index 00000000000..bded856812c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_null_character.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(7) CHARACTER SET latin1 COLLATE latin1_bin PRIMARY KEY +); + +INSERT INTO ids VALUES("\0abcdef"); +INSERT INTO ids VALUES("ab\0cdef"); +INSERT INTO ids VALUES("abcd\0ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "ab\0cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test new file mode 100644 index 00000000000..ae8c40b82c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_char_short.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id char(6) CHARACTER SET latin1 PRIMARY KEY +); + +INSERT INTO ids VALUES("abcdef"); +INSERT INTO ids VALUES( "cdef"); +INSERT INTO ids VALUES( "ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test new file mode 100644 index 00000000000..e57a8491d99 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_date.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (day, title) VALUES ("2012-01-29", "clear day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-30", "rainy day"); +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "cloudy day"); +--error ER_DUP_ENTRY +INSERT INTO diaries (day, title) VALUES ("2012-01-31", "duplicated day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29" AND "2012-01-30"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test new file mode 100644 index 00000000000..7f140bf24c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_with_fractional_seconds.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATETIME(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (day, title) + VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test new file mode 100644 index 00000000000..1986e4db3db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_datetime_without_fractional_seconds.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATETIME PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (day, title) + VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (day, title) + VALUES ("2012-01-31 08:32:10", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE day BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test new file mode 100644 index 00000000000..d296285b391 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_with_fractional_seconds.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS releases; +--enable_warnings + +CREATE TABLE releases ( + version DECIMAL(6, 3) PRIMARY KEY, + message TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE releases; + +INSERT INTO releases (version, message) VALUES (10.000, "10th release!"); +INSERT INTO releases (version, message) VALUES (10.001, "minor fix."); +INSERT INTO releases (version, message) VALUES (999.999, "the last release!"); + +SELECT * FROM releases; + +SELECT * FROM releases WHERE version BETWEEN "9.000" AND "10.001"; + +DROP TABLE releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test new file mode 100644 index 00000000000..956b9800650 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_decimal_without_fractional_seconds.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS releases; +--enable_warnings + +CREATE TABLE releases ( + version DECIMAL PRIMARY KEY, + message TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE releases; + +INSERT INTO releases (version, message) VALUES (1, "the first release!!!"); +INSERT INTO releases (version, message) VALUES (10, "10th release!"); +INSERT INTO releases (version, message) VALUES (999, "the last release!"); + +SELECT * FROM releases; + +SELECT * FROM releases WHERE version BETWEEN "1" AND "10"; + +DROP TABLE releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test new file mode 100644 index 00000000000..90e668e1e38 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_with_fractional_seconds.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_fractional_seconds.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + time TIME(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; + +INSERT INTO running_records (time, title) + VALUES ("01:00:00.000001", "normal condition"); +INSERT INTO running_records (time, title) + VALUES ("12:23:34.123456", "bad condition"); +INSERT INTO running_records (time, title) + VALUES ("-838:59:59.000000", "record failure"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE time BETWEEN "00:59:59.999999" AND "12:23:34.123456"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test new file mode 100644 index 00000000000..f000f7390f6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_time_without_fractional_seconds.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS running_records; +--enable_warnings + +CREATE TABLE running_records ( + time TIME PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE running_records; + +INSERT INTO running_records (time, title) + VALUES ("01:00:00", "normal condition"); +INSERT INTO running_records (time, title) + VALUES ("12:23:34", "bad condition"); +INSERT INTO running_records (time, title) + VALUES ("-838:59:59", "record failure"); + +SELECT * FROM running_records; + +SELECT * FROM running_records + WHERE time BETWEEN "00:59:59" AND "12:23:34"; + +DROP TABLE running_records; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test new file mode 100644 index 00000000000..aba635ad637 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_with_fractional_seconds.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_mariadb_55.inc +--source ../../include/mroonga/have_fractional_seconds.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + time TIMESTAMP(6) PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (time, title) + VALUES ("2012-01-29 21:51:01.111111", "clear day"); +INSERT INTO diaries (time, title) + VALUES ("2012-01-30 01:23:45.333", "rainy day"); +INSERT INTO diaries (time, title) + VALUES ("2012-01-31 08:32:10.5555", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE time BETWEEN "2012-01-29 00:00:00.123456" AND + "2012-01-31 00:00:00.999999"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test new file mode 100644 index 00000000000..ae61434c795 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_timestamp_without_fractional_seconds.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + time TIMESTAMP PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (time, title) VALUES ("2012-01-29 21:51:01", "clear day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-30 01:23:45", "rainy day"); +INSERT INTO diaries (time, title) VALUES ("2012-01-31 08:32:10", "cloudy day"); + +SELECT * FROM diaries; + +SELECT * FROM diaries + WHERE time BETWEEN "2012-01-29 00:00:00" AND "2012-01-31 00:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test new file mode 100644 index 00000000000..20ae939be8b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_varchar_null_character.test @@ -0,0 +1,37 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id varchar(7) CHARACTER SET latin1 COLLATE latin1_bin PRIMARY KEY +); + +INSERT INTO ids VALUES("\0abcdef"); +INSERT INTO ids VALUES("ab\0cdef"); +INSERT INTO ids VALUES("abcd\0ef"); + +SELECT * FROM ids FORCE INDEX(PRIMARY) ORDER BY id; + +SELECT * FROM ids FORCE INDEX(PRIMARY) WHERE id = "ab\0cdef"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test new file mode 100644 index 00000000000..25f02d38e94 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_primary_year.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS aniversary_memos; +--enable_warnings + +CREATE TABLE aniversary_memos ( + party_year YEAR PRIMARY KEY, + title TEXT +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE aniversary_memos; + +INSERT INTO aniversary_memos (party_year, title) + VALUES ("11", "We need a big cake!"); +INSERT INTO aniversary_memos (party_year, title) + VALUES ("2012", "Invitations are sent."); +INSERT INTO aniversary_memos (party_year, title) + VALUES ("13", "Wow! Today is the anniversary party day!"); + +SELECT * FROM aniversary_memos; + +SELECT * FROM aniversary_memos + WHERE party_year BETWEEN "12" AND "2013"; + +DROP TABLE aniversary_memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_asc.test new file mode 100644 index 00000000000..a622dfbf70d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id > 1 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_desc.test new file mode 100644 index 00000000000..63dc820ccfd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id > 3 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_asc.test new file mode 100644 index 00000000000..a51e6c5da47 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id >= 2 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_desc.test new file mode 100644 index 00000000000..ea5c150bf0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_greater_than_or_equal_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id >= 3 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_asc.test new file mode 100644 index 00000000000..12761c0f4d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_desc.test new file mode 100644 index 00000000000..a4f4a781ead --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id < 4 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_asc.test new file mode 100644 index 00000000000..2fba0d13f5f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_asc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id ASC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_desc.test new file mode 100644 index 00000000000..e4661fc7047 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_range_less_than_or_equal_desc.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +SET NAMES UTF8; + +CREATE TABLE ids ( + id INT(10) UNSIGNED PRIMARY KEY AUTO_INCREMENT +) ENGINE=Mroonga DEFAULT CHARSET=utf8; + +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); +INSERT INTO ids VALUES(); + +SELECT * FROM ids WHERE ids.id <= 4 ORDER BY ids.id DESC LIMIT 3; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test new file mode 100644 index 00000000000..53111b576d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT, + value BIGINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test new file mode 100644 index 00000000000..5e93137afeb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_bigint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id BIGINT UNSIGNED, + value BIGINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test new file mode 100644 index 00000000000..0ca7d948318 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_double.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id DOUBLE, + value DOUBLE, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test new file mode 100644 index 00000000000..ade89f6bc56 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_float.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id FLOAT, + value FLOAT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1.1, 16.16); +INSERT INTO ids VALUES ( -2.2, 8.8); +INSERT INTO ids VALUES ( -4.4, 4.4); +INSERT INTO ids VALUES ( -8.8, 2.2); +INSERT INTO ids VALUES (-16.6, 1.1); +INSERT INTO ids VALUES ( 16.6, -1.1); +INSERT INTO ids VALUES ( 8.8, -2.2); +INSERT INTO ids VALUES ( 4.4, -4.4); +INSERT INTO ids VALUES ( 2.2, -8.8); +INSERT INTO ids VALUES ( 1.1, -16.16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4.5 AND 8.9; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test new file mode 100644 index 00000000000..9ed4979fd8f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int.test @@ -0,0 +1,46 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + value INT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test new file mode 100644 index 00000000000..f68c2f6906c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_int_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT UNSIGNED, + value INT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test new file mode 100644 index 00000000000..254345b6ec6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id MEDIUMINT, + value MEDIUMINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test new file mode 100644 index 00000000000..8975c5120cb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_mediumint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id MEDIUMINT UNSIGNED, + value MEDIUMINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test new file mode 100644 index 00000000000..4ed8c4b366e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id SMALLINT, + value SMALLINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test new file mode 100644 index 00000000000..ef5da3e79c9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_smallint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id SMALLINT UNSIGNED, + value SMALLINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test new file mode 100644 index 00000000000..5c738fa567b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id TINYINT, + value TINYINT, + KEY (id, value) +); + +INSERT INTO ids VALUES ( -1, 16); +INSERT INTO ids VALUES ( -2, 8); +INSERT INTO ids VALUES ( -4, 4); +INSERT INTO ids VALUES ( -8, 2); +INSERT INTO ids VALUES (-16, 1); +INSERT INTO ids VALUES ( 16, -1); +INSERT INTO ids VALUES ( 8, -2); +INSERT INTO ids VALUES ( 4, -4); +INSERT INTO ids VALUES ( 2, -8); +INSERT INTO ids VALUES ( 1, -16); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN -4 AND 8; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test new file mode 100644 index 00000000000..7f17f0031db --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_tinyint_unsigned.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id TINYINT UNSIGNED, + value TINYINT UNSIGNED, + KEY (id, value) +); + +INSERT INTO ids VALUES ( 1, 1); +INSERT INTO ids VALUES ( 2, 2); +INSERT INTO ids VALUES ( 4, 3); +INSERT INTO ids VALUES ( 8, 4); +INSERT INTO ids VALUES (16, 5); +INSERT INTO ids VALUES (32, 6); +INSERT INTO ids VALUES (64, 7); +INSERT INTO ids VALUES (128, 8); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 4 AND 32; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test new file mode 100644 index 00000000000..ccd53a95237 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar.test @@ -0,0 +1,44 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(5), + value VARCHAR(10), + KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test new file mode 100644 index 00000000000..1d799e76696 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_multiple_varchar_collation.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(5), + value VARCHAR(10), + KEY (id, value) +) DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci; + +INSERT INTO ids VALUES ("abc", "Abc"); +INSERT INTO ids VALUES ("acd", "aBc"); +INSERT INTO ids VALUES ("ade", "abC"); +INSERT INTO ids VALUES ("aef", "abc"); +INSERT INTO ids VALUES ("ABC", "aBC"); +INSERT INTO ids VALUES ("ACD", "AbC"); +INSERT INTO ids VALUES ("ADE", "ABc"); +INSERT INTO ids VALUES ("AEF", "ABC"); + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "ab" AND "ad"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test new file mode 100644 index 00000000000..a7ff9f3a600 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + KEY (id) +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test new file mode 100644 index 00000000000..4d094df41cd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_normal_varchar.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(10), + KEY (id) +); + +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test new file mode 100644 index 00000000000..68f132367f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT, + PRIMARY KEY (id) +); + +INSERT INTO ids VALUES (1); +INSERT INTO ids SELECT id + 1 FROM ids; +INSERT INTO ids SELECT id + 2 FROM ids; +INSERT INTO ids SELECT id + 4 FROM ids; +INSERT INTO ids SELECT id + 8 FROM ids; +INSERT INTO ids SELECT id + 16 FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN 10 AND 16; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test new file mode 100644 index 00000000000..aa9ba644062 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_read_primary_varchar.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id VARCHAR(10), + PRIMARY KEY (id) +); + +INSERT INTO ids VALUES ("1"); +INSERT INTO ids SELECT id + "1" FROM ids; +INSERT INTO ids SELECT id + "2" FROM ids; +INSERT INTO ids SELECT id + "4" FROM ids; +INSERT INTO ids SELECT id + "8" FROM ids; +INSERT INTO ids SELECT id + "16" FROM ids; + +SELECT * FROM ids; +SELECT * FROM ids WHERE id BETWEEN "10" AND "16"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test new file mode 100644 index 00000000000..2c1ec45c045 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_delete_by_primary_key.test @@ -0,0 +1,37 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"); +DELETE FROM users WHERE id = 1; +INSERT INTO users VALUES (1, "Alice"); + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test new file mode 100644 index 00000000000..6c47c877771 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_insert_after_error.test @@ -0,0 +1,38 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, "Alice"); +-- error ER_DUP_ENTRY +INSERT INTO users VALUES (1, "Bob"); +INSERT INTO users VALUES (2, "Bob"); + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test new file mode 100644 index 00000000000..21446b302f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_unique_varchar.test @@ -0,0 +1,36 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +CREATE TABLE users ( + name varchar(100) NOT NULL, + UNIQUE KEY name (name) +) DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES ("Alice"); +INSERT INTO users VALUES ("Bob"); +SELECT * FROM users; + +SELECT * FROM users WHERE name = "aLiCe"; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test new file mode 100644 index 00000000000..bbf368551af --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_multiple_column.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + deleted BOOLEAN, + value INT, + INDEX (deleted, value) +); + +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 1); +INSERT INTO scores VALUES (FALSE, 2); + +SELECT count(*) FROM scores WHERE deleted = FALSE; +UPDATE scores SET deleted = TRUE WHERE value = 1; +SELECT count(*) FROM scores WHERE deleted = FALSE; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test new file mode 100644 index 00000000000..a0dc2f8a952 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_update_single_column.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS scores; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE scores ( + value INT, + INDEX (value) +); + +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (21); +INSERT INTO scores VALUES (22); + +SELECT count(*) FROM scores WHERE value >= 20; +UPDATE scores SET value = 11 WHERE value = 21; +SELECT count(*) FROM scores WHERE value >= 20; + +DROP TABLE scores; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test new file mode 100644 index 00000000000..d22c6560c2c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -0,0 +1,22 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE + from information_schema.plugins where plugin_name = "Mroonga"; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test new file mode 100644 index 00000000000..2956e072302 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_none.test @@ -0,0 +1,34 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY +); + +SELECT AUTO_INCREMENT + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "ids"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test new file mode 100644 index 00000000000..79e12fe67a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_auto_increment_use.test @@ -0,0 +1,34 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT AUTO_INCREMENT PRIMARY KEY +); + +SELECT AUTO_INCREMENT + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "ids"; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test new file mode 100644 index 00000000000..82dd4fdf1c6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_tables_data_length.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT COUNT(*) + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_NAME = "diaries" AND DATA_LENGTH > 0; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..3fa85344dfa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_TODO_SPLIT_ME.test @@ -0,0 +1,105 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# data types +create table t1 (c1 tinyint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 smallint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 mediumint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 int); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 bigint); +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 float); +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 double); +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 date); +insert into t1 values("2010/03/26"); +select * from t1; +drop table t1; + +create table t1 (c1 time); +insert into t1 values("11:22:33"); +select * from t1; +drop table t1; + +create table t1 (c1 year); +insert into t1 values("2010"); +select * from t1; +drop table t1; + +create table t1 (c1 datetime); +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +drop table t1; + + +# for virtual columns +create table t1 (c1 int, _id int); +set sql_mode=""; +# warning WARN_DATA_TRUNCATED +insert into t1 (c1,_id) values (1,1); +set sql_mode="strict_all_tables"; +# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported +# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. +# We share this test with all MySQL servers. So we use number here. +--error 1265 +insert into t1 (c1,_id) values (4,1); +select * from t1; +drop table t1; + + +# duplicated key error +create table t1 (c1 int primary key, c2 int); +insert into t1 values(1,100); +select * from t1; +--error ER_DUP_ENTRY +insert into t1 values(1,200); +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test new file mode 100644 index 00000000000..48a85f5d72b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_delayed.test @@ -0,0 +1,35 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY +) DEFAULT CHARSET=UTF8; + +--error ER_DELAYED_NOT_SUPPORTED +INSERT DELAYED INTO ids (id) VALUES (1); + +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test new file mode 100644 index 00000000000..c3530dc34c0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_no_primary_key_and_unique_key_twice.test @@ -0,0 +1,41 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS numbers; +--enable_warnings + +CREATE TABLE numbers ( + id INT, + count INT, + UNIQUE (id) +); + +INSERT INTO numbers (id, count) VALUES (1, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (1, 3) ON DUPLICATE KEY UPDATE count = 4; + +SELECT * FROM numbers; + +INSERT INTO numbers (id, count) VALUES (2, 1) ON DUPLICATE KEY UPDATE count = 2; +INSERT INTO numbers (id, count) VALUES (2, 3) ON DUPLICATE KEY UPDATE count = 4; + +SELECT * FROM numbers; + +DROP TABLE numbers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test new file mode 100644 index 00000000000..794605d742b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_primary_key.test @@ -0,0 +1,43 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + title TEXT +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "clear day") + ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "rainy day") + ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-15", "cloudy day") + ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test new file mode 100644 index 00000000000..782b7bee9ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/insert_on_duplicate_key_update_unique_key.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + day DATE, + title TEXT, + UNIQUE KEY day (day) +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "clear day") + ON DUPLICATE KEY UPDATE title = "clear day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-14", "rainy day") + ON DUPLICATE KEY UPDATE title = "rainy day (duplicated)"; +INSERT INTO diaries (day, title) + VALUES ("2012-02-15", "cloudy day") + ON DUPLICATE KEY UPDATE title = "cloudy day (duplicated)"; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test new file mode 100644 index 00000000000..18801541b72 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/like_unicode_ci.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS terms; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE terms ( + content varchar(64) NOT NULL COLLATE 'utf8_unicode_ci', + INDEX (content) +) DEFAULT CHARSET=utf8; + +INSERT INTO terms VALUES ('track'); +INSERT INTO terms VALUES ('trackback'); + +SELECT * FROM terms WHERE content LIKE 'TRACK%'; + +DROP TABLE terms; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test new file mode 100644 index 00000000000..b7093f82aa5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/lock_tables_read.test @@ -0,0 +1,32 @@ +# Copyright(C) 2013 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS counts; +--enable_warnings + +CREATE TABLE counts ( + id INT PRIMARY KEY AUTO_INCREMENT +); + +LOCK TABLES counts READ; +UNLOCK TABLES; + +DROP TABLE counts; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test new file mode 100644 index 00000000000..8c818041a6c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_disabled.test @@ -0,0 +1,60 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SET mroonga_enable_optimization=FALSE; + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + month = 11 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +SET mroonga_enable_optimization=TRUE; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test new file mode 100644 index 00000000000..d75a6460218 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_not_optimized_no_limit.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test new file mode 100644 index 00000000000..61e16a9444d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test new file mode 100644 index 00000000000..4b75648009b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_between_over.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date BETWEEN "2011-11-11 12:23:31" AND "2011-11-11 12:23:43" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test new file mode 100644 index 00000000000..f3b4be95b3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:34", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:34", "Tomorrow will be fine."); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:34", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:34", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date = "2011-11-11 12:23:34" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test new file mode 100644 index 00000000000..ce5724b8b0b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date > "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test new file mode 100644 index 00000000000..4c55ba2a895 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_greater_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date >= "2011-11-11 12:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test new file mode 100644 index 00000000000..36f0e0ab6f2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date < "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test new file mode 100644 index 00000000000..3fc1505fcc2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_datetime_less_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + date DATETIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(date) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "2011-11-11 12:23:30", "Today is fine."); +INSERT INTO diaries VALUES(2, "2011-11-11 12:23:31", "Today's lucky item is flower!"); +INSERT INTO diaries VALUES(3, "2011-11-11 12:23:32", "I will do something today!"); +INSERT INTO diaries VALUES(4, "2011-11-11 12:23:33", "I don't want to anything today..."); +INSERT INTO diaries VALUES(5, "2011-11-11 12:23:34", "I'm sleepy today."); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + date <= "2011-11-11 12:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test new file mode 100644 index 00000000000..0733a48ba97 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_have_primary_key.test @@ -0,0 +1,51 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test new file mode 100644 index 00000000000..f96043b4e37 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED, + content TEXT, + FULLTEXT INDEX(content), + KEY(id) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + id BETWEEN 2 AND 4 + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test new file mode 100644 index 00000000000..39caa96424c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_between_over.test @@ -0,0 +1,48 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED, + content TEXT, + FULLTEXT INDEX(content), + KEY(id) +) DEFAULT CHARSET UTF8; + +INSERT INTO memos VALUES(1, "Today is fine."); +INSERT INTO memos VALUES(2, "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "I will do something today!"); +INSERT INTO memos VALUES(4, "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + id BETWEEN 2 AND 6 + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test new file mode 100644 index 00000000000..579b7b33899 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_equal.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + month = 11 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test new file mode 100644 index 00000000000..c7354438224 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day > 10 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test new file mode 100644 index 00000000000..259e2e5178d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_greater_than_or_equal.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day >= 10 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test new file mode 100644 index 00000000000..02c2123afef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day < 12 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test new file mode 100644 index 00000000000..0511de74442 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_int_less_than_or_equal.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + day <= 12 + ORDER BY day LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test new file mode 100644 index 00000000000..b757b39e9ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_primary_key.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 11, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(6, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE) ORDER BY day LIMIT 0,5; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test new file mode 100644 index 00000000000..b4d7aa348f0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_no_where_clause.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, _id int, key idx1(c2), fulltext index ft(c3)) default charset utf8; +insert into t1 values(1,10,"aa ii uu ee oo",null); +insert into t1 values(2,20,"ka ki ku ke ko",null); +insert into t1 values(3,30,"ii si ii se ii",null); +insert into t1 values(4,40,"ta ti tu te to",null); +insert into t1 values(5,50,"aa ii uu ii oo",null); + +show status like 'mroonga_fast_order_limit'; + +select *, match(c3) against("ii") from t1 order by c1 desc limit 2; + +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test new file mode 100644 index 00000000000..74da8581596 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_asc.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day ASC LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test new file mode 100644 index 00000000000..2e5d0741c51 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_desc.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY day DESC LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test new file mode 100644 index 00000000000..d7becd3820a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_id.test @@ -0,0 +1,57 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + _id INT, + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(NULL, 1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(NULL, 2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(NULL, 3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(NULL, 4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(NULL, 5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(NULL, 6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(NULL, 7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY _id + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test new file mode 100644 index 00000000000..827faa70fa9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_order_by_match_against.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test new file mode 100644 index 00000000000..04a2309e98e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_select_match_against.test @@ -0,0 +1,57 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT *, MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + ORDER BY MATCH(content) AGAINST("今日" IN BOOLEAN MODE) + LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test new file mode 100644 index 00000000000..8c8fafc076c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time BETWEEN "1:23:31" AND "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test new file mode 100644 index 00000000000..9f9848b7e7e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_between_over.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time BETWEEN "1:23:31" AND "1:23:43" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test new file mode 100644 index 00000000000..04efd54eb48 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:34", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:34", "Tomorrow will be fine."); +INSERT INTO memos VALUES(3, "1:23:34", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:34", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time = "1:23:34" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test new file mode 100644 index 00000000000..b2ec8b78198 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time > "1:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test new file mode 100644 index 00000000000..0b9964eb542 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_greater_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!" ); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time >= "1:23:31" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test new file mode 100644 index 00000000000..ce772a2ee6d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time < "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test new file mode 100644 index 00000000000..797bd935eaa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_time_less_than_or_equal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE memos ( + id INT UNSIGNED NOT NULL, + writing_time TIME, + content TEXT, + FULLTEXT INDEX(content), + KEY(writing_time) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE memos; + +INSERT INTO memos VALUES(1, "1:23:30", "Today is fine."); +INSERT INTO memos VALUES(2, "1:23:31", "Today's lucky item is flower!"); +INSERT INTO memos VALUES(3, "1:23:32", "I will do something today!"); +INSERT INTO memos VALUES(4, "1:23:33", "I don't want to anything today..."); +INSERT INTO memos VALUES(5, "1:23:34", "I'm sleepy today."); + +SELECT * FROM memos + WHERE MATCH(content) AGAINST("today" IN BOOLEAN MODE) AND + writing_time <= "1:23:33" + ORDER BY id LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test new file mode 100644 index 00000000000..e34209b841e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_with_index.test @@ -0,0 +1,57 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(title), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + title = "hello" + ORDER BY day LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test new file mode 100644 index 00000000000..380f323d64a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_varchar_equal_without_index.test @@ -0,0 +1,56 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(month), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, 2011, 11, 12, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, 2011, 11, 13, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); +INSERT INTO diaries VALUES(6, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(7, 2011, 12, 2, "åˆé›ª", "今日ã®å¤©æ°—ã¯é›ªï¼"); + +SELECT * FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE) AND + title = "hello" + ORDER BY day LIMIT 1; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test new file mode 100644 index 00000000000..988a116731c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year BETWEEN "11" AND "2013" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test new file mode 100644 index 00000000000..d4c1d020fcc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_between_over.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year BETWEEN "11" AND "2015" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test new file mode 100644 index 00000000000..b1daa3a0000 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_equal.test @@ -0,0 +1,55 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 1.0 has been released", "11"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 1.11 has been released", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year = "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test new file mode 100644 index 00000000000..bf4a18793b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year > "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id ASC LIMIT 2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test new file mode 100644 index 00000000000..8863d613f06 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_greater_than_or_equal.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year >= "11" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id ASC LIMIT 2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test new file mode 100644 index 00000000000..2fe423ac053 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year < "13" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test new file mode 100644 index 00000000000..52f26e37123 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_order_limit_optimized_year_less_than_or_equal.test @@ -0,0 +1,53 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS mroonga_releases; +--enable_warnings + +FLUSH STATUS; + +CREATE TABLE mroonga_releases ( + id INT PRIMARY KEY AUTO_INCREMENT, + release_title TEXT, + release_year YEAR, + KEY (release_year), + FULLTEXT KEY (release_title) +) DEFAULT CHARSET UTF8; + +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Groonga storage engine (code name Mroonga) 0.1 has been released", "10"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Rename Groonga storage engine to Mroonga", "2011"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 2.0 has been released", "2012"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 3.0 has been released", "13"); +INSERT INTO mroonga_releases (release_title, release_year) + VALUES ("Mroonga 4.0 will be released", "2014"); + +SELECT * FROM mroonga_releases + WHERE release_year <= "13" AND + MATCH(release_title) AGAINST("Mroonga" IN BOOLEAN MODE) + ORDER BY id DESC LIMIT 1,2; + +SHOW STATUS LIKE 'mroonga_fast_order_limit'; + +DROP TABLE mroonga_releases; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..669868c6c7f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_TODO_SPLIT_ME.test @@ -0,0 +1,61 @@ +# Copyright(C) 2010 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +flush status; +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +show status like 'mroonga_count_skip'; +select * from t1; +show status like 'mroonga_count_skip'; +select count(*) from t1; +show status like 'mroonga_count_skip'; +select * from t1 force index(primary) where c1 between 2 and 4; +show status like 'mroonga_count_skip'; +select count(*) from t1 force index(primary) where c1 between 2 and 4; +show status like 'mroonga_count_skip'; +select c1 from t1 force index(primary) where c1 < 3; +show status like 'mroonga_count_skip'; +select count(c1) from t1 force index(primary) where c1 < 3; +show status like 'mroonga_count_skip'; +select 1 from t1 force index(primary) where c1 > 3; +show status like 'mroonga_count_skip'; +select count(1) from t1 force index(primary) where c1 > 3; +show status like 'mroonga_count_skip'; +select * from t1 where match(c3) against("su"); +show status like 'mroonga_count_skip'; +select count(*) from t1 where match(c3) against("su"); +show status like 'mroonga_count_skip'; +select * from t1 where match(c3) against("+su" in boolean mode); +show status like 'mroonga_count_skip'; +select count(*) from t1 where match(c3) against("+su" in boolean mode); +show status like 'mroonga_count_skip'; +select * from t1 force index(idx1) where c2 between 20 and 40; +show status like 'mroonga_count_skip'; +select count(*) from t1 force index(idx1) where c2 between 20 and 40; +show status like 'mroonga_count_skip'; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_multithread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_multithread.test new file mode 100644 index 00000000000..bca2311ffbc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_multithread.test @@ -0,0 +1,45 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX ft(title) +); + +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); + +CONNECT (thread2, localhost, root, ,); +CONNECTION thread2; +INSERT INTO diaries VALUES("Happy birthday!"); +DISCONNECT thread2; +CONNECTION default; + +SHOW STATUS LIKE 'mroonga_count_skip'; +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_single_thread.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_single_thread.test new file mode 100644 index 00000000000..fa960be850f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_after_insert_single_thread.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kentoku SHIBA +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; +CREATE TABLE diaries ( + title TEXT, + FULLTEXT INDEX ft(title) +); + +INSERT INTO diaries VALUES("Hello mroonga!"); +INSERT INTO diaries VALUES("It's funny."); +INSERT INTO diaries VALUES("Happy birthday!"); + +SHOW STATUS LIKE 'mroonga_count_skip'; +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("mroonga" IN BOOLEAN MODE); +SHOW STATUS LIKE 'mroonga_count_skip'; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test new file mode 100644 index 00000000000..e94702e8159 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_disabled.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +FLUSH STATUS; + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +INSERT INTO diaries VALUES(4, "帰りé“", "今日ã¯å¤©æ°—ãŒã‚ˆãã¦ã‚ˆã‹ã£ãŸã€‚"); +INSERT INTO diaries VALUES(5, "ã¯ã‚Œ", "天気ãŒã‚ˆã„ã®ã¯ä»Šæ—¥ã¾ã§ã¿ãŸã„。"); + +SET mroonga_enable_optimization=FALSE; + +SELECT COUNT(*) FROM diaries + WHERE MATCH(content) AGAINST("今日" IN BOOLEAN MODE); + +SHOW STATUS LIKE 'mroonga_count_skip'; + +SET mroonga_enable_optimization=TRUE; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_index_view.test b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_index_view.test new file mode 100644 index 00000000000..11457b1e05a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/optimization_skip_count_index_view.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, users; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + user_id INT NOT NULL, + title VARCHAR(45) NOT NULL, + KEY (user_id), + FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET=UTF8; + +CREATE TABLE users ( + id INT PRIMARY KEY AUTO_INCREMENT, + name VARCHAR(45) NOT NULL, + INDEX (name) +) ENGINE=InnoDB DEFAULT CHARSET=UTF8; + +INSERT INTO users (id, name) VALUES (1, "Alice"), (2, "Bob"); +INSERT INTO diaries (user_id, title) VALUES (1, "survey"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (1)"); +INSERT INTO diaries (user_id, title) VALUES (2, "groonga (2)"); + +CREATE VIEW articles AS + SELECT diaries.user_id AS user_id, + diaries.title AS title, + users.name AS name + FROM diaries, users + WHERE diaries.user_id = users.id; + + +SELECT COUNT(*) FROM articles WHERE name = 'Bob'; + +DROP VIEW articles; +DROP TABLE diaries, users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test new file mode 100644 index 00000000000..5f160af239f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_geometry.test @@ -0,0 +1,39 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS geo_replace; +--enable_warnings + +CREATE TABLE geo_replace ( + id INT NOT NULL, + geo GEOMETRY NOT NULL, + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO geo_replace VALUES(1, POINT(100,100)); +SELECT id, ASTEXT(geo) FROM geo_replace; +REPLACE INTO geo_replace VALUES(1, POINT(100,200)); +SELECT id, ASTEXT(geo) FROM geo_replace; +INSERT INTO geo_replace VALUES(1, POINT(200,200)) ON DUPLICATE KEY UPDATE geo = POINT(200,200); +SELECT id, ASTEXT(geo) FROM geo_replace; +UPDATE geo_replace SET geo = POINT(200,300); +SELECT id, ASTEXT(geo) FROM geo_replace; + +DROP TABLE geo_replace; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test new file mode 100644 index 00000000000..192a4976cbd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_select_varchar.test @@ -0,0 +1,64 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# Based on #910. + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS videos_master, videos_groonga; +--enable_warnings + +CREATE TABLE `videos_master` ( + `id` bigint(1) unsigned NOT NULL, + `video_id` varchar(64) NOT NULL, + `description` text, + `tags_unpack` text, + PRIMARY KEY (`video_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `videos_groonga` ( + `id` bigint(1) unsigned NOT NULL, + `video_id` varchar(64) NOT NULL, + `description` text, + `tags_unpack` text, + PRIMARY KEY (`video_id`), + FULLTEXT INDEX (`description`), + FULLTEXT INDEX (`tags_unpack`) +) DEFAULT CHARSET=utf8; + + +INSERT INTO videos_master VALUES (1, "video-1", "My Familly", "familly human"); +INSERT INTO videos_master VALUES (2, "video-2", "My Cat", "family cat"); +REPLACE INTO videos_groonga + SELECT v.id, v.video_id, v.description, NULL + FROM videos_master AS v + WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("cat") FROM videos_groonga + WHERE MATCH(description) AGAINST("cat"); + +INSERT INTO videos_master VALUES (3, "video-3", "My Dog", "family dog"); +REPLACE INTO videos_groonga + SELECT v.id, v.video_id, v.description, NULL + FROM videos_master AS v + WHERE v.video_id = (video_id); +SELECT *, MATCH(description) AGAINST("my") FROM videos_groonga + WHERE MATCH(description) AGAINST("my"); + +DROP TABLE videos_master, videos_groonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test new file mode 100644 index 00000000000..6411896312c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_text.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content text, + fulltext index (content) +) default charset utf8; +show create table diaries; + +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +replace into diaries values(2, "明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。"); +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test new file mode 100644 index 00000000000..0d9b82fb7d4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_varchar.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content varchar(256), + fulltext index (content) +) default charset utf8; +show create table diaries; + +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +replace into diaries values(2, "明日ã®å¤©æ°—ã¯é›¨ã¿ãŸã„。"); +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test new file mode 100644 index 00000000000..a2efa7912b5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/replace_vector.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS vector_replace; +DROP TABLE IF EXISTS vector_replace_vec; +--enable_warnings + +CREATE TABLE vector_replace_vec ( + vec CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE vector_replace ( + id INT NOT NULL, + vec TEXT COMMENT 'flags "COLUMN_VECTOR", type "vector_replace_vec"', + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; +INSERT INTO vector_replace VALUES(1, 'first second third'); +SELECT id, vec FROM vector_replace; +REPLACE INTO vector_replace VALUES(1, 'fourth fifth'); +SELECT id, vec FROM vector_replace; +INSERT INTO vector_replace VALUES(1, 'sixth seventh') ON DUPLICATE KEY UPDATE vec = 'sixth seventh'; +SELECT id, vec FROM vector_replace; +UPDATE vector_replace SET vec = 'eighth nineth tenth'; +SELECT id, vec FROM vector_replace; + +DROP TABLE vector_replace; +DROP TABLE vector_replace_vec; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test new file mode 100644 index 00000000000..8de78ca99af --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_all.test @@ -0,0 +1,100 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1(c1 int, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); + +select * from t1; +select c1 from t1; +select c2 from t1; +select c3 from t1; + +select * from t1 where c1 <= 3; +select * from t1 where c2 > 40; +select * from t1 where c3 = 300; + + +select * from t1 order by c1; +select * from t1 order by c2 desc; +select * from t1 order by c3, c1; + +drop table t1; + + +create table t1 (c1 int, c2 varchar(100)); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); + +select * from t1; +select * from t1 order by c1; +select * from t1 order by c1 desc; +select * from t1 order by c2; + +drop table t1; + +create table t1 (c1 int, c2 text); +insert into t1 values(1, "hoge"); +insert into t1 values(4, "hogefuga"); +insert into t1 values(2, "fuga"); +insert into t1 values(5, "moge"); +insert into t1 values(3, "mo"); + +select * from t1; + +drop table t1; + +# ORDER BY with position +create table t1 (c1 int, c2 int, c3 text); +insert into t1 values(1, 20, "hoge"); +insert into t1 values(4, 60, "hogefuga"); +insert into t1 values(2, 50, "fuga"); +insert into t1 values(5, 30, "moge"); +insert into t1 values(3, 40, "mo"); +select * from t1 order by c1 asc; +select * from t1 order by c1 desc; +select * from t1 order by c2 asc; +select * from t1 order by c2 desc; +select * from t1 order by c3 asc; +select * from t1 order by c3 desc; +drop table t1; + +# _id +create table t1 (_id int, c1 int); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +insert into t1 values (null,100); +select * from t1; +select * from t1 where _id < 3; +select * from t1 where _id >= 3; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test new file mode 100644 index 00000000000..c4ce4c0193d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_equal.test @@ -0,0 +1,36 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(16) NOT NULL, + KEY index_name (name) +); + +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); + +SELECT * FROM tags WHERE name = ""; + +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test new file mode 100644 index 00000000000..8537616e89e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_empty_key_where_not_equal.test @@ -0,0 +1,36 @@ +# Copyright(C) 2014 Kenji Maruyama +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS tags; +--enable_warnings + +CREATE TABLE tags ( + name VARCHAR(16) NOT NULL, + KEY index_name (name) +); + +INSERT INTO tags VALUES ('mroonga'); +INSERT INTO tags VALUES ('mysql'); +INSERT INTO tags VALUES (''); + +SELECT * FROM tags WHERE name != ""; + +DROP TABLE tags; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test new file mode 100644 index 00000000000..569fbcfd600 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_with_index.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE users ( + name varchar(40), + age int, + KEY (age) +); + +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); + +SELECT *, COUNT(*) FROM users GROUP BY age; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test new file mode 100644 index 00000000000..ae852bfcfed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_group_by_without_index.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE users ( + name varchar(40), + age int +); + +INSERT INTO users VALUES ("Alice", 20); +INSERT INTO users VALUES ("Bob", 20); +INSERT INTO users VALUES ("Charry", 29); + +EXPLAIN SELECT *, COUNT(*) FROM users GROUP BY age; + +SELECT *, COUNT(*) FROM users GROUP BY age; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test new file mode 100644 index 00000000000..9ebd707392d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_pkey.test @@ -0,0 +1,40 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1(c1 int primary key, c2 int, c3 int); +insert into t1 values (1, 10, 100); +insert into t1 values (2, 30, 500); +insert into t1 values (5, 20, 200); +insert into t1 values (3, 60, 300); +insert into t1 values (4, 50, 600); +insert into t1 values (6, 40, 400); + +select * from t1 where c1=1; +select * from t1 where c1=2; +select * from t1 where c1=3; +select * from t1 where c1=4; +select * from t1 where c1=5; +select * from t1 where c1=6; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test new file mode 100644 index 00000000000..a6159bea02b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/select_secondary_key.test @@ -0,0 +1,51 @@ +# Copyright(C) 2010 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, key idx1(c2), fulltext index ft(c3)); +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); + +select * from t1; +select * from t1 force index(idx1) where c2 = 30; +select * from t1 force index(idx1) where c2 = 20; + +insert into t1 values(6,30,"aa bb cc dd ee"); +select * from t1; +select * from t1 force index(idx1) where c2 = 30; + +drop table t1; + +create table t1 (c1 varchar(5) primary key, c2 varchar(5), c3 text, key idx1(c2), fulltext index ft(c3))engine=mroonga; +insert into t1 values('ab','ijk',"aa ii uu ee oo"); +insert into t1 values('bc','ghi',"ka ki ku ke ko"); +insert into t1 values('cd','efg',"sa si su se so"); +insert into t1 values('de','cde',"ta ti tu te to"); +insert into t1 values('ef','abc',"aa ii uu ee oo"); +select * from t1 force index(idx1) where c2 < 'e' order by c1 asc; +select * from t1 force index(idx1) where c2 > 'e' order by c1 asc; +select * from t1 force index(idx1) where c2 between 'c' and 'h' order by c1 asc; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..240e8c11dcf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/show_create_table_TODO_SPLIT_ME.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int); +show create table t1; +drop table t1; + +create table t1 (c1 int, c2 int); +show create table t1; +drop table t1; + +create table t1 (c1 int primary key, c2 varchar(100)); +show create table t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test new file mode 100644 index 00000000000..34839669f25 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/sub_query_fulltext.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, users; +--enable_warnings + +CREATE TABLE users ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT +) DEFAULT CHARSET UTF8; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + user_id INT UNSIGNED NOT NULL, + title TEXT, + FULLTEXT INDEX (title) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO users (name) VALUES ("alice"); +INSERT INTO users (name) VALUES ("bob"); +INSERT INTO users (name) VALUES ("carlos"); + +SELECT * FROM users; + +INSERT INTO diaries (user_id, title) VALUES (1, "Hello!"); +INSERT INTO diaries (user_id, title) VALUES (2, "my name is bob"); +INSERT INTO diaries (user_id, title) VALUES (3, "my name is carlos"); + +SELECT * FROM diaries; + +SELECT * FROM users + WHERE id IN (SELECT user_id FROM diaries + WHERE MATCH(title) AGAINST("name")) + ORDER BY id DESC; + +DROP TABLE diaries, users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test new file mode 100644 index 00000000000..56ebb430afc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/temporary_table.test @@ -0,0 +1,39 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TEMPORARY TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); + +SELECT * FROM diaries; + +DROP TEMPORARY TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test new file mode 100644 index 00000000000..5833f77722a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/truncate.test @@ -0,0 +1,56 @@ +# Copyright(C) 2011-2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); + +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼"); + +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test new file mode 100644 index 00000000000..a6cc1ba7fb2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_fulltext.test @@ -0,0 +1,36 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)); +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test new file mode 100644 index 00000000000..e362984f896 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_hash_index.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +update t1 set c1 = 200 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test new file mode 100644 index 00000000000..d8257e41fb5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_id_unique_hash_index.test @@ -0,0 +1,33 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (_id int, c1 int, unique key (_id) using hash); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +insert into t1 values(null, 100); +select * from t1; +update t1 set c1 = 200 where _id = 2; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test new file mode 100644 index 00000000000..043ae25aee5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_int.test @@ -0,0 +1,44 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int, c2 int); +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; + +update t1 set c2=c2+100 where c1=1; +select * from t1; +update t1 set c2=c2+100 where c1=2; +select * from t1; +update t1 set c2=c2+100 where c1=3; +select * from t1; + +flush tables; + +update t1 set c1=5, c2=50; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test new file mode 100644 index 00000000000..3ad713cbbde --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_last_insert_grn_id.test @@ -0,0 +1,48 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +drop table if exists memos; +--enable_warnings + +create table memos ( + _id int, + content varchar(255), + unique key (_id) using hash +); + +insert into memos values (null, "今夜ã¯ã•ã‚“ã¾ã€‚"); +insert into memos values (null, "明日ã¯groongaをアップデート。"); +insert into memos values (null, "帰りã«ãŠã ã‚“ã”。"); +insert into memos values (null, "金曜日ã¯è‚‰ã®æ—¥ã€‚"); + +select * from memos; + +insert into memos values (null, "冷蔵庫ã«ç‰›ä¹³ãŒæ®‹ã‚Š1本。"); +select last_insert_grn_id(); +update memos set content = "冷蔵庫ã«ç‰›ä¹³ã¯ã¾ã ãŸãã•ã‚“ã‚る。" where _id = last_insert_grn_id(); + +select * from memos; + +drop table memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test new file mode 100644 index 00000000000..f5d85de4043 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/update_virtual_column.test @@ -0,0 +1,43 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# for virtual columns +create table t1 (c1 int, _id int); +insert into t1 values(1,null); +insert into t1 values(2,null); +insert into t1 values(3,null); +select * from t1; +set sql_mode=""; +# warning WARN_DATA_TRUNCATED +update t1 set _id = 10 where c1 = 1; +select * from t1; +set sql_mode="strict_all_tables"; +# We can't use WARN_DATA_TRUNCATED here because "WXXX" isn't supported +# MySQL 5.5, 5.6 and MariaDB 5.6. MariaDB 10.0 only supports it. +# We share this test with all MySQL servers. So we use number here. +--error 1265 +update t1 set _id = 11 where c1 = 1; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test new file mode 100644 index 00000000000..c7b2094906b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_database_path_prefix.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +SET GLOBAL mroonga_database_path_prefix = "test/mroonga.data/"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_database_path_prefix'; +CREATE DATABASE clean_test; +USE clean_test; + +CREATE TABLE counts ( + id INT PRIMARY KEY AUTO_INCREMENT +); + +--file_exists $MYSQLD_DATADIR/test/mroonga.data/clean_test.mrn + +INSERT INTO counts VALUES (NULL); + +SELECT * FROM counts; + +DROP TABLE counts; +DROP DATABASE clean_test; +USE test; + +SET GLOBAL mroonga_database_path_prefix = NULL; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test new file mode 100644 index 00000000000..a61af87fb2b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2014 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_default_parser_backup = @@mroonga_default_parser; +SET GLOBAL mroonga_default_parser = "TokenBigramSplitAlpha"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; +SET GLOBAL mroonga_default_parser = @mroonga_default_parser_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test new file mode 100644 index 00000000000..0e8562de92c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_default_parser_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_default_parser = "TokenBigram"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_default_parser'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test new file mode 100644 index 00000000000..b80ac2e8400 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_delete.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; + +set mroonga_dry_write=true; +delete from diaries where id = 1; +select * from diaries; + +set mroonga_dry_write=false; +delete from diaries where id = 1; +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test new file mode 100644 index 00000000000..72346c80a6d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_insert.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; + +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; + +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test new file mode 100644 index 00000000000..2100f61700c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_dry_write_update.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); + +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; + +set mroonga_dry_write=false; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test new file mode 100644 index 00000000000..2c2776e5fd8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_disable.test @@ -0,0 +1,28 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_100_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = -1; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +disable_query_log; +SET GLOBAL mroonga_lock_timeout = 10000000; +enable_query_log; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test new file mode 100644 index 00000000000..e2090cf9659 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_invalid.test @@ -0,0 +1,28 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_100_or_later.inc +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = -2; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +disable_query_log; +SET GLOBAL mroonga_lock_timeout = 10000000; +enable_query_log; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test new file mode 100644 index 00000000000..9df4970cacd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_no_retry.test @@ -0,0 +1,27 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = 0; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +disable_query_log; +SET GLOBAL mroonga_lock_timeout = 10000000; +enable_query_log; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test new file mode 100644 index 00000000000..49394d0a40a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_lock_timeout_valid.test @@ -0,0 +1,27 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_lock_timeout = 1000; +SHOW GLOBAL VARIABLES LIKE "mroonga_lock_timeout"; + + +disable_query_log; +SET GLOBAL mroonga_lock_timeout = 10000000; +enable_query_log; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test new file mode 100644 index 00000000000..77f6adb1713 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_new_value.test @@ -0,0 +1,25 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET @mroonga_log_file_backup = @@mroonga_log_file; +SET GLOBAL mroonga_log_file = "new-mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; +SET GLOBAL mroonga_log_file = @mroonga_log_file_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test new file mode 100644 index 00000000000..254beae17a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_nonexistent_path.test @@ -0,0 +1,22 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_log_file = "nonexistent/mroonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test new file mode 100644 index 00000000000..54116467502 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_file_same_value.test @@ -0,0 +1,22 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +SET GLOBAL mroonga_log_file = "groonga.log"; +SHOW GLOBAL VARIABLES LIKE 'mroonga_log_file'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..f736be43e6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_log_level_TODO_SPLIT_ME.test @@ -0,0 +1,61 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2014 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +set @mroonga_log_level_backup=@@mroonga_log_level; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=NONE; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=EMERG; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=ALERT; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=CRIT; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=ERROR; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=WARNING; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=NOTICE; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=INFO; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=DEBUG; +show global variables like 'mroonga_log_level'; + +set global mroonga_log_level=DUMP; +show global variables like 'mroonga_log_level'; + +--error ER_WRONG_VALUE_FOR_VAR +set global mroonga_log_level=dummy; + +--error ER_GLOBAL_VARIABLE +set session mroonga_log_level=NOTICE; + +set global mroonga_log_level=@mroonga_log_level_backup; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test new file mode 100644 index 00000000000..55a318b786a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_global.test @@ -0,0 +1,55 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +# MySQL <= 5.5 reports wrong a warning. :< +# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. +--disable_warnings +SET GLOBAL mroonga_match_escalation_threshold = -1; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); + + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test new file mode 100644 index 00000000000..c459e50c0d7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_match_escalation_threshold_session.test @@ -0,0 +1,53 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); + + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +# MySQL <= 5.5 reports wrong a warning. :< +# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. +--disable_warnings +SET mroonga_match_escalation_threshold = -1; +--enable_warnings +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test new file mode 100644 index 00000000000..8412e6a65fa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_vector_column_delimiter.test @@ -0,0 +1,54 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +--disable_warnings +DROP TABLE IF EXISTS document; +DROP TABLE IF EXISTS category; +--enable_warnings + +CREATE TABLE category ( + category CHAR(10) PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='default_tokenizer "TokenDelimit"'; + +CREATE TABLE document ( + id INT NOT NULL, + title TEXT, + categories TEXT COMMENT 'flags "COLUMN_VECTOR", type "category"', + PRIMARY KEY(id) +) DEFAULT CHARSET=utf8; + +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; + +INSERT INTO document VALUES(1, "Mroonga is the fastest search engine", "it database fulltext"); +SELECT id, title, categories FROM document; + +SET GLOBAL mroonga_vector_column_delimiter = ';'; + +SHOW GLOBAL VARIABLES LIKE 'mroonga_vector_column_delimiter'; + +SELECT id, title, categories FROM document; + +DROP TABLE document; +DROP TABLE category; + +SET GLOBAL mroonga_vector_column_delimiter = ' '; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test new file mode 100644 index 00000000000..ff47f2c921d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -0,0 +1,22 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +# show variables like 'groonga%'; +show variables like 'mroonga_version'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def b/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def new file mode 100644 index 00000000000..f3f211b63ed --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/disabled.def @@ -0,0 +1,2 @@ +create_table_token_filters_index_comment_multiple_token_filters : Bundled Mroonga does not support token filter yet. +create_table_token_filters_index_comment_one_token_filter : Bundled Mroonga does not support token filter yet. diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result new file mode 100644 index 00000000000..22dbbff96ac --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_add_column.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result new file mode 100644 index 00000000000..af302b5a2a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_column_comment.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +ALTER TABLE bugs +CHANGE COLUMN +tag +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result new file mode 100644 index 00000000000..e5ce4692aa3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_change_engine.result @@ -0,0 +1,49 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND +MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result new file mode 100644 index 00000000000..1106fcffca2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_comment_change_engine.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT AUTO_INCREMENT PRIMARY KEY, +title VARCHAR(64), +content TEXT, +FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(64) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); +INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); +INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); +ALTER TABLE memos COMMENT='engine "MyISAM"'; +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(64) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='engine "MyISAM"' +SELECT * FROM memos; +id title content +1 Hello I start to write memos! +2 groonga I start to use groonga! +3 mroonga I use mroonga too! +SELECT * FROM memos WHERE MATCH(content) AGAINST("start" IN BOOLEAN MODE); +id title content +1 Hello I start to write memos! +2 groonga I start to use groonga! +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result new file mode 100644 index 00000000000..b185bf269f7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_create_fulltext.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +CREATE FULLTEXT INDEX title_index on diaries (title); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result new file mode 100644 index 00000000000..e71132be139 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_fulltext.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result new file mode 100644 index 00000000000..1fefc1d98e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_multiple_column.result @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result new file mode 100644 index 00000000000..d115cefb243 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_normal.result @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result new file mode 100644 index 00000000000..47649911bb1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_primary.result @@ -0,0 +1,23 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries DISABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result new file mode 100644 index 00000000000..06e1a12db55 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_disable_keys_updating.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +c1 int NOT NULL, +c2 text NOT NULL, +c3 int NOT NULL, +c4 int NOT NULL, +PRIMARY KEY(c1), +KEY idx1(c3,c4), +FULLTEXT KEY ft1(c2) +) COMMENT='ENGINE "MyISAM"' DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +TRUNCATE t1; +DROP TABLE t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result new file mode 100644 index 00000000000..07c149a8fa8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_drop_column.result @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +SELECT * FROM diaries; +id title +1 survey +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; +id title +1 survey +2 groonga (1) +3 groonga (2) +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result new file mode 100644 index 00000000000..b9a0f545965 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_fulltext.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_index) +WHERE MATCH (title) AGAINST ("富士山"); +id title +3 富士山 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result new file mode 100644 index 00000000000..341cc4f7de7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_lock_tables.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS memos; +CREATE TABLE IF NOT EXISTS memos ( +id VARCHAR(45) NOT NULL PRIMARY KEY, +text TEXT NOT NULL, +FULLTEXT KEY (text) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +LOCK TABLES memos WRITE; +ALTER TABLE memos DISABLE KEYS; +INSERT INTO memos +VALUES (00000, 'text0'), +(00001, 'text1'), +(00002, 'text2'); +ALTER TABLE memos ENABLE KEYS; +UNLOCK TABLES; +SELECT * FROM memos; +id text +0 text0 +1 text1 +2 text2 +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result new file mode 100644 index 00000000000..21f6b9089bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_multiple_column.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (title_and_created_at_index) +WHERE title = "天気" AND +created_at = "2012-04-30 23:00:00"; +id title created_at +2 天気 2012-04-30 23:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result new file mode 100644 index 00000000000..2ba4f1b6386 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_normal.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +created_at datetime, +KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (created_at_index) +WHERE created_at = "2012-04-30 20:00:00"; +id title created_at +1 Hello 2012-04-30 20:00:00 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result new file mode 100644 index 00000000000..a1ee9013b6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_enable_keys_primary.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; +ALTER TABLE diaries DISABLE KEYS; +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +ALTER TABLE diaries ENABLE KEYS; +SELECT * +FROM diaries +FORCE INDEX (PRIMARY) +WHERE id = 2; +id title +2 天気 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result new file mode 100644 index 00000000000..cc64daac30a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_fulltext.result @@ -0,0 +1,52 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; +id title +1 survey +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +ALTER TABLE diaries ADD FULLTEXT INDEX body_index (body); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result new file mode 100644 index 00000000000..08e526baa50 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_rename_table.result @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS diaries, memos; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +id title body +1 survey will start groonga! +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +id title body +1 survey will start groonga! +SELECT * FROM memos +WHERE MATCH(title) AGAINST("groonga") AND +MATCH(body) AGAINST("starting"); +id title body +SHOW CREATE TABLE memos; +Table Create Table +memos CREATE TABLE `memos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result new file mode 100644 index 00000000000..fc38afc72d8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/alter_table_spatial.result @@ -0,0 +1,131 @@ +DROP TABLE IF EXISTS shops; +CREATE TABLE shops ( +id INT PRIMARY KEY AUTO_INCREMENT, +name TEXT, +location GEOMETRY NOT NULL +) COMMENT = 'ENGINE "InnoDB"'; +INSERT INTO shops (name, location) +VALUES ('nezu-no-taiyaki', +GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) +VALUES ('taiyaki-kataoka', +GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) +VALUES ('soba-taiyaki-ku', +GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) +VALUES ('kuruma', +GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) +VALUES ('hirose-ya', +GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) +VALUES ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) +VALUES ('omede-taiyaki', +GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) +VALUES ('onaga-ya', +GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) +VALUES ('shiro-ya', +GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) +VALUES ('fuji-ya', +GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) +VALUES ('miyoshi', +GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) +VALUES ('juju-ya', +GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) +VALUES ('tatsumi-ya', +GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) +VALUES ('tetsuji', +GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) +VALUES ('gazuma-ya', +GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) +VALUES ('honma-mon', +GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) +VALUES ('naniwa-ya', +GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) +VALUES ('kuro-dai', +GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) +VALUES ('daruma', +GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) +VALUES ('yanagi-ya', +GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) +VALUES ('sharaku', +GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) +VALUES ('takane', +GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) +VALUES ('chiyoda', +GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) +VALUES ('da-ka-po', +GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) +VALUES ('matsushima-ya', +GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) +VALUES ('kazuya', +GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) +VALUES ('furuya-kogane-an', +GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) +VALUES ('hachi-no-ie', +GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) +VALUES ('azuki-chan', +GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) +VALUES ('kuriko-an', +GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) +VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', +GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) +VALUES ('naze-ya', +GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) +VALUES ('sanoki-ya', +GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) +VALUES ('shigeta', +GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) +VALUES ('nishimi-ya', +GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) +VALUES ('hiiragi', +GeomFromText('POINT(139.711517 35.647701)')); +ALTER TABLE shops ADD SPATIAL KEY location_index (location); +SELECT id, name, AsText(location) AS location_text FROM shops +WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location); +id name location_text +14 tetsuji POINT(139.76857 35.680912) +19 daruma POINT(139.770599 35.681461) +26 kazuya POINT(139.760895 35.673508) +SHOW CREATE TABLE shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 COMMENT='ENGINE "InnoDB"' +DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result new file mode 100644 index 00000000000..9d45d2fe63d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/auto_increment_text.result @@ -0,0 +1,15 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text +) comment = 'engine "innodb"'; +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +id body +1 started groonga (long text) +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +id body +1 started groonga (long text) +2 sleeping... (short text) +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..f0792094a34 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/binlog_TODO_SPLIT_ME.result @@ -0,0 +1,34 @@ +drop table if exists t1; +show variables like 'log_bin'; +Variable_name Value +log_bin ON +set binlog_format="STATEMENT"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="ROW"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; +set binlog_format="MIXED"; +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +c1 c2 +1 100 +2 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result new file mode 100644 index 00000000000..b1a7c8efb89 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_comment_index_not_for_mroonga.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64), +INDEX (tag) COMMENT 'Tag search is required.' +) DEFAULT CHARSET=utf8 +COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `tag` (`tag`) COMMENT 'Tag search is required.' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result new file mode 100644 index 00000000000..2679079664e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/column_normal_comment.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY, +tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + `tag` varchar(64) DEFAULT NULL COMMENT 'It must consist of only alphabet and number.', + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result new file mode 100644 index 00000000000..6b29be5edb7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS diaries_innodb; +DROP TABLE IF EXISTS diaries_mroonga; +CREATE TABLE diaries_innodb ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; +CREATE TABLE diaries_mroonga ( +id INT PRIMARY KEY AUTO_INCREMENT, +body TEXT, +flag TINYINT(2), +INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE diaries_innodb index NULL flag 2 NULL 3 Using index +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE diaries_mroonga index NULL flag 2 NULL 3 Using index +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..b3814331038 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result @@ -0,0 +1,109 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t3 (c1 int primary key) COMMENT = 'engine "innodb"'; +drop table t1,t2,t3; +create table t1 (c1 int primary key, c2 int, c3 int) COMMENT = 'engine "innodb"'; +drop table t1; +create table t1 (c1 bit primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 bit(1) NO PRI NULL +drop table t1; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 tinyint(4) NO PRI NULL +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 smallint(6) NO PRI NULL +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 mediumint(9) NO PRI NULL +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 int(11) NO PRI NULL +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 bigint(20) NO PRI NULL +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 double NO PRI NULL +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 float NO PRI NULL +drop table t1; +create table t1 (c1 decimal primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 decimal(10,0) NO PRI NULL +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 date NO PRI NULL +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 time NO PRI NULL +drop table t1; +create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 timestamp NO PRI CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 datetime NO PRI NULL +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 year(4) NO PRI NULL +drop table t1; +create table t1 (c1 char(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 char(10) NO PRI NULL +drop table t1; +create table t1 (c1 varchar(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 varchar(10) NO PRI NULL +drop table t1; +create table t1 (c1 binary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 binary(10) NO PRI NULL +drop table t1; +create table t1 (c1 varbinary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 varbinary(10) NO PRI NULL +drop table t1; +create table t1 (c1 enum("yes","no") primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 enum('yes','no') NO PRI NULL +drop table t1; +create table t1 (c1 set("A","B","AB","O") primary key) COMMENT = 'engine "innodb"'; +desc t1; +Field Type Null Key Default Extra +c1 set('A','B','AB','O') NO PRI NULL +drop table t1; +create table t1 (c1 int) COMMENT = 'engine "innodb"'; +ERROR 42000: This table type requires a primary key diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result new file mode 100644 index 00000000000..ce1b5470231 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_comment_combined.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS bugs; +CREATE TABLE bugs ( +id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8 +COMMENT='Free style normal comment, engine "InnoDB"'; +SHOW CREATE TABLE bugs; +Table Create Table +bugs CREATE TABLE `bugs` ( + `id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"' +DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result new file mode 100644 index 00000000000..ea992f827ca --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_normalizer_fulltext_index.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +day DATE PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +day content +SELECT * FROM diaries +WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); +day content +2013-04-23 ブラックコーヒーを飲んã ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result new file mode 100644 index 00000000000..0c0af7a9db2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_multiple_token_filters.result @@ -0,0 +1,15 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_HASH_KEY ShortText +table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord,TokenFilterStopWord +column_create memos-content index COLUMN_INDEX|WITH_POSITION memos +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result new file mode 100644 index 00000000000..aef34c0bc26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_token_filters_index_comment_one_token_filter.result @@ -0,0 +1,15 @@ +SELECT mroonga_command("register token_filters/stop_word"); +mroonga_command("register token_filters/stop_word") +true +SET NAMES utf8; +CREATE TABLE memos ( +id INT NOT NULL PRIMARY KEY, +content VARCHAR(64) NOT NULL, +FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +SELECT mroonga_command("dump"); +mroonga_command("dump") +table_create memos TABLE_HASH_KEY ShortText +table_create memos-content TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerMySQLGeneralCI --token_filters TokenFilterStopWord +column_create memos-content index COLUMN_INDEX|WITH_POSITION memos +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..990537622f4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_TODO_SPLIT_ME.result @@ -0,0 +1,55 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int) COMMENT 'engine = "innodb"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine = "innodb"' +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +4 102 +delete from t1 where c1=3; +select * from t1; +c1 c2 +1 100 +2 101 +4 102 +flush tables; +delete from t1 where c1=2; +select * from t1; +c1 c2 +1 100 +4 102 +delete from t1; +select * from t1; +c1 c2 +drop table t1; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT 'engine = "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +20 ka ki ku ke +delete from t1 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result new file mode 100644 index 00000000000..200e978a582 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/delete_all.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS users; +SET NAMES utf8; +CREATE TABLE users ( +id int PRIMARY KEY, +name varchar(100), +FULLTEXT INDEX (name) +) COMMENT 'engine = "InnoDB"' DEFAULT CHARSET=utf8; +INSERT INTO users VALUES (1, 'Alice'); +INSERT INTO users VALUES (2, 'Bob'); +INSERT INTO users VALUES (3, 'Chris'); +SELECT * FROM users; +id name +1 Alice +2 Bob +3 Chris +DELETE FROM users; +SELECT * FROM users; +id name +DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result new file mode 100644 index 00000000000..08c37695f5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_leading_not.result @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); +id title content +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result new file mode 100644 index 00000000000..b0bff284532 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_multiple_match_against.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title), +FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries VALUES(1, "富士山", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気 1月1日", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "天気 4月4日", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT * FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +id title content +3 天気 4月4日 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SELECT 1 FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +1 +1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result new file mode 100644 index 00000000000..190105a3ba1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); +id content +6 Yesterday was fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result new file mode 100644 index 00000000000..240da5c357f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_or.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); +id content +1 Today is good day. +2 Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result new file mode 100644 index 00000000000..6dedd2183eb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); +id content +1 Today is good day. +3 Yesterday was good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result new file mode 100644 index 00000000000..14d30fac260 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_no_operator.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE); +id content +1 Today is good day. +3 Today is fine. +2 Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result new file mode 100644 index 00000000000..d367ba1d21f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_minus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE); +id content +2 Tomorrow will be good day. +3 Today is fine. +4 Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result new file mode 100644 index 00000000000..6bf48ab6556 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_or_with_plus.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE); +id content +1 Today is good day. +2 Tomorrow will be good day. +4 Tomorrow will be fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result new file mode 100644 index 00000000000..29975d55137 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); +id content +1 Today is good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result new file mode 100644 index 00000000000..2294308ae92 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); +id content +3 Today is fine. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result new file mode 100644 index 00000000000..b61f0637bb9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_default_operator_plus_with_or.result @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS memos; +SET NAMES utf8; +CREATE TABLE memos ( +id INT PRIMARY KEY AUTO_INCREMENT, +content TEXT, +FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +SELECT * FROM memos +WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); +id content +1 Today is good day. +2 Tomorrow will be good day. +DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result new file mode 100644 index 00000000000..e603cc27401 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_full_spec.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠12 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result new file mode 100644 index 00000000000..6a5dbd5ca6b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_no_weight.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠3 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 2 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result new file mode 100644 index 00000000000..2fe63a68f77 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_boolean_mode_pragma_weight_omit_section.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id INT PRIMARY KEY, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT *, MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score +FROM diaries +WHERE MATCH(title, content) +AGAINST("*W1:2 +天気" in BOOLEAN MODE); +id title content score +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠3 +3 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ 1 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result new file mode 100644 index 00000000000..b58f4ad3364 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_ascii.result @@ -0,0 +1,29 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii"); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result new file mode 100644 index 00000000000..d7b64010ebf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_cp932.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä","‚ ‚ ‚ ‚ ‚ ‚ ‚ "); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä ‚ ‚ ‚ ‚ ‚ ‚ ‚  +2 ‚¢‚¢‚¢‚¢‚¢ –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ +3 dummy dummy +select * from t1 where match(c2) against("•xŽmŽR"); +c1 c2 c3 +1 –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä ‚ ‚ ‚ ‚ ‚ ‚ ‚  +select * from t1 where match(c3) against("•xŽmŽR"); +c1 c2 c3 +2 ‚¢‚¢‚¢‚¢‚¢ –¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result new file mode 100644 index 00000000000..9aa60690513 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_eucjpms.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms COMMENT = 'engine "innodb"'; +insert into t1 values(1, "ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ","¤¢¤¢¤¢¤¢¤¢¤¢¤¢"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ ¤¢¤¢¤¢¤¢¤¢¤¢¤¢ +2 ¤¤¤¤¤¤¤¤¤¤ ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó +3 dummy dummy +select * from t1 where match(c2) against("Éٻλ³"); +c1 c2 c3 +1 ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ ¤¢¤¢¤¢¤¢¤¢¤¢¤¢ +select * from t1 where match(c3) against("Éٻλ³"); +c1 c2 c3 +2 ¤¤¤¤¤¤¤¤¤¤ ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result new file mode 100644 index 00000000000..6c73f4627bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_charset_japanese.result @@ -0,0 +1,18 @@ +drop table if exists t1, t2, t3; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +3 dummy dummy +select * from t1 where match(c2) against("富士山"); +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +select * from t1 where match(c3) against("富士山"); +c1 c2 c3 +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result new file mode 100644 index 00000000000..fd07ea67964 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_index_recreate.result @@ -0,0 +1,41 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES utf8; +CREATE TABLE diaries ( +id int PRIMARY KEY, +title varchar(255), +content text, +FULLTEXT INDEX (title) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries VALUES (1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES (2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES (3, "富士山", "今日もãれã„。"); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +id title content +3 富士山 今日もãれã„。 +DROP INDEX title ON diaries; +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +SELECT * FROM diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +CREATE FULLTEXT INDEX new_title_index ON diaries (title); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +id title content +3 富士山 今日もãれã„。 +SELECT * FROM diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result new file mode 100644 index 00000000000..03300e3e9ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_select.result @@ -0,0 +1,66 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +5 ta ti ii ii to 349526 +3 aa ii ii ii oo 524289 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +drop table t1,t2; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result new file mode 100644 index 00000000000..8e1b0845e85 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_insert_values.result @@ -0,0 +1,25 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` text, + PRIMARY KEY (`c1`), + FULLTEXT KEY `ft` (`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result new file mode 100644 index 00000000000..3809006038c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_many_records.result @@ -0,0 +1,4389 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +fulltext index (title) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +set autocommit=0; +insert into diaries values(0, "2011-07-14"); +insert into diaries values(1, "2011-07-15"); +insert into diaries values(2, "2011-07-16"); +insert into diaries values(3, "2011-07-17"); +insert into diaries values(4, "2011-07-18"); +insert into diaries values(5, "2011-07-19"); +insert into diaries values(6, "2011-07-20"); +insert into diaries values(7, "2011-07-21"); +insert into diaries values(8, "2011-07-22"); +insert into diaries values(9, "2011-07-23"); +insert into diaries values(10, "2011-07-24"); +insert into diaries values(11, "2011-07-25"); +insert into diaries values(12, "2011-07-26"); +insert into diaries values(13, "2011-07-27"); +insert into diaries values(14, "2011-07-28"); +insert into diaries values(15, "2011-07-29"); +insert into diaries values(16, "2011-07-30"); +insert into diaries values(17, "2011-07-31"); +insert into diaries values(18, "2011-08-01"); +insert into diaries values(19, "2011-08-02"); +insert into diaries values(20, "2011-08-03"); +insert into diaries values(21, "2011-08-04"); +insert into diaries values(22, "2011-08-05"); +insert into diaries values(23, "2011-08-06"); +insert into diaries values(24, "2011-08-07"); +insert into diaries values(25, "2011-08-08"); +insert into diaries values(26, "2011-08-09"); +insert into diaries values(27, "2011-08-10"); +insert into diaries values(28, "2011-08-11"); +insert into diaries values(29, "2011-08-12"); +insert into diaries values(30, "2011-08-13"); +insert into diaries values(31, "2011-08-14"); +insert into diaries values(32, "2011-08-15"); +insert into diaries values(33, "2011-08-16"); +insert into diaries values(34, "2011-08-17"); +insert into diaries values(35, "2011-08-18"); +insert into diaries values(36, "2011-08-19"); +insert into diaries values(37, "2011-08-20"); +insert into diaries values(38, "2011-08-21"); +insert into diaries values(39, "2011-08-22"); +insert into diaries values(40, "2011-08-23"); +insert into diaries values(41, "2011-08-24"); +insert into diaries values(42, "2011-08-25"); +insert into diaries values(43, "2011-08-26"); +insert into diaries values(44, "2011-08-27"); +insert into diaries values(45, "2011-08-28"); +insert into diaries values(46, "2011-08-29"); +insert into diaries values(47, "2011-08-30"); +insert into diaries values(48, "2011-08-31"); +insert into diaries values(49, "2011-09-01"); +insert into diaries values(50, "2011-09-02"); +insert into diaries values(51, "2011-09-03"); +insert into diaries values(52, "2011-09-04"); +insert into diaries values(53, "2011-09-05"); +insert into diaries values(54, "2011-09-06"); +insert into diaries values(55, "2011-09-07"); +insert into diaries values(56, "2011-09-08"); +insert into diaries values(57, "2011-09-09"); +insert into diaries values(58, "2011-09-10"); +insert into diaries values(59, "2011-09-11"); +insert into diaries values(60, "2011-09-12"); +insert into diaries values(61, "2011-09-13"); +insert into diaries values(62, "2011-09-14"); +insert into diaries values(63, "2011-09-15"); +insert into diaries values(64, "2011-09-16"); +insert into diaries values(65, "2011-09-17"); +insert into diaries values(66, "2011-09-18"); +insert into diaries values(67, "2011-09-19"); +insert into diaries values(68, "2011-09-20"); +insert into diaries values(69, "2011-09-21"); +insert into diaries values(70, "2011-09-22"); +insert into diaries values(71, "2011-09-23"); +insert into diaries values(72, "2011-09-24"); +insert into diaries values(73, "2011-09-25"); +insert into diaries values(74, "2011-09-26"); +insert into diaries values(75, "2011-09-27"); +insert into diaries values(76, "2011-09-28"); +insert into diaries values(77, "2011-09-29"); +insert into diaries values(78, "2011-09-30"); +insert into diaries values(79, "2011-10-01"); +insert into diaries values(80, "2011-10-02"); +insert into diaries values(81, "2011-10-03"); +insert into diaries values(82, "2011-10-04"); +insert into diaries values(83, "2011-10-05"); +insert into diaries values(84, "2011-10-06"); +insert into diaries values(85, "2011-10-07"); +insert into diaries values(86, "2011-10-08"); +insert into diaries values(87, "2011-10-09"); +insert into diaries values(88, "2011-10-10"); +insert into diaries values(89, "2011-10-11"); +insert into diaries values(90, "2011-10-12"); +insert into diaries values(91, "2011-10-13"); +insert into diaries values(92, "2011-10-14"); +insert into diaries values(93, "2011-10-15"); +insert into diaries values(94, "2011-10-16"); +insert into diaries values(95, "2011-10-17"); +insert into diaries values(96, "2011-10-18"); +insert into diaries values(97, "2011-10-19"); +insert into diaries values(98, "2011-10-20"); +insert into diaries values(99, "2011-10-21"); +insert into diaries values(100, "2011-10-22"); +insert into diaries values(101, "2011-10-23"); +insert into diaries values(102, "2011-10-24"); +insert into diaries values(103, "2011-10-25"); +insert into diaries values(104, "2011-10-26"); +insert into diaries values(105, "2011-10-27"); +insert into diaries values(106, "2011-10-28"); +insert into diaries values(107, "2011-10-29"); +insert into diaries values(108, "2011-10-30"); +insert into diaries values(109, "2011-10-31"); +insert into diaries values(110, "2011-11-01"); +insert into diaries values(111, "2011-11-02"); +insert into diaries values(112, "2011-11-03"); +insert into diaries values(113, "2011-11-04"); +insert into diaries values(114, "2011-11-05"); +insert into diaries values(115, "2011-11-06"); +insert into diaries values(116, "2011-11-07"); +insert into diaries values(117, "2011-11-08"); +insert into diaries values(118, "2011-11-09"); +insert into diaries values(119, "2011-11-10"); +insert into diaries values(120, "2011-11-11"); +insert into diaries values(121, "2011-11-12"); +insert into diaries values(122, "2011-11-13"); +insert into diaries values(123, "2011-11-14"); +insert into diaries values(124, "2011-11-15"); +insert into diaries values(125, "2011-11-16"); +insert into diaries values(126, "2011-11-17"); +insert into diaries values(127, "2011-11-18"); +insert into diaries values(128, "2011-11-19"); +insert into diaries values(129, "2011-11-20"); +insert into diaries values(130, "2011-11-21"); +insert into diaries values(131, "2011-11-22"); +insert into diaries values(132, "2011-11-23"); +insert into diaries values(133, "2011-11-24"); +insert into diaries values(134, "2011-11-25"); +insert into diaries values(135, "2011-11-26"); +insert into diaries values(136, "2011-11-27"); +insert into diaries values(137, "2011-11-28"); +insert into diaries values(138, "2011-11-29"); +insert into diaries values(139, "2011-11-30"); +insert into diaries values(140, "2011-12-01"); +insert into diaries values(141, "2011-12-02"); +insert into diaries values(142, "2011-12-03"); +insert into diaries values(143, "2011-12-04"); +insert into diaries values(144, "2011-12-05"); +insert into diaries values(145, "2011-12-06"); +insert into diaries values(146, "2011-12-07"); +insert into diaries values(147, "2011-12-08"); +insert into diaries values(148, "2011-12-09"); +insert into diaries values(149, "2011-12-10"); +insert into diaries values(150, "2011-12-11"); +insert into diaries values(151, "2011-12-12"); +insert into diaries values(152, "2011-12-13"); +insert into diaries values(153, "2011-12-14"); +insert into diaries values(154, "2011-12-15"); +insert into diaries values(155, "2011-12-16"); +insert into diaries values(156, "2011-12-17"); +insert into diaries values(157, "2011-12-18"); +insert into diaries values(158, "2011-12-19"); +insert into diaries values(159, "2011-12-20"); +insert into diaries values(160, "2011-12-21"); +insert into diaries values(161, "2011-12-22"); +insert into diaries values(162, "2011-12-23"); +insert into diaries values(163, "2011-12-24"); +insert into diaries values(164, "2011-12-25"); +insert into diaries values(165, "2011-12-26"); +insert into diaries values(166, "2011-12-27"); +insert into diaries values(167, "2011-12-28"); +insert into diaries values(168, "2011-12-29"); +insert into diaries values(169, "2011-12-30"); +insert into diaries values(170, "2011-12-31"); +insert into diaries values(171, "2012-01-01"); +insert into diaries values(172, "2012-01-02"); +insert into diaries values(173, "2012-01-03"); +insert into diaries values(174, "2012-01-04"); +insert into diaries values(175, "2012-01-05"); +insert into diaries values(176, "2012-01-06"); +insert into diaries values(177, "2012-01-07"); +insert into diaries values(178, "2012-01-08"); +insert into diaries values(179, "2012-01-09"); +insert into diaries values(180, "2012-01-10"); +insert into diaries values(181, "2012-01-11"); +insert into diaries values(182, "2012-01-12"); +insert into diaries values(183, "2012-01-13"); +insert into diaries values(184, "2012-01-14"); +insert into diaries values(185, "2012-01-15"); +insert into diaries values(186, "2012-01-16"); +insert into diaries values(187, "2012-01-17"); +insert into diaries values(188, "2012-01-18"); +insert into diaries values(189, "2012-01-19"); +insert into diaries values(190, "2012-01-20"); +insert into diaries values(191, "2012-01-21"); +insert into diaries values(192, "2012-01-22"); +insert into diaries values(193, "2012-01-23"); +insert into diaries values(194, "2012-01-24"); +insert into diaries values(195, "2012-01-25"); +insert into diaries values(196, "2012-01-26"); +insert into diaries values(197, "2012-01-27"); +insert into diaries values(198, "2012-01-28"); +insert into diaries values(199, "2012-01-29"); +insert into diaries values(200, "2012-01-30"); +insert into diaries values(201, "2012-01-31"); +insert into diaries values(202, "2012-02-01"); +insert into diaries values(203, "2012-02-02"); +insert into diaries values(204, "2012-02-03"); +insert into diaries values(205, "2012-02-04"); +insert into diaries values(206, "2012-02-05"); +insert into diaries values(207, "2012-02-06"); +insert into diaries values(208, "2012-02-07"); +insert into diaries values(209, "2012-02-08"); +insert into diaries values(210, "2012-02-09"); +insert into diaries values(211, "2012-02-10"); +insert into diaries values(212, "2012-02-11"); +insert into diaries values(213, "2012-02-12"); +insert into diaries values(214, "2012-02-13"); +insert into diaries values(215, "2012-02-14"); +insert into diaries values(216, "2012-02-15"); +insert into diaries values(217, "2012-02-16"); +insert into diaries values(218, "2012-02-17"); +insert into diaries values(219, "2012-02-18"); +insert into diaries values(220, "2012-02-19"); +insert into diaries values(221, "2012-02-20"); +insert into diaries values(222, "2012-02-21"); +insert into diaries values(223, "2012-02-22"); +insert into diaries values(224, "2012-02-23"); +insert into diaries values(225, "2012-02-24"); +insert into diaries values(226, "2012-02-25"); +insert into diaries values(227, "2012-02-26"); +insert into diaries values(228, "2012-02-27"); +insert into diaries values(229, "2012-02-28"); +insert into diaries values(230, "2012-02-29"); +insert into diaries values(231, "2012-03-01"); +insert into diaries values(232, "2012-03-02"); +insert into diaries values(233, "2012-03-03"); +insert into diaries values(234, "2012-03-04"); +insert into diaries values(235, "2012-03-05"); +insert into diaries values(236, "2012-03-06"); +insert into diaries values(237, "2012-03-07"); +insert into diaries values(238, "2012-03-08"); +insert into diaries values(239, "2012-03-09"); +insert into diaries values(240, "2012-03-10"); +insert into diaries values(241, "2012-03-11"); +insert into diaries values(242, "2012-03-12"); +insert into diaries values(243, "2012-03-13"); +insert into diaries values(244, "2012-03-14"); +insert into diaries values(245, "2012-03-15"); +insert into diaries values(246, "2012-03-16"); +insert into diaries values(247, "2012-03-17"); +insert into diaries values(248, "2012-03-18"); +insert into diaries values(249, "2012-03-19"); +insert into diaries values(250, "2012-03-20"); +insert into diaries values(251, "2012-03-21"); +insert into diaries values(252, "2012-03-22"); +insert into diaries values(253, "2012-03-23"); +insert into diaries values(254, "2012-03-24"); +insert into diaries values(255, "2012-03-25"); +insert into diaries values(256, "2012-03-26"); +insert into diaries values(257, "2012-03-27"); +insert into diaries values(258, "2012-03-28"); +insert into diaries values(259, "2012-03-29"); +insert into diaries values(260, "2012-03-30"); +insert into diaries values(261, "2012-03-31"); +insert into diaries values(262, "2012-04-01"); +insert into diaries values(263, "2012-04-02"); +insert into diaries values(264, "2012-04-03"); +insert into diaries values(265, "2012-04-04"); +insert into diaries values(266, "2012-04-05"); +insert into diaries values(267, "2012-04-06"); +insert into diaries values(268, "2012-04-07"); +insert into diaries values(269, "2012-04-08"); +insert into diaries values(270, "2012-04-09"); +insert into diaries values(271, "2012-04-10"); +insert into diaries values(272, "2012-04-11"); +insert into diaries values(273, "2012-04-12"); +insert into diaries values(274, "2012-04-13"); +insert into diaries values(275, "2012-04-14"); +insert into diaries values(276, "2012-04-15"); +insert into diaries values(277, "2012-04-16"); +insert into diaries values(278, "2012-04-17"); +insert into diaries values(279, "2012-04-18"); +insert into diaries values(280, "2012-04-19"); +insert into diaries values(281, "2012-04-20"); +insert into diaries values(282, "2012-04-21"); +insert into diaries values(283, "2012-04-22"); +insert into diaries values(284, "2012-04-23"); +insert into diaries values(285, "2012-04-24"); +insert into diaries values(286, "2012-04-25"); +insert into diaries values(287, "2012-04-26"); +insert into diaries values(288, "2012-04-27"); +insert into diaries values(289, "2012-04-28"); +insert into diaries values(290, "2012-04-29"); +insert into diaries values(291, "2012-04-30"); +insert into diaries values(292, "2012-05-01"); +insert into diaries values(293, "2012-05-02"); +insert into diaries values(294, "2012-05-03"); +insert into diaries values(295, "2012-05-04"); +insert into diaries values(296, "2012-05-05"); +insert into diaries values(297, "2012-05-06"); +insert into diaries values(298, "2012-05-07"); +insert into diaries values(299, "2012-05-08"); +insert into diaries values(300, "2012-05-09"); +insert into diaries values(301, "2012-05-10"); +insert into diaries values(302, "2012-05-11"); +insert into diaries values(303, "2012-05-12"); +insert into diaries values(304, "2012-05-13"); +insert into diaries values(305, "2012-05-14"); +insert into diaries values(306, "2012-05-15"); +insert into diaries values(307, "2012-05-16"); +insert into diaries values(308, "2012-05-17"); +insert into diaries values(309, "2012-05-18"); +insert into diaries values(310, "2012-05-19"); +insert into diaries values(311, "2012-05-20"); +insert into diaries values(312, "2012-05-21"); +insert into diaries values(313, "2012-05-22"); +insert into diaries values(314, "2012-05-23"); +insert into diaries values(315, "2012-05-24"); +insert into diaries values(316, "2012-05-25"); +insert into diaries values(317, "2012-05-26"); +insert into diaries values(318, "2012-05-27"); +insert into diaries values(319, "2012-05-28"); +insert into diaries values(320, "2012-05-29"); +insert into diaries values(321, "2012-05-30"); +insert into diaries values(322, "2012-05-31"); +insert into diaries values(323, "2012-06-01"); +insert into diaries values(324, "2012-06-02"); +insert into diaries values(325, "2012-06-03"); +insert into diaries values(326, "2012-06-04"); +insert into diaries values(327, "2012-06-05"); +insert into diaries values(328, "2012-06-06"); +insert into diaries values(329, "2012-06-07"); +insert into diaries values(330, "2012-06-08"); +insert into diaries values(331, "2012-06-09"); +insert into diaries values(332, "2012-06-10"); +insert into diaries values(333, "2012-06-11"); +insert into diaries values(334, "2012-06-12"); +insert into diaries values(335, "2012-06-13"); +insert into diaries values(336, "2012-06-14"); +insert into diaries values(337, "2012-06-15"); +insert into diaries values(338, "2012-06-16"); +insert into diaries values(339, "2012-06-17"); +insert into diaries values(340, "2012-06-18"); +insert into diaries values(341, "2012-06-19"); +insert into diaries values(342, "2012-06-20"); +insert into diaries values(343, "2012-06-21"); +insert into diaries values(344, "2012-06-22"); +insert into diaries values(345, "2012-06-23"); +insert into diaries values(346, "2012-06-24"); +insert into diaries values(347, "2012-06-25"); +insert into diaries values(348, "2012-06-26"); +insert into diaries values(349, "2012-06-27"); +insert into diaries values(350, "2012-06-28"); +insert into diaries values(351, "2012-06-29"); +insert into diaries values(352, "2012-06-30"); +insert into diaries values(353, "2012-07-01"); +insert into diaries values(354, "2012-07-02"); +insert into diaries values(355, "2012-07-03"); +insert into diaries values(356, "2012-07-04"); +insert into diaries values(357, "2012-07-05"); +insert into diaries values(358, "2012-07-06"); +insert into diaries values(359, "2012-07-07"); +insert into diaries values(360, "2012-07-08"); +insert into diaries values(361, "2012-07-09"); +insert into diaries values(362, "2012-07-10"); +insert into diaries values(363, "2012-07-11"); +insert into diaries values(364, "2012-07-12"); +insert into diaries values(365, "2012-07-13"); +insert into diaries values(366, "2012-07-14"); +insert into diaries values(367, "2012-07-15"); +insert into diaries values(368, "2012-07-16"); +insert into diaries values(369, "2012-07-17"); +insert into diaries values(370, "2012-07-18"); +insert into diaries values(371, "2012-07-19"); +insert into diaries values(372, "2012-07-20"); +insert into diaries values(373, "2012-07-21"); +insert into diaries values(374, "2012-07-22"); +insert into diaries values(375, "2012-07-23"); +insert into diaries values(376, "2012-07-24"); +insert into diaries values(377, "2012-07-25"); +insert into diaries values(378, "2012-07-26"); +insert into diaries values(379, "2012-07-27"); +insert into diaries values(380, "2012-07-28"); +insert into diaries values(381, "2012-07-29"); +insert into diaries values(382, "2012-07-30"); +insert into diaries values(383, "2012-07-31"); +insert into diaries values(384, "2012-08-01"); +insert into diaries values(385, "2012-08-02"); +insert into diaries values(386, "2012-08-03"); +insert into diaries values(387, "2012-08-04"); +insert into diaries values(388, "2012-08-05"); +insert into diaries values(389, "2012-08-06"); +insert into diaries values(390, "2012-08-07"); +insert into diaries values(391, "2012-08-08"); +insert into diaries values(392, "2012-08-09"); +insert into diaries values(393, "2012-08-10"); +insert into diaries values(394, "2012-08-11"); +insert into diaries values(395, "2012-08-12"); +insert into diaries values(396, "2012-08-13"); +insert into diaries values(397, "2012-08-14"); +insert into diaries values(398, "2012-08-15"); +insert into diaries values(399, "2012-08-16"); +insert into diaries values(400, "2012-08-17"); +insert into diaries values(401, "2012-08-18"); +insert into diaries values(402, "2012-08-19"); +insert into diaries values(403, "2012-08-20"); +insert into diaries values(404, "2012-08-21"); +insert into diaries values(405, "2012-08-22"); +insert into diaries values(406, "2012-08-23"); +insert into diaries values(407, "2012-08-24"); +insert into diaries values(408, "2012-08-25"); +insert into diaries values(409, "2012-08-26"); +insert into diaries values(410, "2012-08-27"); +insert into diaries values(411, "2012-08-28"); +insert into diaries values(412, "2012-08-29"); +insert into diaries values(413, "2012-08-30"); +insert into diaries values(414, "2012-08-31"); +insert into diaries values(415, "2012-09-01"); +insert into diaries values(416, "2012-09-02"); +insert into diaries values(417, "2012-09-03"); +insert into diaries values(418, "2012-09-04"); +insert into diaries values(419, "2012-09-05"); +insert into diaries values(420, "2012-09-06"); +insert into diaries values(421, "2012-09-07"); +insert into diaries values(422, "2012-09-08"); +insert into diaries values(423, "2012-09-09"); +insert into diaries values(424, "2012-09-10"); +insert into diaries values(425, "2012-09-11"); +insert into diaries values(426, "2012-09-12"); +insert into diaries values(427, "2012-09-13"); +insert into diaries values(428, "2012-09-14"); +insert into diaries values(429, "2012-09-15"); +insert into diaries values(430, "2012-09-16"); +insert into diaries values(431, "2012-09-17"); +insert into diaries values(432, "2012-09-18"); +insert into diaries values(433, "2012-09-19"); +insert into diaries values(434, "2012-09-20"); +insert into diaries values(435, "2012-09-21"); +insert into diaries values(436, "2012-09-22"); +insert into diaries values(437, "2012-09-23"); +insert into diaries values(438, "2012-09-24"); +insert into diaries values(439, "2012-09-25"); +insert into diaries values(440, "2012-09-26"); +insert into diaries values(441, "2012-09-27"); +insert into diaries values(442, "2012-09-28"); +insert into diaries values(443, "2012-09-29"); +insert into diaries values(444, "2012-09-30"); +insert into diaries values(445, "2012-10-01"); +insert into diaries values(446, "2012-10-02"); +insert into diaries values(447, "2012-10-03"); +insert into diaries values(448, "2012-10-04"); +insert into diaries values(449, "2012-10-05"); +insert into diaries values(450, "2012-10-06"); +insert into diaries values(451, "2012-10-07"); +insert into diaries values(452, "2012-10-08"); +insert into diaries values(453, "2012-10-09"); +insert into diaries values(454, "2012-10-10"); +insert into diaries values(455, "2012-10-11"); +insert into diaries values(456, "2012-10-12"); +insert into diaries values(457, "2012-10-13"); +insert into diaries values(458, "2012-10-14"); +insert into diaries values(459, "2012-10-15"); +insert into diaries values(460, "2012-10-16"); +insert into diaries values(461, "2012-10-17"); +insert into diaries values(462, "2012-10-18"); +insert into diaries values(463, "2012-10-19"); +insert into diaries values(464, "2012-10-20"); +insert into diaries values(465, "2012-10-21"); +insert into diaries values(466, "2012-10-22"); +insert into diaries values(467, "2012-10-23"); +insert into diaries values(468, "2012-10-24"); +insert into diaries values(469, "2012-10-25"); +insert into diaries values(470, "2012-10-26"); +insert into diaries values(471, "2012-10-27"); +insert into diaries values(472, "2012-10-28"); +insert into diaries values(473, "2012-10-29"); +insert into diaries values(474, "2012-10-30"); +insert into diaries values(475, "2012-10-31"); +insert into diaries values(476, "2012-11-01"); +insert into diaries values(477, "2012-11-02"); +insert into diaries values(478, "2012-11-03"); +insert into diaries values(479, "2012-11-04"); +insert into diaries values(480, "2012-11-05"); +insert into diaries values(481, "2012-11-06"); +insert into diaries values(482, "2012-11-07"); +insert into diaries values(483, "2012-11-08"); +insert into diaries values(484, "2012-11-09"); +insert into diaries values(485, "2012-11-10"); +insert into diaries values(486, "2012-11-11"); +insert into diaries values(487, "2012-11-12"); +insert into diaries values(488, "2012-11-13"); +insert into diaries values(489, "2012-11-14"); +insert into diaries values(490, "2012-11-15"); +insert into diaries values(491, "2012-11-16"); +insert into diaries values(492, "2012-11-17"); +insert into diaries values(493, "2012-11-18"); +insert into diaries values(494, "2012-11-19"); +insert into diaries values(495, "2012-11-20"); +insert into diaries values(496, "2012-11-21"); +insert into diaries values(497, "2012-11-22"); +insert into diaries values(498, "2012-11-23"); +insert into diaries values(499, "2012-11-24"); +insert into diaries values(500, "2012-11-25"); +insert into diaries values(501, "2012-11-26"); +insert into diaries values(502, "2012-11-27"); +insert into diaries values(503, "2012-11-28"); +insert into diaries values(504, "2012-11-29"); +insert into diaries values(505, "2012-11-30"); +insert into diaries values(506, "2012-12-01"); +insert into diaries values(507, "2012-12-02"); +insert into diaries values(508, "2012-12-03"); +insert into diaries values(509, "2012-12-04"); +insert into diaries values(510, "2012-12-05"); +insert into diaries values(511, "2012-12-06"); +insert into diaries values(512, "2012-12-07"); +insert into diaries values(513, "2012-12-08"); +insert into diaries values(514, "2012-12-09"); +insert into diaries values(515, "2012-12-10"); +insert into diaries values(516, "2012-12-11"); +insert into diaries values(517, "2012-12-12"); +insert into diaries values(518, "2012-12-13"); +insert into diaries values(519, "2012-12-14"); +insert into diaries values(520, "2012-12-15"); +insert into diaries values(521, "2012-12-16"); +insert into diaries values(522, "2012-12-17"); +insert into diaries values(523, "2012-12-18"); +insert into diaries values(524, "2012-12-19"); +insert into diaries values(525, "2012-12-20"); +insert into diaries values(526, "2012-12-21"); +insert into diaries values(527, "2012-12-22"); +insert into diaries values(528, "2012-12-23"); +insert into diaries values(529, "2012-12-24"); +insert into diaries values(530, "2012-12-25"); +insert into diaries values(531, "2012-12-26"); +insert into diaries values(532, "2012-12-27"); +insert into diaries values(533, "2012-12-28"); +insert into diaries values(534, "2012-12-29"); +insert into diaries values(535, "2012-12-30"); +insert into diaries values(536, "2012-12-31"); +insert into diaries values(537, "2013-01-01"); +insert into diaries values(538, "2013-01-02"); +insert into diaries values(539, "2013-01-03"); +insert into diaries values(540, "2013-01-04"); +insert into diaries values(541, "2013-01-05"); +insert into diaries values(542, "2013-01-06"); +insert into diaries values(543, "2013-01-07"); +insert into diaries values(544, "2013-01-08"); +insert into diaries values(545, "2013-01-09"); +insert into diaries values(546, "2013-01-10"); +insert into diaries values(547, "2013-01-11"); +insert into diaries values(548, "2013-01-12"); +insert into diaries values(549, "2013-01-13"); +insert into diaries values(550, "2013-01-14"); +insert into diaries values(551, "2013-01-15"); +insert into diaries values(552, "2013-01-16"); +insert into diaries values(553, "2013-01-17"); +insert into diaries values(554, "2013-01-18"); +insert into diaries values(555, "2013-01-19"); +insert into diaries values(556, "2013-01-20"); +insert into diaries values(557, "2013-01-21"); +insert into diaries values(558, "2013-01-22"); +insert into diaries values(559, "2013-01-23"); +insert into diaries values(560, "2013-01-24"); +insert into diaries values(561, "2013-01-25"); +insert into diaries values(562, "2013-01-26"); +insert into diaries values(563, "2013-01-27"); +insert into diaries values(564, "2013-01-28"); +insert into diaries values(565, "2013-01-29"); +insert into diaries values(566, "2013-01-30"); +insert into diaries values(567, "2013-01-31"); +insert into diaries values(568, "2013-02-01"); +insert into diaries values(569, "2013-02-02"); +insert into diaries values(570, "2013-02-03"); +insert into diaries values(571, "2013-02-04"); +insert into diaries values(572, "2013-02-05"); +insert into diaries values(573, "2013-02-06"); +insert into diaries values(574, "2013-02-07"); +insert into diaries values(575, "2013-02-08"); +insert into diaries values(576, "2013-02-09"); +insert into diaries values(577, "2013-02-10"); +insert into diaries values(578, "2013-02-11"); +insert into diaries values(579, "2013-02-12"); +insert into diaries values(580, "2013-02-13"); +insert into diaries values(581, "2013-02-14"); +insert into diaries values(582, "2013-02-15"); +insert into diaries values(583, "2013-02-16"); +insert into diaries values(584, "2013-02-17"); +insert into diaries values(585, "2013-02-18"); +insert into diaries values(586, "2013-02-19"); +insert into diaries values(587, "2013-02-20"); +insert into diaries values(588, "2013-02-21"); +insert into diaries values(589, "2013-02-22"); +insert into diaries values(590, "2013-02-23"); +insert into diaries values(591, "2013-02-24"); +insert into diaries values(592, "2013-02-25"); +insert into diaries values(593, "2013-02-26"); +insert into diaries values(594, "2013-02-27"); +insert into diaries values(595, "2013-02-28"); +insert into diaries values(596, "2013-03-01"); +insert into diaries values(597, "2013-03-02"); +insert into diaries values(598, "2013-03-03"); +insert into diaries values(599, "2013-03-04"); +insert into diaries values(600, "2013-03-05"); +insert into diaries values(601, "2013-03-06"); +insert into diaries values(602, "2013-03-07"); +insert into diaries values(603, "2013-03-08"); +insert into diaries values(604, "2013-03-09"); +insert into diaries values(605, "2013-03-10"); +insert into diaries values(606, "2013-03-11"); +insert into diaries values(607, "2013-03-12"); +insert into diaries values(608, "2013-03-13"); +insert into diaries values(609, "2013-03-14"); +insert into diaries values(610, "2013-03-15"); +insert into diaries values(611, "2013-03-16"); +insert into diaries values(612, "2013-03-17"); +insert into diaries values(613, "2013-03-18"); +insert into diaries values(614, "2013-03-19"); +insert into diaries values(615, "2013-03-20"); +insert into diaries values(616, "2013-03-21"); +insert into diaries values(617, "2013-03-22"); +insert into diaries values(618, "2013-03-23"); +insert into diaries values(619, "2013-03-24"); +insert into diaries values(620, "2013-03-25"); +insert into diaries values(621, "2013-03-26"); +insert into diaries values(622, "2013-03-27"); +insert into diaries values(623, "2013-03-28"); +insert into diaries values(624, "2013-03-29"); +insert into diaries values(625, "2013-03-30"); +insert into diaries values(626, "2013-03-31"); +insert into diaries values(627, "2013-04-01"); +insert into diaries values(628, "2013-04-02"); +insert into diaries values(629, "2013-04-03"); +insert into diaries values(630, "2013-04-04"); +insert into diaries values(631, "2013-04-05"); +insert into diaries values(632, "2013-04-06"); +insert into diaries values(633, "2013-04-07"); +insert into diaries values(634, "2013-04-08"); +insert into diaries values(635, "2013-04-09"); +insert into diaries values(636, "2013-04-10"); +insert into diaries values(637, "2013-04-11"); +insert into diaries values(638, "2013-04-12"); +insert into diaries values(639, "2013-04-13"); +insert into diaries values(640, "2013-04-14"); +insert into diaries values(641, "2013-04-15"); +insert into diaries values(642, "2013-04-16"); +insert into diaries values(643, "2013-04-17"); +insert into diaries values(644, "2013-04-18"); +insert into diaries values(645, "2013-04-19"); +insert into diaries values(646, "2013-04-20"); +insert into diaries values(647, "2013-04-21"); +insert into diaries values(648, "2013-04-22"); +insert into diaries values(649, "2013-04-23"); +insert into diaries values(650, "2013-04-24"); +insert into diaries values(651, "2013-04-25"); +insert into diaries values(652, "2013-04-26"); +insert into diaries values(653, "2013-04-27"); +insert into diaries values(654, "2013-04-28"); +insert into diaries values(655, "2013-04-29"); +insert into diaries values(656, "2013-04-30"); +insert into diaries values(657, "2013-05-01"); +insert into diaries values(658, "2013-05-02"); +insert into diaries values(659, "2013-05-03"); +insert into diaries values(660, "2013-05-04"); +insert into diaries values(661, "2013-05-05"); +insert into diaries values(662, "2013-05-06"); +insert into diaries values(663, "2013-05-07"); +insert into diaries values(664, "2013-05-08"); +insert into diaries values(665, "2013-05-09"); +insert into diaries values(666, "2013-05-10"); +insert into diaries values(667, "2013-05-11"); +insert into diaries values(668, "2013-05-12"); +insert into diaries values(669, "2013-05-13"); +insert into diaries values(670, "2013-05-14"); +insert into diaries values(671, "2013-05-15"); +insert into diaries values(672, "2013-05-16"); +insert into diaries values(673, "2013-05-17"); +insert into diaries values(674, "2013-05-18"); +insert into diaries values(675, "2013-05-19"); +insert into diaries values(676, "2013-05-20"); +insert into diaries values(677, "2013-05-21"); +insert into diaries values(678, "2013-05-22"); +insert into diaries values(679, "2013-05-23"); +insert into diaries values(680, "2013-05-24"); +insert into diaries values(681, "2013-05-25"); +insert into diaries values(682, "2013-05-26"); +insert into diaries values(683, "2013-05-27"); +insert into diaries values(684, "2013-05-28"); +insert into diaries values(685, "2013-05-29"); +insert into diaries values(686, "2013-05-30"); +insert into diaries values(687, "2013-05-31"); +insert into diaries values(688, "2013-06-01"); +insert into diaries values(689, "2013-06-02"); +insert into diaries values(690, "2013-06-03"); +insert into diaries values(691, "2013-06-04"); +insert into diaries values(692, "2013-06-05"); +insert into diaries values(693, "2013-06-06"); +insert into diaries values(694, "2013-06-07"); +insert into diaries values(695, "2013-06-08"); +insert into diaries values(696, "2013-06-09"); +insert into diaries values(697, "2013-06-10"); +insert into diaries values(698, "2013-06-11"); +insert into diaries values(699, "2013-06-12"); +insert into diaries values(700, "2013-06-13"); +insert into diaries values(701, "2013-06-14"); +insert into diaries values(702, "2013-06-15"); +insert into diaries values(703, "2013-06-16"); +insert into diaries values(704, "2013-06-17"); +insert into diaries values(705, "2013-06-18"); +insert into diaries values(706, "2013-06-19"); +insert into diaries values(707, "2013-06-20"); +insert into diaries values(708, "2013-06-21"); +insert into diaries values(709, "2013-06-22"); +insert into diaries values(710, "2013-06-23"); +insert into diaries values(711, "2013-06-24"); +insert into diaries values(712, "2013-06-25"); +insert into diaries values(713, "2013-06-26"); +insert into diaries values(714, "2013-06-27"); +insert into diaries values(715, "2013-06-28"); +insert into diaries values(716, "2013-06-29"); +insert into diaries values(717, "2013-06-30"); +insert into diaries values(718, "2013-07-01"); +insert into diaries values(719, "2013-07-02"); +insert into diaries values(720, "2013-07-03"); +insert into diaries values(721, "2013-07-04"); +insert into diaries values(722, "2013-07-05"); +insert into diaries values(723, "2013-07-06"); +insert into diaries values(724, "2013-07-07"); +insert into diaries values(725, "2013-07-08"); +insert into diaries values(726, "2013-07-09"); +insert into diaries values(727, "2013-07-10"); +insert into diaries values(728, "2013-07-11"); +insert into diaries values(729, "2013-07-12"); +insert into diaries values(730, "2013-07-13"); +insert into diaries values(731, "2013-07-14"); +insert into diaries values(732, "2013-07-15"); +insert into diaries values(733, "2013-07-16"); +insert into diaries values(734, "2013-07-17"); +insert into diaries values(735, "2013-07-18"); +insert into diaries values(736, "2013-07-19"); +insert into diaries values(737, "2013-07-20"); +insert into diaries values(738, "2013-07-21"); +insert into diaries values(739, "2013-07-22"); +insert into diaries values(740, "2013-07-23"); +insert into diaries values(741, "2013-07-24"); +insert into diaries values(742, "2013-07-25"); +insert into diaries values(743, "2013-07-26"); +insert into diaries values(744, "2013-07-27"); +insert into diaries values(745, "2013-07-28"); +insert into diaries values(746, "2013-07-29"); +insert into diaries values(747, "2013-07-30"); +insert into diaries values(748, "2013-07-31"); +insert into diaries values(749, "2013-08-01"); +insert into diaries values(750, "2013-08-02"); +insert into diaries values(751, "2013-08-03"); +insert into diaries values(752, "2013-08-04"); +insert into diaries values(753, "2013-08-05"); +insert into diaries values(754, "2013-08-06"); +insert into diaries values(755, "2013-08-07"); +insert into diaries values(756, "2013-08-08"); +insert into diaries values(757, "2013-08-09"); +insert into diaries values(758, "2013-08-10"); +insert into diaries values(759, "2013-08-11"); +insert into diaries values(760, "2013-08-12"); +insert into diaries values(761, "2013-08-13"); +insert into diaries values(762, "2013-08-14"); +insert into diaries values(763, "2013-08-15"); +insert into diaries values(764, "2013-08-16"); +insert into diaries values(765, "2013-08-17"); +insert into diaries values(766, "2013-08-18"); +insert into diaries values(767, "2013-08-19"); +insert into diaries values(768, "2013-08-20"); +insert into diaries values(769, "2013-08-21"); +insert into diaries values(770, "2013-08-22"); +insert into diaries values(771, "2013-08-23"); +insert into diaries values(772, "2013-08-24"); +insert into diaries values(773, "2013-08-25"); +insert into diaries values(774, "2013-08-26"); +insert into diaries values(775, "2013-08-27"); +insert into diaries values(776, "2013-08-28"); +insert into diaries values(777, "2013-08-29"); +insert into diaries values(778, "2013-08-30"); +insert into diaries values(779, "2013-08-31"); +insert into diaries values(780, "2013-09-01"); +insert into diaries values(781, "2013-09-02"); +insert into diaries values(782, "2013-09-03"); +insert into diaries values(783, "2013-09-04"); +insert into diaries values(784, "2013-09-05"); +insert into diaries values(785, "2013-09-06"); +insert into diaries values(786, "2013-09-07"); +insert into diaries values(787, "2013-09-08"); +insert into diaries values(788, "2013-09-09"); +insert into diaries values(789, "2013-09-10"); +insert into diaries values(790, "2013-09-11"); +insert into diaries values(791, "2013-09-12"); +insert into diaries values(792, "2013-09-13"); +insert into diaries values(793, "2013-09-14"); +insert into diaries values(794, "2013-09-15"); +insert into diaries values(795, "2013-09-16"); +insert into diaries values(796, "2013-09-17"); +insert into diaries values(797, "2013-09-18"); +insert into diaries values(798, "2013-09-19"); +insert into diaries values(799, "2013-09-20"); +insert into diaries values(800, "2013-09-21"); +insert into diaries values(801, "2013-09-22"); +insert into diaries values(802, "2013-09-23"); +insert into diaries values(803, "2013-09-24"); +insert into diaries values(804, "2013-09-25"); +insert into diaries values(805, "2013-09-26"); +insert into diaries values(806, "2013-09-27"); +insert into diaries values(807, "2013-09-28"); +insert into diaries values(808, "2013-09-29"); +insert into diaries values(809, "2013-09-30"); +insert into diaries values(810, "2013-10-01"); +insert into diaries values(811, "2013-10-02"); +insert into diaries values(812, "2013-10-03"); +insert into diaries values(813, "2013-10-04"); +insert into diaries values(814, "2013-10-05"); +insert into diaries values(815, "2013-10-06"); +insert into diaries values(816, "2013-10-07"); +insert into diaries values(817, "2013-10-08"); +insert into diaries values(818, "2013-10-09"); +insert into diaries values(819, "2013-10-10"); +insert into diaries values(820, "2013-10-11"); +insert into diaries values(821, "2013-10-12"); +insert into diaries values(822, "2013-10-13"); +insert into diaries values(823, "2013-10-14"); +insert into diaries values(824, "2013-10-15"); +insert into diaries values(825, "2013-10-16"); +insert into diaries values(826, "2013-10-17"); +insert into diaries values(827, "2013-10-18"); +insert into diaries values(828, "2013-10-19"); +insert into diaries values(829, "2013-10-20"); +insert into diaries values(830, "2013-10-21"); +insert into diaries values(831, "2013-10-22"); +insert into diaries values(832, "2013-10-23"); +insert into diaries values(833, "2013-10-24"); +insert into diaries values(834, "2013-10-25"); +insert into diaries values(835, "2013-10-26"); +insert into diaries values(836, "2013-10-27"); +insert into diaries values(837, "2013-10-28"); +insert into diaries values(838, "2013-10-29"); +insert into diaries values(839, "2013-10-30"); +insert into diaries values(840, "2013-10-31"); +insert into diaries values(841, "2013-11-01"); +insert into diaries values(842, "2013-11-02"); +insert into diaries values(843, "2013-11-03"); +insert into diaries values(844, "2013-11-04"); +insert into diaries values(845, "2013-11-05"); +insert into diaries values(846, "2013-11-06"); +insert into diaries values(847, "2013-11-07"); +insert into diaries values(848, "2013-11-08"); +insert into diaries values(849, "2013-11-09"); +insert into diaries values(850, "2013-11-10"); +insert into diaries values(851, "2013-11-11"); +insert into diaries values(852, "2013-11-12"); +insert into diaries values(853, "2013-11-13"); +insert into diaries values(854, "2013-11-14"); +insert into diaries values(855, "2013-11-15"); +insert into diaries values(856, "2013-11-16"); +insert into diaries values(857, "2013-11-17"); +insert into diaries values(858, "2013-11-18"); +insert into diaries values(859, "2013-11-19"); +insert into diaries values(860, "2013-11-20"); +insert into diaries values(861, "2013-11-21"); +insert into diaries values(862, "2013-11-22"); +insert into diaries values(863, "2013-11-23"); +insert into diaries values(864, "2013-11-24"); +insert into diaries values(865, "2013-11-25"); +insert into diaries values(866, "2013-11-26"); +insert into diaries values(867, "2013-11-27"); +insert into diaries values(868, "2013-11-28"); +insert into diaries values(869, "2013-11-29"); +insert into diaries values(870, "2013-11-30"); +insert into diaries values(871, "2013-12-01"); +insert into diaries values(872, "2013-12-02"); +insert into diaries values(873, "2013-12-03"); +insert into diaries values(874, "2013-12-04"); +insert into diaries values(875, "2013-12-05"); +insert into diaries values(876, "2013-12-06"); +insert into diaries values(877, "2013-12-07"); +insert into diaries values(878, "2013-12-08"); +insert into diaries values(879, "2013-12-09"); +insert into diaries values(880, "2013-12-10"); +insert into diaries values(881, "2013-12-11"); +insert into diaries values(882, "2013-12-12"); +insert into diaries values(883, "2013-12-13"); +insert into diaries values(884, "2013-12-14"); +insert into diaries values(885, "2013-12-15"); +insert into diaries values(886, "2013-12-16"); +insert into diaries values(887, "2013-12-17"); +insert into diaries values(888, "2013-12-18"); +insert into diaries values(889, "2013-12-19"); +insert into diaries values(890, "2013-12-20"); +insert into diaries values(891, "2013-12-21"); +insert into diaries values(892, "2013-12-22"); +insert into diaries values(893, "2013-12-23"); +insert into diaries values(894, "2013-12-24"); +insert into diaries values(895, "2013-12-25"); +insert into diaries values(896, "2013-12-26"); +insert into diaries values(897, "2013-12-27"); +insert into diaries values(898, "2013-12-28"); +insert into diaries values(899, "2013-12-29"); +insert into diaries values(900, "2013-12-30"); +insert into diaries values(901, "2013-12-31"); +insert into diaries values(902, "2014-01-01"); +insert into diaries values(903, "2014-01-02"); +insert into diaries values(904, "2014-01-03"); +insert into diaries values(905, "2014-01-04"); +insert into diaries values(906, "2014-01-05"); +insert into diaries values(907, "2014-01-06"); +insert into diaries values(908, "2014-01-07"); +insert into diaries values(909, "2014-01-08"); +insert into diaries values(910, "2014-01-09"); +insert into diaries values(911, "2014-01-10"); +insert into diaries values(912, "2014-01-11"); +insert into diaries values(913, "2014-01-12"); +insert into diaries values(914, "2014-01-13"); +insert into diaries values(915, "2014-01-14"); +insert into diaries values(916, "2014-01-15"); +insert into diaries values(917, "2014-01-16"); +insert into diaries values(918, "2014-01-17"); +insert into diaries values(919, "2014-01-18"); +insert into diaries values(920, "2014-01-19"); +insert into diaries values(921, "2014-01-20"); +insert into diaries values(922, "2014-01-21"); +insert into diaries values(923, "2014-01-22"); +insert into diaries values(924, "2014-01-23"); +insert into diaries values(925, "2014-01-24"); +insert into diaries values(926, "2014-01-25"); +insert into diaries values(927, "2014-01-26"); +insert into diaries values(928, "2014-01-27"); +insert into diaries values(929, "2014-01-28"); +insert into diaries values(930, "2014-01-29"); +insert into diaries values(931, "2014-01-30"); +insert into diaries values(932, "2014-01-31"); +insert into diaries values(933, "2014-02-01"); +insert into diaries values(934, "2014-02-02"); +insert into diaries values(935, "2014-02-03"); +insert into diaries values(936, "2014-02-04"); +insert into diaries values(937, "2014-02-05"); +insert into diaries values(938, "2014-02-06"); +insert into diaries values(939, "2014-02-07"); +insert into diaries values(940, "2014-02-08"); +insert into diaries values(941, "2014-02-09"); +insert into diaries values(942, "2014-02-10"); +insert into diaries values(943, "2014-02-11"); +insert into diaries values(944, "2014-02-12"); +insert into diaries values(945, "2014-02-13"); +insert into diaries values(946, "2014-02-14"); +insert into diaries values(947, "2014-02-15"); +insert into diaries values(948, "2014-02-16"); +insert into diaries values(949, "2014-02-17"); +insert into diaries values(950, "2014-02-18"); +insert into diaries values(951, "2014-02-19"); +insert into diaries values(952, "2014-02-20"); +insert into diaries values(953, "2014-02-21"); +insert into diaries values(954, "2014-02-22"); +insert into diaries values(955, "2014-02-23"); +insert into diaries values(956, "2014-02-24"); +insert into diaries values(957, "2014-02-25"); +insert into diaries values(958, "2014-02-26"); +insert into diaries values(959, "2014-02-27"); +insert into diaries values(960, "2014-02-28"); +insert into diaries values(961, "2014-03-01"); +insert into diaries values(962, "2014-03-02"); +insert into diaries values(963, "2014-03-03"); +insert into diaries values(964, "2014-03-04"); +insert into diaries values(965, "2014-03-05"); +insert into diaries values(966, "2014-03-06"); +insert into diaries values(967, "2014-03-07"); +insert into diaries values(968, "2014-03-08"); +insert into diaries values(969, "2014-03-09"); +insert into diaries values(970, "2014-03-10"); +insert into diaries values(971, "2014-03-11"); +insert into diaries values(972, "2014-03-12"); +insert into diaries values(973, "2014-03-13"); +insert into diaries values(974, "2014-03-14"); +insert into diaries values(975, "2014-03-15"); +insert into diaries values(976, "2014-03-16"); +insert into diaries values(977, "2014-03-17"); +insert into diaries values(978, "2014-03-18"); +insert into diaries values(979, "2014-03-19"); +insert into diaries values(980, "2014-03-20"); +insert into diaries values(981, "2014-03-21"); +insert into diaries values(982, "2014-03-22"); +insert into diaries values(983, "2014-03-23"); +insert into diaries values(984, "2014-03-24"); +insert into diaries values(985, "2014-03-25"); +insert into diaries values(986, "2014-03-26"); +insert into diaries values(987, "2014-03-27"); +insert into diaries values(988, "2014-03-28"); +insert into diaries values(989, "2014-03-29"); +insert into diaries values(990, "2014-03-30"); +insert into diaries values(991, "2014-03-31"); +insert into diaries values(992, "2014-04-01"); +insert into diaries values(993, "2014-04-02"); +insert into diaries values(994, "2014-04-03"); +insert into diaries values(995, "2014-04-04"); +insert into diaries values(996, "2014-04-05"); +insert into diaries values(997, "2014-04-06"); +insert into diaries values(998, "2014-04-07"); +insert into diaries values(999, "2014-04-08"); +insert into diaries values(1000, "2014-04-09"); +insert into diaries values(1001, "2014-04-10"); +insert into diaries values(1002, "2014-04-11"); +insert into diaries values(1003, "2014-04-12"); +insert into diaries values(1004, "2014-04-13"); +insert into diaries values(1005, "2014-04-14"); +insert into diaries values(1006, "2014-04-15"); +insert into diaries values(1007, "2014-04-16"); +insert into diaries values(1008, "2014-04-17"); +insert into diaries values(1009, "2014-04-18"); +insert into diaries values(1010, "2014-04-19"); +insert into diaries values(1011, "2014-04-20"); +insert into diaries values(1012, "2014-04-21"); +insert into diaries values(1013, "2014-04-22"); +insert into diaries values(1014, "2014-04-23"); +insert into diaries values(1015, "2014-04-24"); +insert into diaries values(1016, "2014-04-25"); +insert into diaries values(1017, "2014-04-26"); +insert into diaries values(1018, "2014-04-27"); +insert into diaries values(1019, "2014-04-28"); +insert into diaries values(1020, "2014-04-29"); +insert into diaries values(1021, "2014-04-30"); +insert into diaries values(1022, "2014-05-01"); +insert into diaries values(1023, "2014-05-02"); +insert into diaries values(1024, "2014-05-03"); +insert into diaries values(1025, "2014-05-04"); +insert into diaries values(1026, "2014-05-05"); +insert into diaries values(1027, "2014-05-06"); +insert into diaries values(1028, "2014-05-07"); +insert into diaries values(1029, "2014-05-08"); +insert into diaries values(1030, "2014-05-09"); +insert into diaries values(1031, "2014-05-10"); +insert into diaries values(1032, "2014-05-11"); +insert into diaries values(1033, "2014-05-12"); +insert into diaries values(1034, "2014-05-13"); +insert into diaries values(1035, "2014-05-14"); +insert into diaries values(1036, "2014-05-15"); +insert into diaries values(1037, "2014-05-16"); +insert into diaries values(1038, "2014-05-17"); +insert into diaries values(1039, "2014-05-18"); +insert into diaries values(1040, "2014-05-19"); +insert into diaries values(1041, "2014-05-20"); +insert into diaries values(1042, "2014-05-21"); +insert into diaries values(1043, "2014-05-22"); +insert into diaries values(1044, "2014-05-23"); +insert into diaries values(1045, "2014-05-24"); +insert into diaries values(1046, "2014-05-25"); +insert into diaries values(1047, "2014-05-26"); +insert into diaries values(1048, "2014-05-27"); +insert into diaries values(1049, "2014-05-28"); +insert into diaries values(1050, "2014-05-29"); +insert into diaries values(1051, "2014-05-30"); +insert into diaries values(1052, "2014-05-31"); +insert into diaries values(1053, "2014-06-01"); +insert into diaries values(1054, "2014-06-02"); +insert into diaries values(1055, "2014-06-03"); +insert into diaries values(1056, "2014-06-04"); +insert into diaries values(1057, "2014-06-05"); +insert into diaries values(1058, "2014-06-06"); +insert into diaries values(1059, "2014-06-07"); +insert into diaries values(1060, "2014-06-08"); +insert into diaries values(1061, "2014-06-09"); +insert into diaries values(1062, "2014-06-10"); +insert into diaries values(1063, "2014-06-11"); +insert into diaries values(1064, "2014-06-12"); +insert into diaries values(1065, "2014-06-13"); +insert into diaries values(1066, "2014-06-14"); +insert into diaries values(1067, "2014-06-15"); +insert into diaries values(1068, "2014-06-16"); +insert into diaries values(1069, "2014-06-17"); +insert into diaries values(1070, "2014-06-18"); +insert into diaries values(1071, "2014-06-19"); +insert into diaries values(1072, "2014-06-20"); +insert into diaries values(1073, "2014-06-21"); +insert into diaries values(1074, "2014-06-22"); +insert into diaries values(1075, "2014-06-23"); +insert into diaries values(1076, "2014-06-24"); +insert into diaries values(1077, "2014-06-25"); +insert into diaries values(1078, "2014-06-26"); +insert into diaries values(1079, "2014-06-27"); +insert into diaries values(1080, "2014-06-28"); +insert into diaries values(1081, "2014-06-29"); +insert into diaries values(1082, "2014-06-30"); +insert into diaries values(1083, "2014-07-01"); +insert into diaries values(1084, "2014-07-02"); +insert into diaries values(1085, "2014-07-03"); +insert into diaries values(1086, "2014-07-04"); +insert into diaries values(1087, "2014-07-05"); +insert into diaries values(1088, "2014-07-06"); +insert into diaries values(1089, "2014-07-07"); +insert into diaries values(1090, "2014-07-08"); +insert into diaries values(1091, "2014-07-09"); +insert into diaries values(1092, "2014-07-10"); +insert into diaries values(1093, "2014-07-11"); +insert into diaries values(1094, "2014-07-12"); +insert into diaries values(1095, "2014-07-13"); +insert into diaries values(1096, "2014-07-14"); +insert into diaries values(1097, "2014-07-15"); +insert into diaries values(1098, "2014-07-16"); +insert into diaries values(1099, "2014-07-17"); +insert into diaries values(1100, "2014-07-18"); +insert into diaries values(1101, "2014-07-19"); +insert into diaries values(1102, "2014-07-20"); +insert into diaries values(1103, "2014-07-21"); +insert into diaries values(1104, "2014-07-22"); +insert into diaries values(1105, "2014-07-23"); +insert into diaries values(1106, "2014-07-24"); +insert into diaries values(1107, "2014-07-25"); +insert into diaries values(1108, "2014-07-26"); +insert into diaries values(1109, "2014-07-27"); +insert into diaries values(1110, "2014-07-28"); +insert into diaries values(1111, "2014-07-29"); +insert into diaries values(1112, "2014-07-30"); +insert into diaries values(1113, "2014-07-31"); +insert into diaries values(1114, "2014-08-01"); +insert into diaries values(1115, "2014-08-02"); +insert into diaries values(1116, "2014-08-03"); +insert into diaries values(1117, "2014-08-04"); +insert into diaries values(1118, "2014-08-05"); +insert into diaries values(1119, "2014-08-06"); +insert into diaries values(1120, "2014-08-07"); +insert into diaries values(1121, "2014-08-08"); +insert into diaries values(1122, "2014-08-09"); +insert into diaries values(1123, "2014-08-10"); +insert into diaries values(1124, "2014-08-11"); +insert into diaries values(1125, "2014-08-12"); +insert into diaries values(1126, "2014-08-13"); +insert into diaries values(1127, "2014-08-14"); +insert into diaries values(1128, "2014-08-15"); +insert into diaries values(1129, "2014-08-16"); +insert into diaries values(1130, "2014-08-17"); +insert into diaries values(1131, "2014-08-18"); +insert into diaries values(1132, "2014-08-19"); +insert into diaries values(1133, "2014-08-20"); +insert into diaries values(1134, "2014-08-21"); +insert into diaries values(1135, "2014-08-22"); +insert into diaries values(1136, "2014-08-23"); +insert into diaries values(1137, "2014-08-24"); +insert into diaries values(1138, "2014-08-25"); +insert into diaries values(1139, "2014-08-26"); +insert into diaries values(1140, "2014-08-27"); +insert into diaries values(1141, "2014-08-28"); +insert into diaries values(1142, "2014-08-29"); +insert into diaries values(1143, "2014-08-30"); +insert into diaries values(1144, "2014-08-31"); +insert into diaries values(1145, "2014-09-01"); +insert into diaries values(1146, "2014-09-02"); +insert into diaries values(1147, "2014-09-03"); +insert into diaries values(1148, "2014-09-04"); +insert into diaries values(1149, "2014-09-05"); +insert into diaries values(1150, "2014-09-06"); +insert into diaries values(1151, "2014-09-07"); +insert into diaries values(1152, "2014-09-08"); +insert into diaries values(1153, "2014-09-09"); +insert into diaries values(1154, "2014-09-10"); +insert into diaries values(1155, "2014-09-11"); +insert into diaries values(1156, "2014-09-12"); +insert into diaries values(1157, "2014-09-13"); +insert into diaries values(1158, "2014-09-14"); +insert into diaries values(1159, "2014-09-15"); +insert into diaries values(1160, "2014-09-16"); +insert into diaries values(1161, "2014-09-17"); +insert into diaries values(1162, "2014-09-18"); +insert into diaries values(1163, "2014-09-19"); +insert into diaries values(1164, "2014-09-20"); +insert into diaries values(1165, "2014-09-21"); +insert into diaries values(1166, "2014-09-22"); +insert into diaries values(1167, "2014-09-23"); +insert into diaries values(1168, "2014-09-24"); +insert into diaries values(1169, "2014-09-25"); +insert into diaries values(1170, "2014-09-26"); +insert into diaries values(1171, "2014-09-27"); +insert into diaries values(1172, "2014-09-28"); +insert into diaries values(1173, "2014-09-29"); +insert into diaries values(1174, "2014-09-30"); +insert into diaries values(1175, "2014-10-01"); +insert into diaries values(1176, "2014-10-02"); +insert into diaries values(1177, "2014-10-03"); +insert into diaries values(1178, "2014-10-04"); +insert into diaries values(1179, "2014-10-05"); +insert into diaries values(1180, "2014-10-06"); +insert into diaries values(1181, "2014-10-07"); +insert into diaries values(1182, "2014-10-08"); +insert into diaries values(1183, "2014-10-09"); +insert into diaries values(1184, "2014-10-10"); +insert into diaries values(1185, "2014-10-11"); +insert into diaries values(1186, "2014-10-12"); +insert into diaries values(1187, "2014-10-13"); +insert into diaries values(1188, "2014-10-14"); +insert into diaries values(1189, "2014-10-15"); +insert into diaries values(1190, "2014-10-16"); +insert into diaries values(1191, "2014-10-17"); +insert into diaries values(1192, "2014-10-18"); +insert into diaries values(1193, "2014-10-19"); +insert into diaries values(1194, "2014-10-20"); +insert into diaries values(1195, "2014-10-21"); +insert into diaries values(1196, "2014-10-22"); +insert into diaries values(1197, "2014-10-23"); +insert into diaries values(1198, "2014-10-24"); +insert into diaries values(1199, "2014-10-25"); +insert into diaries values(1200, "2014-10-26"); +insert into diaries values(1201, "2014-10-27"); +insert into diaries values(1202, "2014-10-28"); +insert into diaries values(1203, "2014-10-29"); +insert into diaries values(1204, "2014-10-30"); +insert into diaries values(1205, "2014-10-31"); +insert into diaries values(1206, "2014-11-01"); +insert into diaries values(1207, "2014-11-02"); +insert into diaries values(1208, "2014-11-03"); +insert into diaries values(1209, "2014-11-04"); +insert into diaries values(1210, "2014-11-05"); +insert into diaries values(1211, "2014-11-06"); +insert into diaries values(1212, "2014-11-07"); +insert into diaries values(1213, "2014-11-08"); +insert into diaries values(1214, "2014-11-09"); +insert into diaries values(1215, "2014-11-10"); +insert into diaries values(1216, "2014-11-11"); +insert into diaries values(1217, "2014-11-12"); +insert into diaries values(1218, "2014-11-13"); +insert into diaries values(1219, "2014-11-14"); +insert into diaries values(1220, "2014-11-15"); +insert into diaries values(1221, "2014-11-16"); +insert into diaries values(1222, "2014-11-17"); +insert into diaries values(1223, "2014-11-18"); +insert into diaries values(1224, "2014-11-19"); +insert into diaries values(1225, "2014-11-20"); +insert into diaries values(1226, "2014-11-21"); +insert into diaries values(1227, "2014-11-22"); +insert into diaries values(1228, "2014-11-23"); +insert into diaries values(1229, "2014-11-24"); +insert into diaries values(1230, "2014-11-25"); +insert into diaries values(1231, "2014-11-26"); +insert into diaries values(1232, "2014-11-27"); +insert into diaries values(1233, "2014-11-28"); +insert into diaries values(1234, "2014-11-29"); +insert into diaries values(1235, "2014-11-30"); +insert into diaries values(1236, "2014-12-01"); +insert into diaries values(1237, "2014-12-02"); +insert into diaries values(1238, "2014-12-03"); +insert into diaries values(1239, "2014-12-04"); +insert into diaries values(1240, "2014-12-05"); +insert into diaries values(1241, "2014-12-06"); +insert into diaries values(1242, "2014-12-07"); +insert into diaries values(1243, "2014-12-08"); +insert into diaries values(1244, "2014-12-09"); +insert into diaries values(1245, "2014-12-10"); +insert into diaries values(1246, "2014-12-11"); +insert into diaries values(1247, "2014-12-12"); +insert into diaries values(1248, "2014-12-13"); +insert into diaries values(1249, "2014-12-14"); +insert into diaries values(1250, "2014-12-15"); +insert into diaries values(1251, "2014-12-16"); +insert into diaries values(1252, "2014-12-17"); +insert into diaries values(1253, "2014-12-18"); +insert into diaries values(1254, "2014-12-19"); +insert into diaries values(1255, "2014-12-20"); +insert into diaries values(1256, "2014-12-21"); +insert into diaries values(1257, "2014-12-22"); +insert into diaries values(1258, "2014-12-23"); +insert into diaries values(1259, "2014-12-24"); +insert into diaries values(1260, "2014-12-25"); +insert into diaries values(1261, "2014-12-26"); +insert into diaries values(1262, "2014-12-27"); +insert into diaries values(1263, "2014-12-28"); +insert into diaries values(1264, "2014-12-29"); +insert into diaries values(1265, "2014-12-30"); +insert into diaries values(1266, "2014-12-31"); +insert into diaries values(1267, "2015-01-01"); +insert into diaries values(1268, "2015-01-02"); +insert into diaries values(1269, "2015-01-03"); +insert into diaries values(1270, "2015-01-04"); +insert into diaries values(1271, "2015-01-05"); +insert into diaries values(1272, "2015-01-06"); +insert into diaries values(1273, "2015-01-07"); +insert into diaries values(1274, "2015-01-08"); +insert into diaries values(1275, "2015-01-09"); +insert into diaries values(1276, "2015-01-10"); +insert into diaries values(1277, "2015-01-11"); +insert into diaries values(1278, "2015-01-12"); +insert into diaries values(1279, "2015-01-13"); +insert into diaries values(1280, "2015-01-14"); +insert into diaries values(1281, "2015-01-15"); +insert into diaries values(1282, "2015-01-16"); +insert into diaries values(1283, "2015-01-17"); +insert into diaries values(1284, "2015-01-18"); +insert into diaries values(1285, "2015-01-19"); +insert into diaries values(1286, "2015-01-20"); +insert into diaries values(1287, "2015-01-21"); +insert into diaries values(1288, "2015-01-22"); +insert into diaries values(1289, "2015-01-23"); +insert into diaries values(1290, "2015-01-24"); +insert into diaries values(1291, "2015-01-25"); +insert into diaries values(1292, "2015-01-26"); +insert into diaries values(1293, "2015-01-27"); +insert into diaries values(1294, "2015-01-28"); +insert into diaries values(1295, "2015-01-29"); +insert into diaries values(1296, "2015-01-30"); +insert into diaries values(1297, "2015-01-31"); +insert into diaries values(1298, "2015-02-01"); +insert into diaries values(1299, "2015-02-02"); +insert into diaries values(1300, "2015-02-03"); +insert into diaries values(1301, "2015-02-04"); +insert into diaries values(1302, "2015-02-05"); +insert into diaries values(1303, "2015-02-06"); +insert into diaries values(1304, "2015-02-07"); +insert into diaries values(1305, "2015-02-08"); +insert into diaries values(1306, "2015-02-09"); +insert into diaries values(1307, "2015-02-10"); +insert into diaries values(1308, "2015-02-11"); +insert into diaries values(1309, "2015-02-12"); +insert into diaries values(1310, "2015-02-13"); +insert into diaries values(1311, "2015-02-14"); +insert into diaries values(1312, "2015-02-15"); +insert into diaries values(1313, "2015-02-16"); +insert into diaries values(1314, "2015-02-17"); +insert into diaries values(1315, "2015-02-18"); +insert into diaries values(1316, "2015-02-19"); +insert into diaries values(1317, "2015-02-20"); +insert into diaries values(1318, "2015-02-21"); +insert into diaries values(1319, "2015-02-22"); +insert into diaries values(1320, "2015-02-23"); +insert into diaries values(1321, "2015-02-24"); +insert into diaries values(1322, "2015-02-25"); +insert into diaries values(1323, "2015-02-26"); +insert into diaries values(1324, "2015-02-27"); +insert into diaries values(1325, "2015-02-28"); +insert into diaries values(1326, "2015-03-01"); +insert into diaries values(1327, "2015-03-02"); +insert into diaries values(1328, "2015-03-03"); +insert into diaries values(1329, "2015-03-04"); +insert into diaries values(1330, "2015-03-05"); +insert into diaries values(1331, "2015-03-06"); +insert into diaries values(1332, "2015-03-07"); +insert into diaries values(1333, "2015-03-08"); +insert into diaries values(1334, "2015-03-09"); +insert into diaries values(1335, "2015-03-10"); +insert into diaries values(1336, "2015-03-11"); +insert into diaries values(1337, "2015-03-12"); +insert into diaries values(1338, "2015-03-13"); +insert into diaries values(1339, "2015-03-14"); +insert into diaries values(1340, "2015-03-15"); +insert into diaries values(1341, "2015-03-16"); +insert into diaries values(1342, "2015-03-17"); +insert into diaries values(1343, "2015-03-18"); +insert into diaries values(1344, "2015-03-19"); +insert into diaries values(1345, "2015-03-20"); +insert into diaries values(1346, "2015-03-21"); +insert into diaries values(1347, "2015-03-22"); +insert into diaries values(1348, "2015-03-23"); +insert into diaries values(1349, "2015-03-24"); +insert into diaries values(1350, "2015-03-25"); +insert into diaries values(1351, "2015-03-26"); +insert into diaries values(1352, "2015-03-27"); +insert into diaries values(1353, "2015-03-28"); +insert into diaries values(1354, "2015-03-29"); +insert into diaries values(1355, "2015-03-30"); +insert into diaries values(1356, "2015-03-31"); +insert into diaries values(1357, "2015-04-01"); +insert into diaries values(1358, "2015-04-02"); +insert into diaries values(1359, "2015-04-03"); +insert into diaries values(1360, "2015-04-04"); +insert into diaries values(1361, "2015-04-05"); +insert into diaries values(1362, "2015-04-06"); +insert into diaries values(1363, "2015-04-07"); +insert into diaries values(1364, "2015-04-08"); +insert into diaries values(1365, "2015-04-09"); +insert into diaries values(1366, "2015-04-10"); +insert into diaries values(1367, "2015-04-11"); +insert into diaries values(1368, "2015-04-12"); +insert into diaries values(1369, "2015-04-13"); +insert into diaries values(1370, "2015-04-14"); +insert into diaries values(1371, "2015-04-15"); +insert into diaries values(1372, "2015-04-16"); +insert into diaries values(1373, "2015-04-17"); +insert into diaries values(1374, "2015-04-18"); +insert into diaries values(1375, "2015-04-19"); +insert into diaries values(1376, "2015-04-20"); +insert into diaries values(1377, "2015-04-21"); +insert into diaries values(1378, "2015-04-22"); +insert into diaries values(1379, "2015-04-23"); +insert into diaries values(1380, "2015-04-24"); +insert into diaries values(1381, "2015-04-25"); +insert into diaries values(1382, "2015-04-26"); +insert into diaries values(1383, "2015-04-27"); +insert into diaries values(1384, "2015-04-28"); +insert into diaries values(1385, "2015-04-29"); +insert into diaries values(1386, "2015-04-30"); +insert into diaries values(1387, "2015-05-01"); +insert into diaries values(1388, "2015-05-02"); +insert into diaries values(1389, "2015-05-03"); +insert into diaries values(1390, "2015-05-04"); +insert into diaries values(1391, "2015-05-05"); +insert into diaries values(1392, "2015-05-06"); +insert into diaries values(1393, "2015-05-07"); +insert into diaries values(1394, "2015-05-08"); +insert into diaries values(1395, "2015-05-09"); +insert into diaries values(1396, "2015-05-10"); +insert into diaries values(1397, "2015-05-11"); +insert into diaries values(1398, "2015-05-12"); +insert into diaries values(1399, "2015-05-13"); +insert into diaries values(1400, "2015-05-14"); +insert into diaries values(1401, "2015-05-15"); +insert into diaries values(1402, "2015-05-16"); +insert into diaries values(1403, "2015-05-17"); +insert into diaries values(1404, "2015-05-18"); +insert into diaries values(1405, "2015-05-19"); +insert into diaries values(1406, "2015-05-20"); +insert into diaries values(1407, "2015-05-21"); +insert into diaries values(1408, "2015-05-22"); +insert into diaries values(1409, "2015-05-23"); +insert into diaries values(1410, "2015-05-24"); +insert into diaries values(1411, "2015-05-25"); +insert into diaries values(1412, "2015-05-26"); +insert into diaries values(1413, "2015-05-27"); +insert into diaries values(1414, "2015-05-28"); +insert into diaries values(1415, "2015-05-29"); +insert into diaries values(1416, "2015-05-30"); +insert into diaries values(1417, "2015-05-31"); +insert into diaries values(1418, "2015-06-01"); +insert into diaries values(1419, "2015-06-02"); +insert into diaries values(1420, "2015-06-03"); +insert into diaries values(1421, "2015-06-04"); +insert into diaries values(1422, "2015-06-05"); +insert into diaries values(1423, "2015-06-06"); +insert into diaries values(1424, "2015-06-07"); +insert into diaries values(1425, "2015-06-08"); +insert into diaries values(1426, "2015-06-09"); +insert into diaries values(1427, "2015-06-10"); +insert into diaries values(1428, "2015-06-11"); +insert into diaries values(1429, "2015-06-12"); +insert into diaries values(1430, "2015-06-13"); +insert into diaries values(1431, "2015-06-14"); +insert into diaries values(1432, "2015-06-15"); +insert into diaries values(1433, "2015-06-16"); +insert into diaries values(1434, "2015-06-17"); +insert into diaries values(1435, "2015-06-18"); +insert into diaries values(1436, "2015-06-19"); +insert into diaries values(1437, "2015-06-20"); +insert into diaries values(1438, "2015-06-21"); +insert into diaries values(1439, "2015-06-22"); +insert into diaries values(1440, "2015-06-23"); +insert into diaries values(1441, "2015-06-24"); +insert into diaries values(1442, "2015-06-25"); +insert into diaries values(1443, "2015-06-26"); +insert into diaries values(1444, "2015-06-27"); +insert into diaries values(1445, "2015-06-28"); +insert into diaries values(1446, "2015-06-29"); +insert into diaries values(1447, "2015-06-30"); +insert into diaries values(1448, "2015-07-01"); +insert into diaries values(1449, "2015-07-02"); +insert into diaries values(1450, "2015-07-03"); +insert into diaries values(1451, "2015-07-04"); +insert into diaries values(1452, "2015-07-05"); +insert into diaries values(1453, "2015-07-06"); +insert into diaries values(1454, "2015-07-07"); +insert into diaries values(1455, "2015-07-08"); +insert into diaries values(1456, "2015-07-09"); +insert into diaries values(1457, "2015-07-10"); +insert into diaries values(1458, "2015-07-11"); +insert into diaries values(1459, "2015-07-12"); +insert into diaries values(1460, "2015-07-13"); +insert into diaries values(1461, "2015-07-14"); +insert into diaries values(1462, "2015-07-15"); +insert into diaries values(1463, "2015-07-16"); +insert into diaries values(1464, "2015-07-17"); +insert into diaries values(1465, "2015-07-18"); +insert into diaries values(1466, "2015-07-19"); +insert into diaries values(1467, "2015-07-20"); +insert into diaries values(1468, "2015-07-21"); +insert into diaries values(1469, "2015-07-22"); +insert into diaries values(1470, "2015-07-23"); +insert into diaries values(1471, "2015-07-24"); +insert into diaries values(1472, "2015-07-25"); +insert into diaries values(1473, "2015-07-26"); +insert into diaries values(1474, "2015-07-27"); +insert into diaries values(1475, "2015-07-28"); +insert into diaries values(1476, "2015-07-29"); +insert into diaries values(1477, "2015-07-30"); +insert into diaries values(1478, "2015-07-31"); +insert into diaries values(1479, "2015-08-01"); +insert into diaries values(1480, "2015-08-02"); +insert into diaries values(1481, "2015-08-03"); +insert into diaries values(1482, "2015-08-04"); +insert into diaries values(1483, "2015-08-05"); +insert into diaries values(1484, "2015-08-06"); +insert into diaries values(1485, "2015-08-07"); +insert into diaries values(1486, "2015-08-08"); +insert into diaries values(1487, "2015-08-09"); +insert into diaries values(1488, "2015-08-10"); +insert into diaries values(1489, "2015-08-11"); +insert into diaries values(1490, "2015-08-12"); +insert into diaries values(1491, "2015-08-13"); +insert into diaries values(1492, "2015-08-14"); +insert into diaries values(1493, "2015-08-15"); +insert into diaries values(1494, "2015-08-16"); +insert into diaries values(1495, "2015-08-17"); +insert into diaries values(1496, "2015-08-18"); +insert into diaries values(1497, "2015-08-19"); +insert into diaries values(1498, "2015-08-20"); +insert into diaries values(1499, "2015-08-21"); +insert into diaries values(1500, "2015-08-22"); +insert into diaries values(1501, "2015-08-23"); +insert into diaries values(1502, "2015-08-24"); +insert into diaries values(1503, "2015-08-25"); +insert into diaries values(1504, "2015-08-26"); +insert into diaries values(1505, "2015-08-27"); +insert into diaries values(1506, "2015-08-28"); +insert into diaries values(1507, "2015-08-29"); +insert into diaries values(1508, "2015-08-30"); +insert into diaries values(1509, "2015-08-31"); +insert into diaries values(1510, "2015-09-01"); +insert into diaries values(1511, "2015-09-02"); +insert into diaries values(1512, "2015-09-03"); +insert into diaries values(1513, "2015-09-04"); +insert into diaries values(1514, "2015-09-05"); +insert into diaries values(1515, "2015-09-06"); +insert into diaries values(1516, "2015-09-07"); +insert into diaries values(1517, "2015-09-08"); +insert into diaries values(1518, "2015-09-09"); +insert into diaries values(1519, "2015-09-10"); +insert into diaries values(1520, "2015-09-11"); +insert into diaries values(1521, "2015-09-12"); +insert into diaries values(1522, "2015-09-13"); +insert into diaries values(1523, "2015-09-14"); +insert into diaries values(1524, "2015-09-15"); +insert into diaries values(1525, "2015-09-16"); +insert into diaries values(1526, "2015-09-17"); +insert into diaries values(1527, "2015-09-18"); +insert into diaries values(1528, "2015-09-19"); +insert into diaries values(1529, "2015-09-20"); +insert into diaries values(1530, "2015-09-21"); +insert into diaries values(1531, "2015-09-22"); +insert into diaries values(1532, "2015-09-23"); +insert into diaries values(1533, "2015-09-24"); +insert into diaries values(1534, "2015-09-25"); +insert into diaries values(1535, "2015-09-26"); +insert into diaries values(1536, "2015-09-27"); +insert into diaries values(1537, "2015-09-28"); +insert into diaries values(1538, "2015-09-29"); +insert into diaries values(1539, "2015-09-30"); +insert into diaries values(1540, "2015-10-01"); +insert into diaries values(1541, "2015-10-02"); +insert into diaries values(1542, "2015-10-03"); +insert into diaries values(1543, "2015-10-04"); +insert into diaries values(1544, "2015-10-05"); +insert into diaries values(1545, "2015-10-06"); +insert into diaries values(1546, "2015-10-07"); +insert into diaries values(1547, "2015-10-08"); +insert into diaries values(1548, "2015-10-09"); +insert into diaries values(1549, "2015-10-10"); +insert into diaries values(1550, "2015-10-11"); +insert into diaries values(1551, "2015-10-12"); +insert into diaries values(1552, "2015-10-13"); +insert into diaries values(1553, "2015-10-14"); +insert into diaries values(1554, "2015-10-15"); +insert into diaries values(1555, "2015-10-16"); +insert into diaries values(1556, "2015-10-17"); +insert into diaries values(1557, "2015-10-18"); +insert into diaries values(1558, "2015-10-19"); +insert into diaries values(1559, "2015-10-20"); +insert into diaries values(1560, "2015-10-21"); +insert into diaries values(1561, "2015-10-22"); +insert into diaries values(1562, "2015-10-23"); +insert into diaries values(1563, "2015-10-24"); +insert into diaries values(1564, "2015-10-25"); +insert into diaries values(1565, "2015-10-26"); +insert into diaries values(1566, "2015-10-27"); +insert into diaries values(1567, "2015-10-28"); +insert into diaries values(1568, "2015-10-29"); +insert into diaries values(1569, "2015-10-30"); +insert into diaries values(1570, "2015-10-31"); +insert into diaries values(1571, "2015-11-01"); +insert into diaries values(1572, "2015-11-02"); +insert into diaries values(1573, "2015-11-03"); +insert into diaries values(1574, "2015-11-04"); +insert into diaries values(1575, "2015-11-05"); +insert into diaries values(1576, "2015-11-06"); +insert into diaries values(1577, "2015-11-07"); +insert into diaries values(1578, "2015-11-08"); +insert into diaries values(1579, "2015-11-09"); +insert into diaries values(1580, "2015-11-10"); +insert into diaries values(1581, "2015-11-11"); +insert into diaries values(1582, "2015-11-12"); +insert into diaries values(1583, "2015-11-13"); +insert into diaries values(1584, "2015-11-14"); +insert into diaries values(1585, "2015-11-15"); +insert into diaries values(1586, "2015-11-16"); +insert into diaries values(1587, "2015-11-17"); +insert into diaries values(1588, "2015-11-18"); +insert into diaries values(1589, "2015-11-19"); +insert into diaries values(1590, "2015-11-20"); +insert into diaries values(1591, "2015-11-21"); +insert into diaries values(1592, "2015-11-22"); +insert into diaries values(1593, "2015-11-23"); +insert into diaries values(1594, "2015-11-24"); +insert into diaries values(1595, "2015-11-25"); +insert into diaries values(1596, "2015-11-26"); +insert into diaries values(1597, "2015-11-27"); +insert into diaries values(1598, "2015-11-28"); +insert into diaries values(1599, "2015-11-29"); +insert into diaries values(1600, "2015-11-30"); +insert into diaries values(1601, "2015-12-01"); +insert into diaries values(1602, "2015-12-02"); +insert into diaries values(1603, "2015-12-03"); +insert into diaries values(1604, "2015-12-04"); +insert into diaries values(1605, "2015-12-05"); +insert into diaries values(1606, "2015-12-06"); +insert into diaries values(1607, "2015-12-07"); +insert into diaries values(1608, "2015-12-08"); +insert into diaries values(1609, "2015-12-09"); +insert into diaries values(1610, "2015-12-10"); +insert into diaries values(1611, "2015-12-11"); +insert into diaries values(1612, "2015-12-12"); +insert into diaries values(1613, "2015-12-13"); +insert into diaries values(1614, "2015-12-14"); +insert into diaries values(1615, "2015-12-15"); +insert into diaries values(1616, "2015-12-16"); +insert into diaries values(1617, "2015-12-17"); +insert into diaries values(1618, "2015-12-18"); +insert into diaries values(1619, "2015-12-19"); +insert into diaries values(1620, "2015-12-20"); +insert into diaries values(1621, "2015-12-21"); +insert into diaries values(1622, "2015-12-22"); +insert into diaries values(1623, "2015-12-23"); +insert into diaries values(1624, "2015-12-24"); +insert into diaries values(1625, "2015-12-25"); +insert into diaries values(1626, "2015-12-26"); +insert into diaries values(1627, "2015-12-27"); +insert into diaries values(1628, "2015-12-28"); +insert into diaries values(1629, "2015-12-29"); +insert into diaries values(1630, "2015-12-30"); +insert into diaries values(1631, "2015-12-31"); +insert into diaries values(1632, "2016-01-01"); +insert into diaries values(1633, "2016-01-02"); +insert into diaries values(1634, "2016-01-03"); +insert into diaries values(1635, "2016-01-04"); +insert into diaries values(1636, "2016-01-05"); +insert into diaries values(1637, "2016-01-06"); +insert into diaries values(1638, "2016-01-07"); +insert into diaries values(1639, "2016-01-08"); +insert into diaries values(1640, "2016-01-09"); +insert into diaries values(1641, "2016-01-10"); +insert into diaries values(1642, "2016-01-11"); +insert into diaries values(1643, "2016-01-12"); +insert into diaries values(1644, "2016-01-13"); +insert into diaries values(1645, "2016-01-14"); +insert into diaries values(1646, "2016-01-15"); +insert into diaries values(1647, "2016-01-16"); +insert into diaries values(1648, "2016-01-17"); +insert into diaries values(1649, "2016-01-18"); +insert into diaries values(1650, "2016-01-19"); +insert into diaries values(1651, "2016-01-20"); +insert into diaries values(1652, "2016-01-21"); +insert into diaries values(1653, "2016-01-22"); +insert into diaries values(1654, "2016-01-23"); +insert into diaries values(1655, "2016-01-24"); +insert into diaries values(1656, "2016-01-25"); +insert into diaries values(1657, "2016-01-26"); +insert into diaries values(1658, "2016-01-27"); +insert into diaries values(1659, "2016-01-28"); +insert into diaries values(1660, "2016-01-29"); +insert into diaries values(1661, "2016-01-30"); +insert into diaries values(1662, "2016-01-31"); +insert into diaries values(1663, "2016-02-01"); +insert into diaries values(1664, "2016-02-02"); +insert into diaries values(1665, "2016-02-03"); +insert into diaries values(1666, "2016-02-04"); +insert into diaries values(1667, "2016-02-05"); +insert into diaries values(1668, "2016-02-06"); +insert into diaries values(1669, "2016-02-07"); +insert into diaries values(1670, "2016-02-08"); +insert into diaries values(1671, "2016-02-09"); +insert into diaries values(1672, "2016-02-10"); +insert into diaries values(1673, "2016-02-11"); +insert into diaries values(1674, "2016-02-12"); +insert into diaries values(1675, "2016-02-13"); +insert into diaries values(1676, "2016-02-14"); +insert into diaries values(1677, "2016-02-15"); +insert into diaries values(1678, "2016-02-16"); +insert into diaries values(1679, "2016-02-17"); +insert into diaries values(1680, "2016-02-18"); +insert into diaries values(1681, "2016-02-19"); +insert into diaries values(1682, "2016-02-20"); +insert into diaries values(1683, "2016-02-21"); +insert into diaries values(1684, "2016-02-22"); +insert into diaries values(1685, "2016-02-23"); +insert into diaries values(1686, "2016-02-24"); +insert into diaries values(1687, "2016-02-25"); +insert into diaries values(1688, "2016-02-26"); +insert into diaries values(1689, "2016-02-27"); +insert into diaries values(1690, "2016-02-28"); +insert into diaries values(1691, "2016-02-29"); +insert into diaries values(1692, "2016-03-01"); +insert into diaries values(1693, "2016-03-02"); +insert into diaries values(1694, "2016-03-03"); +insert into diaries values(1695, "2016-03-04"); +insert into diaries values(1696, "2016-03-05"); +insert into diaries values(1697, "2016-03-06"); +insert into diaries values(1698, "2016-03-07"); +insert into diaries values(1699, "2016-03-08"); +insert into diaries values(1700, "2016-03-09"); +insert into diaries values(1701, "2016-03-10"); +insert into diaries values(1702, "2016-03-11"); +insert into diaries values(1703, "2016-03-12"); +insert into diaries values(1704, "2016-03-13"); +insert into diaries values(1705, "2016-03-14"); +insert into diaries values(1706, "2016-03-15"); +insert into diaries values(1707, "2016-03-16"); +insert into diaries values(1708, "2016-03-17"); +insert into diaries values(1709, "2016-03-18"); +insert into diaries values(1710, "2016-03-19"); +insert into diaries values(1711, "2016-03-20"); +insert into diaries values(1712, "2016-03-21"); +insert into diaries values(1713, "2016-03-22"); +insert into diaries values(1714, "2016-03-23"); +insert into diaries values(1715, "2016-03-24"); +insert into diaries values(1716, "2016-03-25"); +insert into diaries values(1717, "2016-03-26"); +insert into diaries values(1718, "2016-03-27"); +insert into diaries values(1719, "2016-03-28"); +insert into diaries values(1720, "2016-03-29"); +insert into diaries values(1721, "2016-03-30"); +insert into diaries values(1722, "2016-03-31"); +insert into diaries values(1723, "2016-04-01"); +insert into diaries values(1724, "2016-04-02"); +insert into diaries values(1725, "2016-04-03"); +insert into diaries values(1726, "2016-04-04"); +insert into diaries values(1727, "2016-04-05"); +insert into diaries values(1728, "2016-04-06"); +insert into diaries values(1729, "2016-04-07"); +insert into diaries values(1730, "2016-04-08"); +insert into diaries values(1731, "2016-04-09"); +insert into diaries values(1732, "2016-04-10"); +insert into diaries values(1733, "2016-04-11"); +insert into diaries values(1734, "2016-04-12"); +insert into diaries values(1735, "2016-04-13"); +insert into diaries values(1736, "2016-04-14"); +insert into diaries values(1737, "2016-04-15"); +insert into diaries values(1738, "2016-04-16"); +insert into diaries values(1739, "2016-04-17"); +insert into diaries values(1740, "2016-04-18"); +insert into diaries values(1741, "2016-04-19"); +insert into diaries values(1742, "2016-04-20"); +insert into diaries values(1743, "2016-04-21"); +insert into diaries values(1744, "2016-04-22"); +insert into diaries values(1745, "2016-04-23"); +insert into diaries values(1746, "2016-04-24"); +insert into diaries values(1747, "2016-04-25"); +insert into diaries values(1748, "2016-04-26"); +insert into diaries values(1749, "2016-04-27"); +insert into diaries values(1750, "2016-04-28"); +insert into diaries values(1751, "2016-04-29"); +insert into diaries values(1752, "2016-04-30"); +insert into diaries values(1753, "2016-05-01"); +insert into diaries values(1754, "2016-05-02"); +insert into diaries values(1755, "2016-05-03"); +insert into diaries values(1756, "2016-05-04"); +insert into diaries values(1757, "2016-05-05"); +insert into diaries values(1758, "2016-05-06"); +insert into diaries values(1759, "2016-05-07"); +insert into diaries values(1760, "2016-05-08"); +insert into diaries values(1761, "2016-05-09"); +insert into diaries values(1762, "2016-05-10"); +insert into diaries values(1763, "2016-05-11"); +insert into diaries values(1764, "2016-05-12"); +insert into diaries values(1765, "2016-05-13"); +insert into diaries values(1766, "2016-05-14"); +insert into diaries values(1767, "2016-05-15"); +insert into diaries values(1768, "2016-05-16"); +insert into diaries values(1769, "2016-05-17"); +insert into diaries values(1770, "2016-05-18"); +insert into diaries values(1771, "2016-05-19"); +insert into diaries values(1772, "2016-05-20"); +insert into diaries values(1773, "2016-05-21"); +insert into diaries values(1774, "2016-05-22"); +insert into diaries values(1775, "2016-05-23"); +insert into diaries values(1776, "2016-05-24"); +insert into diaries values(1777, "2016-05-25"); +insert into diaries values(1778, "2016-05-26"); +insert into diaries values(1779, "2016-05-27"); +insert into diaries values(1780, "2016-05-28"); +insert into diaries values(1781, "2016-05-29"); +insert into diaries values(1782, "2016-05-30"); +insert into diaries values(1783, "2016-05-31"); +insert into diaries values(1784, "2016-06-01"); +insert into diaries values(1785, "2016-06-02"); +insert into diaries values(1786, "2016-06-03"); +insert into diaries values(1787, "2016-06-04"); +insert into diaries values(1788, "2016-06-05"); +insert into diaries values(1789, "2016-06-06"); +insert into diaries values(1790, "2016-06-07"); +insert into diaries values(1791, "2016-06-08"); +insert into diaries values(1792, "2016-06-09"); +insert into diaries values(1793, "2016-06-10"); +insert into diaries values(1794, "2016-06-11"); +insert into diaries values(1795, "2016-06-12"); +insert into diaries values(1796, "2016-06-13"); +insert into diaries values(1797, "2016-06-14"); +insert into diaries values(1798, "2016-06-15"); +insert into diaries values(1799, "2016-06-16"); +insert into diaries values(1800, "2016-06-17"); +insert into diaries values(1801, "2016-06-18"); +insert into diaries values(1802, "2016-06-19"); +insert into diaries values(1803, "2016-06-20"); +insert into diaries values(1804, "2016-06-21"); +insert into diaries values(1805, "2016-06-22"); +insert into diaries values(1806, "2016-06-23"); +insert into diaries values(1807, "2016-06-24"); +insert into diaries values(1808, "2016-06-25"); +insert into diaries values(1809, "2016-06-26"); +insert into diaries values(1810, "2016-06-27"); +insert into diaries values(1811, "2016-06-28"); +insert into diaries values(1812, "2016-06-29"); +insert into diaries values(1813, "2016-06-30"); +insert into diaries values(1814, "2016-07-01"); +insert into diaries values(1815, "2016-07-02"); +insert into diaries values(1816, "2016-07-03"); +insert into diaries values(1817, "2016-07-04"); +insert into diaries values(1818, "2016-07-05"); +insert into diaries values(1819, "2016-07-06"); +insert into diaries values(1820, "2016-07-07"); +insert into diaries values(1821, "2016-07-08"); +insert into diaries values(1822, "2016-07-09"); +insert into diaries values(1823, "2016-07-10"); +insert into diaries values(1824, "2016-07-11"); +insert into diaries values(1825, "2016-07-12"); +insert into diaries values(1826, "2016-07-13"); +insert into diaries values(1827, "2016-07-14"); +insert into diaries values(1828, "2016-07-15"); +insert into diaries values(1829, "2016-07-16"); +insert into diaries values(1830, "2016-07-17"); +insert into diaries values(1831, "2016-07-18"); +insert into diaries values(1832, "2016-07-19"); +insert into diaries values(1833, "2016-07-20"); +insert into diaries values(1834, "2016-07-21"); +insert into diaries values(1835, "2016-07-22"); +insert into diaries values(1836, "2016-07-23"); +insert into diaries values(1837, "2016-07-24"); +insert into diaries values(1838, "2016-07-25"); +insert into diaries values(1839, "2016-07-26"); +insert into diaries values(1840, "2016-07-27"); +insert into diaries values(1841, "2016-07-28"); +insert into diaries values(1842, "2016-07-29"); +insert into diaries values(1843, "2016-07-30"); +insert into diaries values(1844, "2016-07-31"); +insert into diaries values(1845, "2016-08-01"); +insert into diaries values(1846, "2016-08-02"); +insert into diaries values(1847, "2016-08-03"); +insert into diaries values(1848, "2016-08-04"); +insert into diaries values(1849, "2016-08-05"); +insert into diaries values(1850, "2016-08-06"); +insert into diaries values(1851, "2016-08-07"); +insert into diaries values(1852, "2016-08-08"); +insert into diaries values(1853, "2016-08-09"); +insert into diaries values(1854, "2016-08-10"); +insert into diaries values(1855, "2016-08-11"); +insert into diaries values(1856, "2016-08-12"); +insert into diaries values(1857, "2016-08-13"); +insert into diaries values(1858, "2016-08-14"); +insert into diaries values(1859, "2016-08-15"); +insert into diaries values(1860, "2016-08-16"); +insert into diaries values(1861, "2016-08-17"); +insert into diaries values(1862, "2016-08-18"); +insert into diaries values(1863, "2016-08-19"); +insert into diaries values(1864, "2016-08-20"); +insert into diaries values(1865, "2016-08-21"); +insert into diaries values(1866, "2016-08-22"); +insert into diaries values(1867, "2016-08-23"); +insert into diaries values(1868, "2016-08-24"); +insert into diaries values(1869, "2016-08-25"); +insert into diaries values(1870, "2016-08-26"); +insert into diaries values(1871, "2016-08-27"); +insert into diaries values(1872, "2016-08-28"); +insert into diaries values(1873, "2016-08-29"); +insert into diaries values(1874, "2016-08-30"); +insert into diaries values(1875, "2016-08-31"); +insert into diaries values(1876, "2016-09-01"); +insert into diaries values(1877, "2016-09-02"); +insert into diaries values(1878, "2016-09-03"); +insert into diaries values(1879, "2016-09-04"); +insert into diaries values(1880, "2016-09-05"); +insert into diaries values(1881, "2016-09-06"); +insert into diaries values(1882, "2016-09-07"); +insert into diaries values(1883, "2016-09-08"); +insert into diaries values(1884, "2016-09-09"); +insert into diaries values(1885, "2016-09-10"); +insert into diaries values(1886, "2016-09-11"); +insert into diaries values(1887, "2016-09-12"); +insert into diaries values(1888, "2016-09-13"); +insert into diaries values(1889, "2016-09-14"); +insert into diaries values(1890, "2016-09-15"); +insert into diaries values(1891, "2016-09-16"); +insert into diaries values(1892, "2016-09-17"); +insert into diaries values(1893, "2016-09-18"); +insert into diaries values(1894, "2016-09-19"); +insert into diaries values(1895, "2016-09-20"); +insert into diaries values(1896, "2016-09-21"); +insert into diaries values(1897, "2016-09-22"); +insert into diaries values(1898, "2016-09-23"); +insert into diaries values(1899, "2016-09-24"); +insert into diaries values(1900, "2016-09-25"); +insert into diaries values(1901, "2016-09-26"); +insert into diaries values(1902, "2016-09-27"); +insert into diaries values(1903, "2016-09-28"); +insert into diaries values(1904, "2016-09-29"); +insert into diaries values(1905, "2016-09-30"); +insert into diaries values(1906, "2016-10-01"); +insert into diaries values(1907, "2016-10-02"); +insert into diaries values(1908, "2016-10-03"); +insert into diaries values(1909, "2016-10-04"); +insert into diaries values(1910, "2016-10-05"); +insert into diaries values(1911, "2016-10-06"); +insert into diaries values(1912, "2016-10-07"); +insert into diaries values(1913, "2016-10-08"); +insert into diaries values(1914, "2016-10-09"); +insert into diaries values(1915, "2016-10-10"); +insert into diaries values(1916, "2016-10-11"); +insert into diaries values(1917, "2016-10-12"); +insert into diaries values(1918, "2016-10-13"); +insert into diaries values(1919, "2016-10-14"); +insert into diaries values(1920, "2016-10-15"); +insert into diaries values(1921, "2016-10-16"); +insert into diaries values(1922, "2016-10-17"); +insert into diaries values(1923, "2016-10-18"); +insert into diaries values(1924, "2016-10-19"); +insert into diaries values(1925, "2016-10-20"); +insert into diaries values(1926, "2016-10-21"); +insert into diaries values(1927, "2016-10-22"); +insert into diaries values(1928, "2016-10-23"); +insert into diaries values(1929, "2016-10-24"); +insert into diaries values(1930, "2016-10-25"); +insert into diaries values(1931, "2016-10-26"); +insert into diaries values(1932, "2016-10-27"); +insert into diaries values(1933, "2016-10-28"); +insert into diaries values(1934, "2016-10-29"); +insert into diaries values(1935, "2016-10-30"); +insert into diaries values(1936, "2016-10-31"); +insert into diaries values(1937, "2016-11-01"); +insert into diaries values(1938, "2016-11-02"); +insert into diaries values(1939, "2016-11-03"); +insert into diaries values(1940, "2016-11-04"); +insert into diaries values(1941, "2016-11-05"); +insert into diaries values(1942, "2016-11-06"); +insert into diaries values(1943, "2016-11-07"); +insert into diaries values(1944, "2016-11-08"); +insert into diaries values(1945, "2016-11-09"); +insert into diaries values(1946, "2016-11-10"); +insert into diaries values(1947, "2016-11-11"); +insert into diaries values(1948, "2016-11-12"); +insert into diaries values(1949, "2016-11-13"); +insert into diaries values(1950, "2016-11-14"); +insert into diaries values(1951, "2016-11-15"); +insert into diaries values(1952, "2016-11-16"); +insert into diaries values(1953, "2016-11-17"); +insert into diaries values(1954, "2016-11-18"); +insert into diaries values(1955, "2016-11-19"); +insert into diaries values(1956, "2016-11-20"); +insert into diaries values(1957, "2016-11-21"); +insert into diaries values(1958, "2016-11-22"); +insert into diaries values(1959, "2016-11-23"); +insert into diaries values(1960, "2016-11-24"); +insert into diaries values(1961, "2016-11-25"); +insert into diaries values(1962, "2016-11-26"); +insert into diaries values(1963, "2016-11-27"); +insert into diaries values(1964, "2016-11-28"); +insert into diaries values(1965, "2016-11-29"); +insert into diaries values(1966, "2016-11-30"); +insert into diaries values(1967, "2016-12-01"); +insert into diaries values(1968, "2016-12-02"); +insert into diaries values(1969, "2016-12-03"); +insert into diaries values(1970, "2016-12-04"); +insert into diaries values(1971, "2016-12-05"); +insert into diaries values(1972, "2016-12-06"); +insert into diaries values(1973, "2016-12-07"); +insert into diaries values(1974, "2016-12-08"); +insert into diaries values(1975, "2016-12-09"); +insert into diaries values(1976, "2016-12-10"); +insert into diaries values(1977, "2016-12-11"); +insert into diaries values(1978, "2016-12-12"); +insert into diaries values(1979, "2016-12-13"); +insert into diaries values(1980, "2016-12-14"); +insert into diaries values(1981, "2016-12-15"); +insert into diaries values(1982, "2016-12-16"); +insert into diaries values(1983, "2016-12-17"); +insert into diaries values(1984, "2016-12-18"); +insert into diaries values(1985, "2016-12-19"); +insert into diaries values(1986, "2016-12-20"); +insert into diaries values(1987, "2016-12-21"); +insert into diaries values(1988, "2016-12-22"); +insert into diaries values(1989, "2016-12-23"); +insert into diaries values(1990, "2016-12-24"); +insert into diaries values(1991, "2016-12-25"); +insert into diaries values(1992, "2016-12-26"); +insert into diaries values(1993, "2016-12-27"); +insert into diaries values(1994, "2016-12-28"); +insert into diaries values(1995, "2016-12-29"); +insert into diaries values(1996, "2016-12-30"); +insert into diaries values(1997, "2016-12-31"); +insert into diaries values(1998, "2017-01-01"); +insert into diaries values(1999, "2017-01-02"); +insert into diaries values(2000, "2017-01-03"); +insert into diaries values(2001, "2017-01-04"); +insert into diaries values(2002, "2017-01-05"); +insert into diaries values(2003, "2017-01-06"); +insert into diaries values(2004, "2017-01-07"); +insert into diaries values(2005, "2017-01-08"); +insert into diaries values(2006, "2017-01-09"); +insert into diaries values(2007, "2017-01-10"); +insert into diaries values(2008, "2017-01-11"); +insert into diaries values(2009, "2017-01-12"); +insert into diaries values(2010, "2017-01-13"); +insert into diaries values(2011, "2017-01-14"); +insert into diaries values(2012, "2017-01-15"); +insert into diaries values(2013, "2017-01-16"); +insert into diaries values(2014, "2017-01-17"); +insert into diaries values(2015, "2017-01-18"); +insert into diaries values(2016, "2017-01-19"); +insert into diaries values(2017, "2017-01-20"); +insert into diaries values(2018, "2017-01-21"); +insert into diaries values(2019, "2017-01-22"); +insert into diaries values(2020, "2017-01-23"); +insert into diaries values(2021, "2017-01-24"); +insert into diaries values(2022, "2017-01-25"); +insert into diaries values(2023, "2017-01-26"); +insert into diaries values(2024, "2017-01-27"); +insert into diaries values(2025, "2017-01-28"); +insert into diaries values(2026, "2017-01-29"); +insert into diaries values(2027, "2017-01-30"); +insert into diaries values(2028, "2017-01-31"); +insert into diaries values(2029, "2017-02-01"); +insert into diaries values(2030, "2017-02-02"); +insert into diaries values(2031, "2017-02-03"); +insert into diaries values(2032, "2017-02-04"); +insert into diaries values(2033, "2017-02-05"); +insert into diaries values(2034, "2017-02-06"); +insert into diaries values(2035, "2017-02-07"); +insert into diaries values(2036, "2017-02-08"); +insert into diaries values(2037, "2017-02-09"); +insert into diaries values(2038, "2017-02-10"); +insert into diaries values(2039, "2017-02-11"); +insert into diaries values(2040, "2017-02-12"); +insert into diaries values(2041, "2017-02-13"); +insert into diaries values(2042, "2017-02-14"); +insert into diaries values(2043, "2017-02-15"); +insert into diaries values(2044, "2017-02-16"); +insert into diaries values(2045, "2017-02-17"); +insert into diaries values(2046, "2017-02-18"); +insert into diaries values(2047, "2017-02-19"); +insert into diaries values(2048, "2017-02-20"); +insert into diaries values(2049, "2017-02-21"); +insert into diaries values(2050, "2017-02-22"); +insert into diaries values(2051, "2017-02-23"); +insert into diaries values(2052, "2017-02-24"); +insert into diaries values(2053, "2017-02-25"); +insert into diaries values(2054, "2017-02-26"); +insert into diaries values(2055, "2017-02-27"); +insert into diaries values(2056, "2017-02-28"); +insert into diaries values(2057, "2017-03-01"); +insert into diaries values(2058, "2017-03-02"); +insert into diaries values(2059, "2017-03-03"); +insert into diaries values(2060, "2017-03-04"); +insert into diaries values(2061, "2017-03-05"); +insert into diaries values(2062, "2017-03-06"); +insert into diaries values(2063, "2017-03-07"); +insert into diaries values(2064, "2017-03-08"); +insert into diaries values(2065, "2017-03-09"); +insert into diaries values(2066, "2017-03-10"); +insert into diaries values(2067, "2017-03-11"); +insert into diaries values(2068, "2017-03-12"); +insert into diaries values(2069, "2017-03-13"); +insert into diaries values(2070, "2017-03-14"); +insert into diaries values(2071, "2017-03-15"); +insert into diaries values(2072, "2017-03-16"); +insert into diaries values(2073, "2017-03-17"); +insert into diaries values(2074, "2017-03-18"); +insert into diaries values(2075, "2017-03-19"); +insert into diaries values(2076, "2017-03-20"); +insert into diaries values(2077, "2017-03-21"); +insert into diaries values(2078, "2017-03-22"); +insert into diaries values(2079, "2017-03-23"); +insert into diaries values(2080, "2017-03-24"); +insert into diaries values(2081, "2017-03-25"); +insert into diaries values(2082, "2017-03-26"); +insert into diaries values(2083, "2017-03-27"); +insert into diaries values(2084, "2017-03-28"); +insert into diaries values(2085, "2017-03-29"); +insert into diaries values(2086, "2017-03-30"); +insert into diaries values(2087, "2017-03-31"); +insert into diaries values(2088, "2017-04-01"); +insert into diaries values(2089, "2017-04-02"); +insert into diaries values(2090, "2017-04-03"); +insert into diaries values(2091, "2017-04-04"); +insert into diaries values(2092, "2017-04-05"); +insert into diaries values(2093, "2017-04-06"); +insert into diaries values(2094, "2017-04-07"); +insert into diaries values(2095, "2017-04-08"); +insert into diaries values(2096, "2017-04-09"); +insert into diaries values(2097, "2017-04-10"); +insert into diaries values(2098, "2017-04-11"); +insert into diaries values(2099, "2017-04-12"); +insert into diaries values(2100, "2017-04-13"); +insert into diaries values(2101, "2017-04-14"); +insert into diaries values(2102, "2017-04-15"); +insert into diaries values(2103, "2017-04-16"); +insert into diaries values(2104, "2017-04-17"); +insert into diaries values(2105, "2017-04-18"); +insert into diaries values(2106, "2017-04-19"); +insert into diaries values(2107, "2017-04-20"); +insert into diaries values(2108, "2017-04-21"); +insert into diaries values(2109, "2017-04-22"); +insert into diaries values(2110, "2017-04-23"); +insert into diaries values(2111, "2017-04-24"); +insert into diaries values(2112, "2017-04-25"); +insert into diaries values(2113, "2017-04-26"); +insert into diaries values(2114, "2017-04-27"); +insert into diaries values(2115, "2017-04-28"); +insert into diaries values(2116, "2017-04-29"); +insert into diaries values(2117, "2017-04-30"); +insert into diaries values(2118, "2017-05-01"); +insert into diaries values(2119, "2017-05-02"); +insert into diaries values(2120, "2017-05-03"); +insert into diaries values(2121, "2017-05-04"); +insert into diaries values(2122, "2017-05-05"); +insert into diaries values(2123, "2017-05-06"); +insert into diaries values(2124, "2017-05-07"); +insert into diaries values(2125, "2017-05-08"); +insert into diaries values(2126, "2017-05-09"); +insert into diaries values(2127, "2017-05-10"); +insert into diaries values(2128, "2017-05-11"); +insert into diaries values(2129, "2017-05-12"); +insert into diaries values(2130, "2017-05-13"); +insert into diaries values(2131, "2017-05-14"); +insert into diaries values(2132, "2017-05-15"); +insert into diaries values(2133, "2017-05-16"); +insert into diaries values(2134, "2017-05-17"); +insert into diaries values(2135, "2017-05-18"); +insert into diaries values(2136, "2017-05-19"); +insert into diaries values(2137, "2017-05-20"); +insert into diaries values(2138, "2017-05-21"); +insert into diaries values(2139, "2017-05-22"); +insert into diaries values(2140, "2017-05-23"); +insert into diaries values(2141, "2017-05-24"); +insert into diaries values(2142, "2017-05-25"); +insert into diaries values(2143, "2017-05-26"); +insert into diaries values(2144, "2017-05-27"); +insert into diaries values(2145, "2017-05-28"); +insert into diaries values(2146, "2017-05-29"); +insert into diaries values(2147, "2017-05-30"); +insert into diaries values(2148, "2017-05-31"); +insert into diaries values(2149, "2017-06-01"); +insert into diaries values(2150, "2017-06-02"); +insert into diaries values(2151, "2017-06-03"); +insert into diaries values(2152, "2017-06-04"); +insert into diaries values(2153, "2017-06-05"); +insert into diaries values(2154, "2017-06-06"); +insert into diaries values(2155, "2017-06-07"); +insert into diaries values(2156, "2017-06-08"); +insert into diaries values(2157, "2017-06-09"); +insert into diaries values(2158, "2017-06-10"); +insert into diaries values(2159, "2017-06-11"); +insert into diaries values(2160, "2017-06-12"); +insert into diaries values(2161, "2017-06-13"); +insert into diaries values(2162, "2017-06-14"); +insert into diaries values(2163, "2017-06-15"); +insert into diaries values(2164, "2017-06-16"); +insert into diaries values(2165, "2017-06-17"); +insert into diaries values(2166, "2017-06-18"); +insert into diaries values(2167, "2017-06-19"); +insert into diaries values(2168, "2017-06-20"); +insert into diaries values(2169, "2017-06-21"); +insert into diaries values(2170, "2017-06-22"); +insert into diaries values(2171, "2017-06-23"); +insert into diaries values(2172, "2017-06-24"); +insert into diaries values(2173, "2017-06-25"); +insert into diaries values(2174, "2017-06-26"); +insert into diaries values(2175, "2017-06-27"); +insert into diaries values(2176, "2017-06-28"); +insert into diaries values(2177, "2017-06-29"); +insert into diaries values(2178, "2017-06-30"); +insert into diaries values(2179, "2017-07-01"); +insert into diaries values(2180, "2017-07-02"); +insert into diaries values(2181, "2017-07-03"); +insert into diaries values(2182, "2017-07-04"); +insert into diaries values(2183, "2017-07-05"); +insert into diaries values(2184, "2017-07-06"); +insert into diaries values(2185, "2017-07-07"); +insert into diaries values(2186, "2017-07-08"); +insert into diaries values(2187, "2017-07-09"); +insert into diaries values(2188, "2017-07-10"); +insert into diaries values(2189, "2017-07-11"); +insert into diaries values(2190, "2017-07-12"); +insert into diaries values(2191, "2017-07-13"); +insert into diaries values(2192, "2017-07-14"); +insert into diaries values(2193, "2017-07-15"); +insert into diaries values(2194, "2017-07-16"); +insert into diaries values(2195, "2017-07-17"); +insert into diaries values(2196, "2017-07-18"); +insert into diaries values(2197, "2017-07-19"); +insert into diaries values(2198, "2017-07-20"); +insert into diaries values(2199, "2017-07-21"); +insert into diaries values(2200, "2017-07-22"); +insert into diaries values(2201, "2017-07-23"); +insert into diaries values(2202, "2017-07-24"); +insert into diaries values(2203, "2017-07-25"); +insert into diaries values(2204, "2017-07-26"); +insert into diaries values(2205, "2017-07-27"); +insert into diaries values(2206, "2017-07-28"); +insert into diaries values(2207, "2017-07-29"); +insert into diaries values(2208, "2017-07-30"); +insert into diaries values(2209, "2017-07-31"); +insert into diaries values(2210, "2017-08-01"); +insert into diaries values(2211, "2017-08-02"); +insert into diaries values(2212, "2017-08-03"); +insert into diaries values(2213, "2017-08-04"); +insert into diaries values(2214, "2017-08-05"); +insert into diaries values(2215, "2017-08-06"); +insert into diaries values(2216, "2017-08-07"); +insert into diaries values(2217, "2017-08-08"); +insert into diaries values(2218, "2017-08-09"); +insert into diaries values(2219, "2017-08-10"); +insert into diaries values(2220, "2017-08-11"); +insert into diaries values(2221, "2017-08-12"); +insert into diaries values(2222, "2017-08-13"); +insert into diaries values(2223, "2017-08-14"); +insert into diaries values(2224, "2017-08-15"); +insert into diaries values(2225, "2017-08-16"); +insert into diaries values(2226, "2017-08-17"); +insert into diaries values(2227, "2017-08-18"); +insert into diaries values(2228, "2017-08-19"); +insert into diaries values(2229, "2017-08-20"); +insert into diaries values(2230, "2017-08-21"); +insert into diaries values(2231, "2017-08-22"); +insert into diaries values(2232, "2017-08-23"); +insert into diaries values(2233, "2017-08-24"); +insert into diaries values(2234, "2017-08-25"); +insert into diaries values(2235, "2017-08-26"); +insert into diaries values(2236, "2017-08-27"); +insert into diaries values(2237, "2017-08-28"); +insert into diaries values(2238, "2017-08-29"); +insert into diaries values(2239, "2017-08-30"); +insert into diaries values(2240, "2017-08-31"); +insert into diaries values(2241, "2017-09-01"); +insert into diaries values(2242, "2017-09-02"); +insert into diaries values(2243, "2017-09-03"); +insert into diaries values(2244, "2017-09-04"); +insert into diaries values(2245, "2017-09-05"); +insert into diaries values(2246, "2017-09-06"); +insert into diaries values(2247, "2017-09-07"); +insert into diaries values(2248, "2017-09-08"); +insert into diaries values(2249, "2017-09-09"); +insert into diaries values(2250, "2017-09-10"); +insert into diaries values(2251, "2017-09-11"); +insert into diaries values(2252, "2017-09-12"); +insert into diaries values(2253, "2017-09-13"); +insert into diaries values(2254, "2017-09-14"); +insert into diaries values(2255, "2017-09-15"); +insert into diaries values(2256, "2017-09-16"); +insert into diaries values(2257, "2017-09-17"); +insert into diaries values(2258, "2017-09-18"); +insert into diaries values(2259, "2017-09-19"); +insert into diaries values(2260, "2017-09-20"); +insert into diaries values(2261, "2017-09-21"); +insert into diaries values(2262, "2017-09-22"); +insert into diaries values(2263, "2017-09-23"); +insert into diaries values(2264, "2017-09-24"); +insert into diaries values(2265, "2017-09-25"); +insert into diaries values(2266, "2017-09-26"); +insert into diaries values(2267, "2017-09-27"); +insert into diaries values(2268, "2017-09-28"); +insert into diaries values(2269, "2017-09-29"); +insert into diaries values(2270, "2017-09-30"); +insert into diaries values(2271, "2017-10-01"); +insert into diaries values(2272, "2017-10-02"); +insert into diaries values(2273, "2017-10-03"); +insert into diaries values(2274, "2017-10-04"); +insert into diaries values(2275, "2017-10-05"); +insert into diaries values(2276, "2017-10-06"); +insert into diaries values(2277, "2017-10-07"); +insert into diaries values(2278, "2017-10-08"); +insert into diaries values(2279, "2017-10-09"); +insert into diaries values(2280, "2017-10-10"); +insert into diaries values(2281, "2017-10-11"); +insert into diaries values(2282, "2017-10-12"); +insert into diaries values(2283, "2017-10-13"); +insert into diaries values(2284, "2017-10-14"); +insert into diaries values(2285, "2017-10-15"); +insert into diaries values(2286, "2017-10-16"); +insert into diaries values(2287, "2017-10-17"); +insert into diaries values(2288, "2017-10-18"); +insert into diaries values(2289, "2017-10-19"); +insert into diaries values(2290, "2017-10-20"); +insert into diaries values(2291, "2017-10-21"); +insert into diaries values(2292, "2017-10-22"); +insert into diaries values(2293, "2017-10-23"); +insert into diaries values(2294, "2017-10-24"); +insert into diaries values(2295, "2017-10-25"); +insert into diaries values(2296, "2017-10-26"); +insert into diaries values(2297, "2017-10-27"); +insert into diaries values(2298, "2017-10-28"); +insert into diaries values(2299, "2017-10-29"); +insert into diaries values(2300, "2017-10-30"); +insert into diaries values(2301, "2017-10-31"); +insert into diaries values(2302, "2017-11-01"); +insert into diaries values(2303, "2017-11-02"); +insert into diaries values(2304, "2017-11-03"); +insert into diaries values(2305, "2017-11-04"); +insert into diaries values(2306, "2017-11-05"); +insert into diaries values(2307, "2017-11-06"); +insert into diaries values(2308, "2017-11-07"); +insert into diaries values(2309, "2017-11-08"); +insert into diaries values(2310, "2017-11-09"); +insert into diaries values(2311, "2017-11-10"); +insert into diaries values(2312, "2017-11-11"); +insert into diaries values(2313, "2017-11-12"); +insert into diaries values(2314, "2017-11-13"); +insert into diaries values(2315, "2017-11-14"); +insert into diaries values(2316, "2017-11-15"); +insert into diaries values(2317, "2017-11-16"); +insert into diaries values(2318, "2017-11-17"); +insert into diaries values(2319, "2017-11-18"); +insert into diaries values(2320, "2017-11-19"); +insert into diaries values(2321, "2017-11-20"); +insert into diaries values(2322, "2017-11-21"); +insert into diaries values(2323, "2017-11-22"); +insert into diaries values(2324, "2017-11-23"); +insert into diaries values(2325, "2017-11-24"); +insert into diaries values(2326, "2017-11-25"); +insert into diaries values(2327, "2017-11-26"); +insert into diaries values(2328, "2017-11-27"); +insert into diaries values(2329, "2017-11-28"); +insert into diaries values(2330, "2017-11-29"); +insert into diaries values(2331, "2017-11-30"); +insert into diaries values(2332, "2017-12-01"); +insert into diaries values(2333, "2017-12-02"); +insert into diaries values(2334, "2017-12-03"); +insert into diaries values(2335, "2017-12-04"); +insert into diaries values(2336, "2017-12-05"); +insert into diaries values(2337, "2017-12-06"); +insert into diaries values(2338, "2017-12-07"); +insert into diaries values(2339, "2017-12-08"); +insert into diaries values(2340, "2017-12-09"); +insert into diaries values(2341, "2017-12-10"); +insert into diaries values(2342, "2017-12-11"); +insert into diaries values(2343, "2017-12-12"); +insert into diaries values(2344, "2017-12-13"); +insert into diaries values(2345, "2017-12-14"); +insert into diaries values(2346, "2017-12-15"); +insert into diaries values(2347, "2017-12-16"); +insert into diaries values(2348, "2017-12-17"); +insert into diaries values(2349, "2017-12-18"); +insert into diaries values(2350, "2017-12-19"); +insert into diaries values(2351, "2017-12-20"); +insert into diaries values(2352, "2017-12-21"); +insert into diaries values(2353, "2017-12-22"); +insert into diaries values(2354, "2017-12-23"); +insert into diaries values(2355, "2017-12-24"); +insert into diaries values(2356, "2017-12-25"); +insert into diaries values(2357, "2017-12-26"); +insert into diaries values(2358, "2017-12-27"); +insert into diaries values(2359, "2017-12-28"); +insert into diaries values(2360, "2017-12-29"); +insert into diaries values(2361, "2017-12-30"); +insert into diaries values(2362, "2017-12-31"); +insert into diaries values(2363, "2018-01-01"); +insert into diaries values(2364, "2018-01-02"); +insert into diaries values(2365, "2018-01-03"); +insert into diaries values(2366, "2018-01-04"); +insert into diaries values(2367, "2018-01-05"); +insert into diaries values(2368, "2018-01-06"); +insert into diaries values(2369, "2018-01-07"); +insert into diaries values(2370, "2018-01-08"); +insert into diaries values(2371, "2018-01-09"); +insert into diaries values(2372, "2018-01-10"); +insert into diaries values(2373, "2018-01-11"); +insert into diaries values(2374, "2018-01-12"); +insert into diaries values(2375, "2018-01-13"); +insert into diaries values(2376, "2018-01-14"); +insert into diaries values(2377, "2018-01-15"); +insert into diaries values(2378, "2018-01-16"); +insert into diaries values(2379, "2018-01-17"); +insert into diaries values(2380, "2018-01-18"); +insert into diaries values(2381, "2018-01-19"); +insert into diaries values(2382, "2018-01-20"); +insert into diaries values(2383, "2018-01-21"); +insert into diaries values(2384, "2018-01-22"); +insert into diaries values(2385, "2018-01-23"); +insert into diaries values(2386, "2018-01-24"); +insert into diaries values(2387, "2018-01-25"); +insert into diaries values(2388, "2018-01-26"); +insert into diaries values(2389, "2018-01-27"); +insert into diaries values(2390, "2018-01-28"); +insert into diaries values(2391, "2018-01-29"); +insert into diaries values(2392, "2018-01-30"); +insert into diaries values(2393, "2018-01-31"); +insert into diaries values(2394, "2018-02-01"); +insert into diaries values(2395, "2018-02-02"); +insert into diaries values(2396, "2018-02-03"); +insert into diaries values(2397, "2018-02-04"); +insert into diaries values(2398, "2018-02-05"); +insert into diaries values(2399, "2018-02-06"); +insert into diaries values(2400, "2018-02-07"); +insert into diaries values(2401, "2018-02-08"); +insert into diaries values(2402, "2018-02-09"); +insert into diaries values(2403, "2018-02-10"); +insert into diaries values(2404, "2018-02-11"); +insert into diaries values(2405, "2018-02-12"); +insert into diaries values(2406, "2018-02-13"); +insert into diaries values(2407, "2018-02-14"); +insert into diaries values(2408, "2018-02-15"); +insert into diaries values(2409, "2018-02-16"); +insert into diaries values(2410, "2018-02-17"); +insert into diaries values(2411, "2018-02-18"); +insert into diaries values(2412, "2018-02-19"); +insert into diaries values(2413, "2018-02-20"); +insert into diaries values(2414, "2018-02-21"); +insert into diaries values(2415, "2018-02-22"); +insert into diaries values(2416, "2018-02-23"); +insert into diaries values(2417, "2018-02-24"); +insert into diaries values(2418, "2018-02-25"); +insert into diaries values(2419, "2018-02-26"); +insert into diaries values(2420, "2018-02-27"); +insert into diaries values(2421, "2018-02-28"); +insert into diaries values(2422, "2018-03-01"); +insert into diaries values(2423, "2018-03-02"); +insert into diaries values(2424, "2018-03-03"); +insert into diaries values(2425, "2018-03-04"); +insert into diaries values(2426, "2018-03-05"); +insert into diaries values(2427, "2018-03-06"); +insert into diaries values(2428, "2018-03-07"); +insert into diaries values(2429, "2018-03-08"); +insert into diaries values(2430, "2018-03-09"); +insert into diaries values(2431, "2018-03-10"); +insert into diaries values(2432, "2018-03-11"); +insert into diaries values(2433, "2018-03-12"); +insert into diaries values(2434, "2018-03-13"); +insert into diaries values(2435, "2018-03-14"); +insert into diaries values(2436, "2018-03-15"); +insert into diaries values(2437, "2018-03-16"); +insert into diaries values(2438, "2018-03-17"); +insert into diaries values(2439, "2018-03-18"); +insert into diaries values(2440, "2018-03-19"); +insert into diaries values(2441, "2018-03-20"); +insert into diaries values(2442, "2018-03-21"); +insert into diaries values(2443, "2018-03-22"); +insert into diaries values(2444, "2018-03-23"); +insert into diaries values(2445, "2018-03-24"); +insert into diaries values(2446, "2018-03-25"); +insert into diaries values(2447, "2018-03-26"); +insert into diaries values(2448, "2018-03-27"); +insert into diaries values(2449, "2018-03-28"); +insert into diaries values(2450, "2018-03-29"); +insert into diaries values(2451, "2018-03-30"); +insert into diaries values(2452, "2018-03-31"); +insert into diaries values(2453, "2018-04-01"); +insert into diaries values(2454, "2018-04-02"); +insert into diaries values(2455, "2018-04-03"); +insert into diaries values(2456, "2018-04-04"); +insert into diaries values(2457, "2018-04-05"); +insert into diaries values(2458, "2018-04-06"); +insert into diaries values(2459, "2018-04-07"); +insert into diaries values(2460, "2018-04-08"); +insert into diaries values(2461, "2018-04-09"); +insert into diaries values(2462, "2018-04-10"); +insert into diaries values(2463, "2018-04-11"); +insert into diaries values(2464, "2018-04-12"); +insert into diaries values(2465, "2018-04-13"); +insert into diaries values(2466, "2018-04-14"); +insert into diaries values(2467, "2018-04-15"); +insert into diaries values(2468, "2018-04-16"); +insert into diaries values(2469, "2018-04-17"); +insert into diaries values(2470, "2018-04-18"); +insert into diaries values(2471, "2018-04-19"); +insert into diaries values(2472, "2018-04-20"); +insert into diaries values(2473, "2018-04-21"); +insert into diaries values(2474, "2018-04-22"); +insert into diaries values(2475, "2018-04-23"); +insert into diaries values(2476, "2018-04-24"); +insert into diaries values(2477, "2018-04-25"); +insert into diaries values(2478, "2018-04-26"); +insert into diaries values(2479, "2018-04-27"); +insert into diaries values(2480, "2018-04-28"); +insert into diaries values(2481, "2018-04-29"); +insert into diaries values(2482, "2018-04-30"); +insert into diaries values(2483, "2018-05-01"); +insert into diaries values(2484, "2018-05-02"); +insert into diaries values(2485, "2018-05-03"); +insert into diaries values(2486, "2018-05-04"); +insert into diaries values(2487, "2018-05-05"); +insert into diaries values(2488, "2018-05-06"); +insert into diaries values(2489, "2018-05-07"); +insert into diaries values(2490, "2018-05-08"); +insert into diaries values(2491, "2018-05-09"); +insert into diaries values(2492, "2018-05-10"); +insert into diaries values(2493, "2018-05-11"); +insert into diaries values(2494, "2018-05-12"); +insert into diaries values(2495, "2018-05-13"); +insert into diaries values(2496, "2018-05-14"); +insert into diaries values(2497, "2018-05-15"); +insert into diaries values(2498, "2018-05-16"); +insert into diaries values(2499, "2018-05-17"); +insert into diaries values(2500, "2018-05-18"); +insert into diaries values(2501, "2018-05-19"); +insert into diaries values(2502, "2018-05-20"); +insert into diaries values(2503, "2018-05-21"); +insert into diaries values(2504, "2018-05-22"); +insert into diaries values(2505, "2018-05-23"); +insert into diaries values(2506, "2018-05-24"); +insert into diaries values(2507, "2018-05-25"); +insert into diaries values(2508, "2018-05-26"); +insert into diaries values(2509, "2018-05-27"); +insert into diaries values(2510, "2018-05-28"); +insert into diaries values(2511, "2018-05-29"); +insert into diaries values(2512, "2018-05-30"); +insert into diaries values(2513, "2018-05-31"); +insert into diaries values(2514, "2018-06-01"); +insert into diaries values(2515, "2018-06-02"); +insert into diaries values(2516, "2018-06-03"); +insert into diaries values(2517, "2018-06-04"); +insert into diaries values(2518, "2018-06-05"); +insert into diaries values(2519, "2018-06-06"); +insert into diaries values(2520, "2018-06-07"); +insert into diaries values(2521, "2018-06-08"); +insert into diaries values(2522, "2018-06-09"); +insert into diaries values(2523, "2018-06-10"); +insert into diaries values(2524, "2018-06-11"); +insert into diaries values(2525, "2018-06-12"); +insert into diaries values(2526, "2018-06-13"); +insert into diaries values(2527, "2018-06-14"); +insert into diaries values(2528, "2018-06-15"); +insert into diaries values(2529, "2018-06-16"); +insert into diaries values(2530, "2018-06-17"); +insert into diaries values(2531, "2018-06-18"); +insert into diaries values(2532, "2018-06-19"); +insert into diaries values(2533, "2018-06-20"); +insert into diaries values(2534, "2018-06-21"); +insert into diaries values(2535, "2018-06-22"); +insert into diaries values(2536, "2018-06-23"); +insert into diaries values(2537, "2018-06-24"); +insert into diaries values(2538, "2018-06-25"); +insert into diaries values(2539, "2018-06-26"); +insert into diaries values(2540, "2018-06-27"); +insert into diaries values(2541, "2018-06-28"); +insert into diaries values(2542, "2018-06-29"); +insert into diaries values(2543, "2018-06-30"); +insert into diaries values(2544, "2018-07-01"); +insert into diaries values(2545, "2018-07-02"); +insert into diaries values(2546, "2018-07-03"); +insert into diaries values(2547, "2018-07-04"); +insert into diaries values(2548, "2018-07-05"); +insert into diaries values(2549, "2018-07-06"); +insert into diaries values(2550, "2018-07-07"); +insert into diaries values(2551, "2018-07-08"); +insert into diaries values(2552, "2018-07-09"); +insert into diaries values(2553, "2018-07-10"); +insert into diaries values(2554, "2018-07-11"); +insert into diaries values(2555, "2018-07-12"); +insert into diaries values(2556, "2018-07-13"); +insert into diaries values(2557, "2018-07-14"); +insert into diaries values(2558, "2018-07-15"); +insert into diaries values(2559, "2018-07-16"); +insert into diaries values(2560, "2018-07-17"); +insert into diaries values(2561, "2018-07-18"); +insert into diaries values(2562, "2018-07-19"); +insert into diaries values(2563, "2018-07-20"); +insert into diaries values(2564, "2018-07-21"); +insert into diaries values(2565, "2018-07-22"); +insert into diaries values(2566, "2018-07-23"); +insert into diaries values(2567, "2018-07-24"); +insert into diaries values(2568, "2018-07-25"); +insert into diaries values(2569, "2018-07-26"); +insert into diaries values(2570, "2018-07-27"); +insert into diaries values(2571, "2018-07-28"); +insert into diaries values(2572, "2018-07-29"); +insert into diaries values(2573, "2018-07-30"); +insert into diaries values(2574, "2018-07-31"); +insert into diaries values(2575, "2018-08-01"); +insert into diaries values(2576, "2018-08-02"); +insert into diaries values(2577, "2018-08-03"); +insert into diaries values(2578, "2018-08-04"); +insert into diaries values(2579, "2018-08-05"); +insert into diaries values(2580, "2018-08-06"); +insert into diaries values(2581, "2018-08-07"); +insert into diaries values(2582, "2018-08-08"); +insert into diaries values(2583, "2018-08-09"); +insert into diaries values(2584, "2018-08-10"); +insert into diaries values(2585, "2018-08-11"); +insert into diaries values(2586, "2018-08-12"); +insert into diaries values(2587, "2018-08-13"); +insert into diaries values(2588, "2018-08-14"); +insert into diaries values(2589, "2018-08-15"); +insert into diaries values(2590, "2018-08-16"); +insert into diaries values(2591, "2018-08-17"); +insert into diaries values(2592, "2018-08-18"); +insert into diaries values(2593, "2018-08-19"); +insert into diaries values(2594, "2018-08-20"); +insert into diaries values(2595, "2018-08-21"); +insert into diaries values(2596, "2018-08-22"); +insert into diaries values(2597, "2018-08-23"); +insert into diaries values(2598, "2018-08-24"); +insert into diaries values(2599, "2018-08-25"); +insert into diaries values(2600, "2018-08-26"); +insert into diaries values(2601, "2018-08-27"); +insert into diaries values(2602, "2018-08-28"); +insert into diaries values(2603, "2018-08-29"); +insert into diaries values(2604, "2018-08-30"); +insert into diaries values(2605, "2018-08-31"); +insert into diaries values(2606, "2018-09-01"); +insert into diaries values(2607, "2018-09-02"); +insert into diaries values(2608, "2018-09-03"); +insert into diaries values(2609, "2018-09-04"); +insert into diaries values(2610, "2018-09-05"); +insert into diaries values(2611, "2018-09-06"); +insert into diaries values(2612, "2018-09-07"); +insert into diaries values(2613, "2018-09-08"); +insert into diaries values(2614, "2018-09-09"); +insert into diaries values(2615, "2018-09-10"); +insert into diaries values(2616, "2018-09-11"); +insert into diaries values(2617, "2018-09-12"); +insert into diaries values(2618, "2018-09-13"); +insert into diaries values(2619, "2018-09-14"); +insert into diaries values(2620, "2018-09-15"); +insert into diaries values(2621, "2018-09-16"); +insert into diaries values(2622, "2018-09-17"); +insert into diaries values(2623, "2018-09-18"); +insert into diaries values(2624, "2018-09-19"); +insert into diaries values(2625, "2018-09-20"); +insert into diaries values(2626, "2018-09-21"); +insert into diaries values(2627, "2018-09-22"); +insert into diaries values(2628, "2018-09-23"); +insert into diaries values(2629, "2018-09-24"); +insert into diaries values(2630, "2018-09-25"); +insert into diaries values(2631, "2018-09-26"); +insert into diaries values(2632, "2018-09-27"); +insert into diaries values(2633, "2018-09-28"); +insert into diaries values(2634, "2018-09-29"); +insert into diaries values(2635, "2018-09-30"); +insert into diaries values(2636, "2018-10-01"); +insert into diaries values(2637, "2018-10-02"); +insert into diaries values(2638, "2018-10-03"); +insert into diaries values(2639, "2018-10-04"); +insert into diaries values(2640, "2018-10-05"); +insert into diaries values(2641, "2018-10-06"); +insert into diaries values(2642, "2018-10-07"); +insert into diaries values(2643, "2018-10-08"); +insert into diaries values(2644, "2018-10-09"); +insert into diaries values(2645, "2018-10-10"); +insert into diaries values(2646, "2018-10-11"); +insert into diaries values(2647, "2018-10-12"); +insert into diaries values(2648, "2018-10-13"); +insert into diaries values(2649, "2018-10-14"); +insert into diaries values(2650, "2018-10-15"); +insert into diaries values(2651, "2018-10-16"); +insert into diaries values(2652, "2018-10-17"); +insert into diaries values(2653, "2018-10-18"); +insert into diaries values(2654, "2018-10-19"); +insert into diaries values(2655, "2018-10-20"); +insert into diaries values(2656, "2018-10-21"); +insert into diaries values(2657, "2018-10-22"); +insert into diaries values(2658, "2018-10-23"); +insert into diaries values(2659, "2018-10-24"); +insert into diaries values(2660, "2018-10-25"); +insert into diaries values(2661, "2018-10-26"); +insert into diaries values(2662, "2018-10-27"); +insert into diaries values(2663, "2018-10-28"); +insert into diaries values(2664, "2018-10-29"); +insert into diaries values(2665, "2018-10-30"); +insert into diaries values(2666, "2018-10-31"); +insert into diaries values(2667, "2018-11-01"); +insert into diaries values(2668, "2018-11-02"); +insert into diaries values(2669, "2018-11-03"); +insert into diaries values(2670, "2018-11-04"); +insert into diaries values(2671, "2018-11-05"); +insert into diaries values(2672, "2018-11-06"); +insert into diaries values(2673, "2018-11-07"); +insert into diaries values(2674, "2018-11-08"); +insert into diaries values(2675, "2018-11-09"); +insert into diaries values(2676, "2018-11-10"); +insert into diaries values(2677, "2018-11-11"); +insert into diaries values(2678, "2018-11-12"); +insert into diaries values(2679, "2018-11-13"); +insert into diaries values(2680, "2018-11-14"); +insert into diaries values(2681, "2018-11-15"); +insert into diaries values(2682, "2018-11-16"); +insert into diaries values(2683, "2018-11-17"); +insert into diaries values(2684, "2018-11-18"); +insert into diaries values(2685, "2018-11-19"); +insert into diaries values(2686, "2018-11-20"); +insert into diaries values(2687, "2018-11-21"); +insert into diaries values(2688, "2018-11-22"); +insert into diaries values(2689, "2018-11-23"); +insert into diaries values(2690, "2018-11-24"); +insert into diaries values(2691, "2018-11-25"); +insert into diaries values(2692, "2018-11-26"); +insert into diaries values(2693, "2018-11-27"); +insert into diaries values(2694, "2018-11-28"); +insert into diaries values(2695, "2018-11-29"); +insert into diaries values(2696, "2018-11-30"); +insert into diaries values(2697, "2018-12-01"); +insert into diaries values(2698, "2018-12-02"); +insert into diaries values(2699, "2018-12-03"); +insert into diaries values(2700, "2018-12-04"); +insert into diaries values(2701, "2018-12-05"); +insert into diaries values(2702, "2018-12-06"); +insert into diaries values(2703, "2018-12-07"); +insert into diaries values(2704, "2018-12-08"); +insert into diaries values(2705, "2018-12-09"); +insert into diaries values(2706, "2018-12-10"); +insert into diaries values(2707, "2018-12-11"); +insert into diaries values(2708, "2018-12-12"); +insert into diaries values(2709, "2018-12-13"); +insert into diaries values(2710, "2018-12-14"); +insert into diaries values(2711, "2018-12-15"); +insert into diaries values(2712, "2018-12-16"); +insert into diaries values(2713, "2018-12-17"); +insert into diaries values(2714, "2018-12-18"); +insert into diaries values(2715, "2018-12-19"); +insert into diaries values(2716, "2018-12-20"); +insert into diaries values(2717, "2018-12-21"); +insert into diaries values(2718, "2018-12-22"); +insert into diaries values(2719, "2018-12-23"); +insert into diaries values(2720, "2018-12-24"); +insert into diaries values(2721, "2018-12-25"); +insert into diaries values(2722, "2018-12-26"); +insert into diaries values(2723, "2018-12-27"); +insert into diaries values(2724, "2018-12-28"); +insert into diaries values(2725, "2018-12-29"); +insert into diaries values(2726, "2018-12-30"); +insert into diaries values(2727, "2018-12-31"); +insert into diaries values(2728, "2019-01-01"); +insert into diaries values(2729, "2019-01-02"); +insert into diaries values(2730, "2019-01-03"); +insert into diaries values(2731, "2019-01-04"); +insert into diaries values(2732, "2019-01-05"); +insert into diaries values(2733, "2019-01-06"); +insert into diaries values(2734, "2019-01-07"); +insert into diaries values(2735, "2019-01-08"); +insert into diaries values(2736, "2019-01-09"); +insert into diaries values(2737, "2019-01-10"); +insert into diaries values(2738, "2019-01-11"); +insert into diaries values(2739, "2019-01-12"); +insert into diaries values(2740, "2019-01-13"); +insert into diaries values(2741, "2019-01-14"); +insert into diaries values(2742, "2019-01-15"); +insert into diaries values(2743, "2019-01-16"); +insert into diaries values(2744, "2019-01-17"); +insert into diaries values(2745, "2019-01-18"); +insert into diaries values(2746, "2019-01-19"); +insert into diaries values(2747, "2019-01-20"); +insert into diaries values(2748, "2019-01-21"); +insert into diaries values(2749, "2019-01-22"); +insert into diaries values(2750, "2019-01-23"); +insert into diaries values(2751, "2019-01-24"); +insert into diaries values(2752, "2019-01-25"); +insert into diaries values(2753, "2019-01-26"); +insert into diaries values(2754, "2019-01-27"); +insert into diaries values(2755, "2019-01-28"); +insert into diaries values(2756, "2019-01-29"); +insert into diaries values(2757, "2019-01-30"); +insert into diaries values(2758, "2019-01-31"); +insert into diaries values(2759, "2019-02-01"); +insert into diaries values(2760, "2019-02-02"); +insert into diaries values(2761, "2019-02-03"); +insert into diaries values(2762, "2019-02-04"); +insert into diaries values(2763, "2019-02-05"); +insert into diaries values(2764, "2019-02-06"); +insert into diaries values(2765, "2019-02-07"); +insert into diaries values(2766, "2019-02-08"); +insert into diaries values(2767, "2019-02-09"); +insert into diaries values(2768, "2019-02-10"); +insert into diaries values(2769, "2019-02-11"); +insert into diaries values(2770, "2019-02-12"); +insert into diaries values(2771, "2019-02-13"); +insert into diaries values(2772, "2019-02-14"); +insert into diaries values(2773, "2019-02-15"); +insert into diaries values(2774, "2019-02-16"); +insert into diaries values(2775, "2019-02-17"); +insert into diaries values(2776, "2019-02-18"); +insert into diaries values(2777, "2019-02-19"); +insert into diaries values(2778, "2019-02-20"); +insert into diaries values(2779, "2019-02-21"); +insert into diaries values(2780, "2019-02-22"); +insert into diaries values(2781, "2019-02-23"); +insert into diaries values(2782, "2019-02-24"); +insert into diaries values(2783, "2019-02-25"); +insert into diaries values(2784, "2019-02-26"); +insert into diaries values(2785, "2019-02-27"); +insert into diaries values(2786, "2019-02-28"); +insert into diaries values(2787, "2019-03-01"); +insert into diaries values(2788, "2019-03-02"); +insert into diaries values(2789, "2019-03-03"); +insert into diaries values(2790, "2019-03-04"); +insert into diaries values(2791, "2019-03-05"); +insert into diaries values(2792, "2019-03-06"); +insert into diaries values(2793, "2019-03-07"); +insert into diaries values(2794, "2019-03-08"); +insert into diaries values(2795, "2019-03-09"); +insert into diaries values(2796, "2019-03-10"); +insert into diaries values(2797, "2019-03-11"); +insert into diaries values(2798, "2019-03-12"); +insert into diaries values(2799, "2019-03-13"); +insert into diaries values(2800, "2019-03-14"); +insert into diaries values(2801, "2019-03-15"); +insert into diaries values(2802, "2019-03-16"); +insert into diaries values(2803, "2019-03-17"); +insert into diaries values(2804, "2019-03-18"); +insert into diaries values(2805, "2019-03-19"); +insert into diaries values(2806, "2019-03-20"); +insert into diaries values(2807, "2019-03-21"); +insert into diaries values(2808, "2019-03-22"); +insert into diaries values(2809, "2019-03-23"); +insert into diaries values(2810, "2019-03-24"); +insert into diaries values(2811, "2019-03-25"); +insert into diaries values(2812, "2019-03-26"); +insert into diaries values(2813, "2019-03-27"); +insert into diaries values(2814, "2019-03-28"); +insert into diaries values(2815, "2019-03-29"); +insert into diaries values(2816, "2019-03-30"); +insert into diaries values(2817, "2019-03-31"); +insert into diaries values(2818, "2019-04-01"); +insert into diaries values(2819, "2019-04-02"); +insert into diaries values(2820, "2019-04-03"); +insert into diaries values(2821, "2019-04-04"); +insert into diaries values(2822, "2019-04-05"); +insert into diaries values(2823, "2019-04-06"); +insert into diaries values(2824, "2019-04-07"); +insert into diaries values(2825, "2019-04-08"); +insert into diaries values(2826, "2019-04-09"); +insert into diaries values(2827, "2019-04-10"); +insert into diaries values(2828, "2019-04-11"); +insert into diaries values(2829, "2019-04-12"); +insert into diaries values(2830, "2019-04-13"); +insert into diaries values(2831, "2019-04-14"); +insert into diaries values(2832, "2019-04-15"); +insert into diaries values(2833, "2019-04-16"); +insert into diaries values(2834, "2019-04-17"); +insert into diaries values(2835, "2019-04-18"); +insert into diaries values(2836, "2019-04-19"); +insert into diaries values(2837, "2019-04-20"); +insert into diaries values(2838, "2019-04-21"); +insert into diaries values(2839, "2019-04-22"); +insert into diaries values(2840, "2019-04-23"); +insert into diaries values(2841, "2019-04-24"); +insert into diaries values(2842, "2019-04-25"); +insert into diaries values(2843, "2019-04-26"); +insert into diaries values(2844, "2019-04-27"); +insert into diaries values(2845, "2019-04-28"); +insert into diaries values(2846, "2019-04-29"); +insert into diaries values(2847, "2019-04-30"); +insert into diaries values(2848, "2019-05-01"); +insert into diaries values(2849, "2019-05-02"); +insert into diaries values(2850, "2019-05-03"); +insert into diaries values(2851, "2019-05-04"); +insert into diaries values(2852, "2019-05-05"); +insert into diaries values(2853, "2019-05-06"); +insert into diaries values(2854, "2019-05-07"); +insert into diaries values(2855, "2019-05-08"); +insert into diaries values(2856, "2019-05-09"); +insert into diaries values(2857, "2019-05-10"); +insert into diaries values(2858, "2019-05-11"); +insert into diaries values(2859, "2019-05-12"); +insert into diaries values(2860, "2019-05-13"); +insert into diaries values(2861, "2019-05-14"); +insert into diaries values(2862, "2019-05-15"); +insert into diaries values(2863, "2019-05-16"); +insert into diaries values(2864, "2019-05-17"); +insert into diaries values(2865, "2019-05-18"); +insert into diaries values(2866, "2019-05-19"); +insert into diaries values(2867, "2019-05-20"); +insert into diaries values(2868, "2019-05-21"); +insert into diaries values(2869, "2019-05-22"); +insert into diaries values(2870, "2019-05-23"); +insert into diaries values(2871, "2019-05-24"); +insert into diaries values(2872, "2019-05-25"); +insert into diaries values(2873, "2019-05-26"); +insert into diaries values(2874, "2019-05-27"); +insert into diaries values(2875, "2019-05-28"); +insert into diaries values(2876, "2019-05-29"); +insert into diaries values(2877, "2019-05-30"); +insert into diaries values(2878, "2019-05-31"); +insert into diaries values(2879, "2019-06-01"); +insert into diaries values(2880, "2019-06-02"); +insert into diaries values(2881, "2019-06-03"); +insert into diaries values(2882, "2019-06-04"); +insert into diaries values(2883, "2019-06-05"); +insert into diaries values(2884, "2019-06-06"); +insert into diaries values(2885, "2019-06-07"); +insert into diaries values(2886, "2019-06-08"); +insert into diaries values(2887, "2019-06-09"); +insert into diaries values(2888, "2019-06-10"); +insert into diaries values(2889, "2019-06-11"); +insert into diaries values(2890, "2019-06-12"); +insert into diaries values(2891, "2019-06-13"); +insert into diaries values(2892, "2019-06-14"); +insert into diaries values(2893, "2019-06-15"); +insert into diaries values(2894, "2019-06-16"); +insert into diaries values(2895, "2019-06-17"); +insert into diaries values(2896, "2019-06-18"); +insert into diaries values(2897, "2019-06-19"); +insert into diaries values(2898, "2019-06-20"); +insert into diaries values(2899, "2019-06-21"); +insert into diaries values(2900, "2019-06-22"); +insert into diaries values(2901, "2019-06-23"); +insert into diaries values(2902, "2019-06-24"); +insert into diaries values(2903, "2019-06-25"); +insert into diaries values(2904, "2019-06-26"); +insert into diaries values(2905, "2019-06-27"); +insert into diaries values(2906, "2019-06-28"); +insert into diaries values(2907, "2019-06-29"); +insert into diaries values(2908, "2019-06-30"); +insert into diaries values(2909, "2019-07-01"); +insert into diaries values(2910, "2019-07-02"); +insert into diaries values(2911, "2019-07-03"); +insert into diaries values(2912, "2019-07-04"); +insert into diaries values(2913, "2019-07-05"); +insert into diaries values(2914, "2019-07-06"); +insert into diaries values(2915, "2019-07-07"); +insert into diaries values(2916, "2019-07-08"); +insert into diaries values(2917, "2019-07-09"); +insert into diaries values(2918, "2019-07-10"); +insert into diaries values(2919, "2019-07-11"); +insert into diaries values(2920, "2019-07-12"); +insert into diaries values(2921, "2019-07-13"); +insert into diaries values(2922, "2019-07-14"); +insert into diaries values(2923, "2019-07-15"); +insert into diaries values(2924, "2019-07-16"); +insert into diaries values(2925, "2019-07-17"); +insert into diaries values(2926, "2019-07-18"); +insert into diaries values(2927, "2019-07-19"); +insert into diaries values(2928, "2019-07-20"); +insert into diaries values(2929, "2019-07-21"); +insert into diaries values(2930, "2019-07-22"); +insert into diaries values(2931, "2019-07-23"); +insert into diaries values(2932, "2019-07-24"); +insert into diaries values(2933, "2019-07-25"); +insert into diaries values(2934, "2019-07-26"); +insert into diaries values(2935, "2019-07-27"); +insert into diaries values(2936, "2019-07-28"); +insert into diaries values(2937, "2019-07-29"); +insert into diaries values(2938, "2019-07-30"); +insert into diaries values(2939, "2019-07-31"); +insert into diaries values(2940, "2019-08-01"); +insert into diaries values(2941, "2019-08-02"); +insert into diaries values(2942, "2019-08-03"); +insert into diaries values(2943, "2019-08-04"); +insert into diaries values(2944, "2019-08-05"); +insert into diaries values(2945, "2019-08-06"); +insert into diaries values(2946, "2019-08-07"); +insert into diaries values(2947, "2019-08-08"); +insert into diaries values(2948, "2019-08-09"); +insert into diaries values(2949, "2019-08-10"); +insert into diaries values(2950, "2019-08-11"); +insert into diaries values(2951, "2019-08-12"); +insert into diaries values(2952, "2019-08-13"); +insert into diaries values(2953, "2019-08-14"); +insert into diaries values(2954, "2019-08-15"); +insert into diaries values(2955, "2019-08-16"); +insert into diaries values(2956, "2019-08-17"); +insert into diaries values(2957, "2019-08-18"); +insert into diaries values(2958, "2019-08-19"); +insert into diaries values(2959, "2019-08-20"); +insert into diaries values(2960, "2019-08-21"); +insert into diaries values(2961, "2019-08-22"); +insert into diaries values(2962, "2019-08-23"); +insert into diaries values(2963, "2019-08-24"); +insert into diaries values(2964, "2019-08-25"); +insert into diaries values(2965, "2019-08-26"); +insert into diaries values(2966, "2019-08-27"); +insert into diaries values(2967, "2019-08-28"); +insert into diaries values(2968, "2019-08-29"); +insert into diaries values(2969, "2019-08-30"); +insert into diaries values(2970, "2019-08-31"); +insert into diaries values(2971, "2019-09-01"); +insert into diaries values(2972, "2019-09-02"); +insert into diaries values(2973, "2019-09-03"); +insert into diaries values(2974, "2019-09-04"); +insert into diaries values(2975, "2019-09-05"); +insert into diaries values(2976, "2019-09-06"); +insert into diaries values(2977, "2019-09-07"); +insert into diaries values(2978, "2019-09-08"); +insert into diaries values(2979, "2019-09-09"); +insert into diaries values(2980, "2019-09-10"); +insert into diaries values(2981, "2019-09-11"); +insert into diaries values(2982, "2019-09-12"); +insert into diaries values(2983, "2019-09-13"); +insert into diaries values(2984, "2019-09-14"); +insert into diaries values(2985, "2019-09-15"); +insert into diaries values(2986, "2019-09-16"); +insert into diaries values(2987, "2019-09-17"); +insert into diaries values(2988, "2019-09-18"); +insert into diaries values(2989, "2019-09-19"); +insert into diaries values(2990, "2019-09-20"); +insert into diaries values(2991, "2019-09-21"); +insert into diaries values(2992, "2019-09-22"); +insert into diaries values(2993, "2019-09-23"); +insert into diaries values(2994, "2019-09-24"); +insert into diaries values(2995, "2019-09-25"); +insert into diaries values(2996, "2019-09-26"); +insert into diaries values(2997, "2019-09-27"); +insert into diaries values(2998, "2019-09-28"); +insert into diaries values(2999, "2019-09-29"); +insert into diaries values(3000, "2019-09-30"); +insert into diaries values(3001, "2019-10-01"); +insert into diaries values(3002, "2019-10-02"); +insert into diaries values(3003, "2019-10-03"); +insert into diaries values(3004, "2019-10-04"); +insert into diaries values(3005, "2019-10-05"); +insert into diaries values(3006, "2019-10-06"); +insert into diaries values(3007, "2019-10-07"); +insert into diaries values(3008, "2019-10-08"); +insert into diaries values(3009, "2019-10-09"); +insert into diaries values(3010, "2019-10-10"); +insert into diaries values(3011, "2019-10-11"); +insert into diaries values(3012, "2019-10-12"); +insert into diaries values(3013, "2019-10-13"); +insert into diaries values(3014, "2019-10-14"); +insert into diaries values(3015, "2019-10-15"); +insert into diaries values(3016, "2019-10-16"); +insert into diaries values(3017, "2019-10-17"); +insert into diaries values(3018, "2019-10-18"); +insert into diaries values(3019, "2019-10-19"); +insert into diaries values(3020, "2019-10-20"); +insert into diaries values(3021, "2019-10-21"); +insert into diaries values(3022, "2019-10-22"); +insert into diaries values(3023, "2019-10-23"); +insert into diaries values(3024, "2019-10-24"); +insert into diaries values(3025, "2019-10-25"); +insert into diaries values(3026, "2019-10-26"); +insert into diaries values(3027, "2019-10-27"); +insert into diaries values(3028, "2019-10-28"); +insert into diaries values(3029, "2019-10-29"); +insert into diaries values(3030, "2019-10-30"); +insert into diaries values(3031, "2019-10-31"); +insert into diaries values(3032, "2019-11-01"); +insert into diaries values(3033, "2019-11-02"); +insert into diaries values(3034, "2019-11-03"); +insert into diaries values(3035, "2019-11-04"); +insert into diaries values(3036, "2019-11-05"); +insert into diaries values(3037, "2019-11-06"); +insert into diaries values(3038, "2019-11-07"); +insert into diaries values(3039, "2019-11-08"); +insert into diaries values(3040, "2019-11-09"); +insert into diaries values(3041, "2019-11-10"); +insert into diaries values(3042, "2019-11-11"); +insert into diaries values(3043, "2019-11-12"); +insert into diaries values(3044, "2019-11-13"); +insert into diaries values(3045, "2019-11-14"); +insert into diaries values(3046, "2019-11-15"); +insert into diaries values(3047, "2019-11-16"); +insert into diaries values(3048, "2019-11-17"); +insert into diaries values(3049, "2019-11-18"); +insert into diaries values(3050, "2019-11-19"); +insert into diaries values(3051, "2019-11-20"); +insert into diaries values(3052, "2019-11-21"); +insert into diaries values(3053, "2019-11-22"); +insert into diaries values(3054, "2019-11-23"); +insert into diaries values(3055, "2019-11-24"); +insert into diaries values(3056, "2019-11-25"); +insert into diaries values(3057, "2019-11-26"); +insert into diaries values(3058, "2019-11-27"); +insert into diaries values(3059, "2019-11-28"); +insert into diaries values(3060, "2019-11-29"); +insert into diaries values(3061, "2019-11-30"); +insert into diaries values(3062, "2019-12-01"); +insert into diaries values(3063, "2019-12-02"); +insert into diaries values(3064, "2019-12-03"); +insert into diaries values(3065, "2019-12-04"); +insert into diaries values(3066, "2019-12-05"); +insert into diaries values(3067, "2019-12-06"); +insert into diaries values(3068, "2019-12-07"); +insert into diaries values(3069, "2019-12-08"); +insert into diaries values(3070, "2019-12-09"); +insert into diaries values(3071, "2019-12-10"); +insert into diaries values(3072, "2019-12-11"); +insert into diaries values(3073, "2019-12-12"); +insert into diaries values(3074, "2019-12-13"); +insert into diaries values(3075, "2019-12-14"); +insert into diaries values(3076, "2019-12-15"); +insert into diaries values(3077, "2019-12-16"); +insert into diaries values(3078, "2019-12-17"); +insert into diaries values(3079, "2019-12-18"); +insert into diaries values(3080, "2019-12-19"); +insert into diaries values(3081, "2019-12-20"); +insert into diaries values(3082, "2019-12-21"); +insert into diaries values(3083, "2019-12-22"); +insert into diaries values(3084, "2019-12-23"); +insert into diaries values(3085, "2019-12-24"); +insert into diaries values(3086, "2019-12-25"); +insert into diaries values(3087, "2019-12-26"); +insert into diaries values(3088, "2019-12-27"); +insert into diaries values(3089, "2019-12-28"); +insert into diaries values(3090, "2019-12-29"); +insert into diaries values(3091, "2019-12-30"); +insert into diaries values(3092, "2019-12-31"); +insert into diaries values(3093, "2020-01-01"); +insert into diaries values(3094, "2020-01-02"); +insert into diaries values(3095, "2020-01-03"); +insert into diaries values(3096, "2020-01-04"); +insert into diaries values(3097, "2020-01-05"); +insert into diaries values(3098, "2020-01-06"); +insert into diaries values(3099, "2020-01-07"); +insert into diaries values(3100, "2020-01-08"); +insert into diaries values(3101, "2020-01-09"); +insert into diaries values(3102, "2020-01-10"); +insert into diaries values(3103, "2020-01-11"); +insert into diaries values(3104, "2020-01-12"); +insert into diaries values(3105, "2020-01-13"); +insert into diaries values(3106, "2020-01-14"); +insert into diaries values(3107, "2020-01-15"); +insert into diaries values(3108, "2020-01-16"); +insert into diaries values(3109, "2020-01-17"); +insert into diaries values(3110, "2020-01-18"); +insert into diaries values(3111, "2020-01-19"); +insert into diaries values(3112, "2020-01-20"); +insert into diaries values(3113, "2020-01-21"); +insert into diaries values(3114, "2020-01-22"); +insert into diaries values(3115, "2020-01-23"); +insert into diaries values(3116, "2020-01-24"); +insert into diaries values(3117, "2020-01-25"); +insert into diaries values(3118, "2020-01-26"); +insert into diaries values(3119, "2020-01-27"); +insert into diaries values(3120, "2020-01-28"); +insert into diaries values(3121, "2020-01-29"); +insert into diaries values(3122, "2020-01-30"); +insert into diaries values(3123, "2020-01-31"); +insert into diaries values(3124, "2020-02-01"); +insert into diaries values(3125, "2020-02-02"); +insert into diaries values(3126, "2020-02-03"); +insert into diaries values(3127, "2020-02-04"); +insert into diaries values(3128, "2020-02-05"); +insert into diaries values(3129, "2020-02-06"); +insert into diaries values(3130, "2020-02-07"); +insert into diaries values(3131, "2020-02-08"); +insert into diaries values(3132, "2020-02-09"); +insert into diaries values(3133, "2020-02-10"); +insert into diaries values(3134, "2020-02-11"); +insert into diaries values(3135, "2020-02-12"); +insert into diaries values(3136, "2020-02-13"); +insert into diaries values(3137, "2020-02-14"); +insert into diaries values(3138, "2020-02-15"); +insert into diaries values(3139, "2020-02-16"); +insert into diaries values(3140, "2020-02-17"); +insert into diaries values(3141, "2020-02-18"); +insert into diaries values(3142, "2020-02-19"); +insert into diaries values(3143, "2020-02-20"); +insert into diaries values(3144, "2020-02-21"); +insert into diaries values(3145, "2020-02-22"); +insert into diaries values(3146, "2020-02-23"); +insert into diaries values(3147, "2020-02-24"); +insert into diaries values(3148, "2020-02-25"); +insert into diaries values(3149, "2020-02-26"); +insert into diaries values(3150, "2020-02-27"); +insert into diaries values(3151, "2020-02-28"); +insert into diaries values(3152, "2020-02-29"); +insert into diaries values(3153, "2020-03-01"); +insert into diaries values(3154, "2020-03-02"); +insert into diaries values(3155, "2020-03-03"); +insert into diaries values(3156, "2020-03-04"); +insert into diaries values(3157, "2020-03-05"); +insert into diaries values(3158, "2020-03-06"); +insert into diaries values(3159, "2020-03-07"); +insert into diaries values(3160, "2020-03-08"); +insert into diaries values(3161, "2020-03-09"); +insert into diaries values(3162, "2020-03-10"); +insert into diaries values(3163, "2020-03-11"); +insert into diaries values(3164, "2020-03-12"); +insert into diaries values(3165, "2020-03-13"); +insert into diaries values(3166, "2020-03-14"); +insert into diaries values(3167, "2020-03-15"); +insert into diaries values(3168, "2020-03-16"); +insert into diaries values(3169, "2020-03-17"); +insert into diaries values(3170, "2020-03-18"); +insert into diaries values(3171, "2020-03-19"); +insert into diaries values(3172, "2020-03-20"); +insert into diaries values(3173, "2020-03-21"); +insert into diaries values(3174, "2020-03-22"); +insert into diaries values(3175, "2020-03-23"); +insert into diaries values(3176, "2020-03-24"); +insert into diaries values(3177, "2020-03-25"); +insert into diaries values(3178, "2020-03-26"); +insert into diaries values(3179, "2020-03-27"); +insert into diaries values(3180, "2020-03-28"); +insert into diaries values(3181, "2020-03-29"); +insert into diaries values(3182, "2020-03-30"); +insert into diaries values(3183, "2020-03-31"); +insert into diaries values(3184, "2020-04-01"); +insert into diaries values(3185, "2020-04-02"); +insert into diaries values(3186, "2020-04-03"); +insert into diaries values(3187, "2020-04-04"); +insert into diaries values(3188, "2020-04-05"); +insert into diaries values(3189, "2020-04-06"); +insert into diaries values(3190, "2020-04-07"); +insert into diaries values(3191, "2020-04-08"); +insert into diaries values(3192, "2020-04-09"); +insert into diaries values(3193, "2020-04-10"); +insert into diaries values(3194, "2020-04-11"); +insert into diaries values(3195, "2020-04-12"); +insert into diaries values(3196, "2020-04-13"); +insert into diaries values(3197, "2020-04-14"); +insert into diaries values(3198, "2020-04-15"); +insert into diaries values(3199, "2020-04-16"); +insert into diaries values(3200, "2020-04-17"); +insert into diaries values(3201, "2020-04-18"); +insert into diaries values(3202, "2020-04-19"); +insert into diaries values(3203, "2020-04-20"); +insert into diaries values(3204, "2020-04-21"); +insert into diaries values(3205, "2020-04-22"); +insert into diaries values(3206, "2020-04-23"); +insert into diaries values(3207, "2020-04-24"); +insert into diaries values(3208, "2020-04-25"); +insert into diaries values(3209, "2020-04-26"); +insert into diaries values(3210, "2020-04-27"); +insert into diaries values(3211, "2020-04-28"); +insert into diaries values(3212, "2020-04-29"); +insert into diaries values(3213, "2020-04-30"); +insert into diaries values(3214, "2020-05-01"); +insert into diaries values(3215, "2020-05-02"); +insert into diaries values(3216, "2020-05-03"); +insert into diaries values(3217, "2020-05-04"); +insert into diaries values(3218, "2020-05-05"); +insert into diaries values(3219, "2020-05-06"); +insert into diaries values(3220, "2020-05-07"); +insert into diaries values(3221, "2020-05-08"); +insert into diaries values(3222, "2020-05-09"); +insert into diaries values(3223, "2020-05-10"); +insert into diaries values(3224, "2020-05-11"); +insert into diaries values(3225, "2020-05-12"); +insert into diaries values(3226, "2020-05-13"); +insert into diaries values(3227, "2020-05-14"); +insert into diaries values(3228, "2020-05-15"); +insert into diaries values(3229, "2020-05-16"); +insert into diaries values(3230, "2020-05-17"); +insert into diaries values(3231, "2020-05-18"); +insert into diaries values(3232, "2020-05-19"); +insert into diaries values(3233, "2020-05-20"); +insert into diaries values(3234, "2020-05-21"); +insert into diaries values(3235, "2020-05-22"); +insert into diaries values(3236, "2020-05-23"); +insert into diaries values(3237, "2020-05-24"); +insert into diaries values(3238, "2020-05-25"); +insert into diaries values(3239, "2020-05-26"); +insert into diaries values(3240, "2020-05-27"); +insert into diaries values(3241, "2020-05-28"); +insert into diaries values(3242, "2020-05-29"); +insert into diaries values(3243, "2020-05-30"); +insert into diaries values(3244, "2020-05-31"); +insert into diaries values(3245, "2020-06-01"); +insert into diaries values(3246, "2020-06-02"); +insert into diaries values(3247, "2020-06-03"); +insert into diaries values(3248, "2020-06-04"); +insert into diaries values(3249, "2020-06-05"); +insert into diaries values(3250, "2020-06-06"); +insert into diaries values(3251, "2020-06-07"); +insert into diaries values(3252, "2020-06-08"); +insert into diaries values(3253, "2020-06-09"); +insert into diaries values(3254, "2020-06-10"); +insert into diaries values(3255, "2020-06-11"); +insert into diaries values(3256, "2020-06-12"); +insert into diaries values(3257, "2020-06-13"); +insert into diaries values(3258, "2020-06-14"); +insert into diaries values(3259, "2020-06-15"); +insert into diaries values(3260, "2020-06-16"); +insert into diaries values(3261, "2020-06-17"); +insert into diaries values(3262, "2020-06-18"); +insert into diaries values(3263, "2020-06-19"); +insert into diaries values(3264, "2020-06-20"); +insert into diaries values(3265, "2020-06-21"); +insert into diaries values(3266, "2020-06-22"); +insert into diaries values(3267, "2020-06-23"); +insert into diaries values(3268, "2020-06-24"); +insert into diaries values(3269, "2020-06-25"); +insert into diaries values(3270, "2020-06-26"); +insert into diaries values(3271, "2020-06-27"); +insert into diaries values(3272, "2020-06-28"); +insert into diaries values(3273, "2020-06-29"); +insert into diaries values(3274, "2020-06-30"); +insert into diaries values(3275, "2020-07-01"); +insert into diaries values(3276, "2020-07-02"); +insert into diaries values(3277, "2020-07-03"); +insert into diaries values(3278, "2020-07-04"); +insert into diaries values(3279, "2020-07-05"); +insert into diaries values(3280, "2020-07-06"); +insert into diaries values(3281, "2020-07-07"); +insert into diaries values(3282, "2020-07-08"); +insert into diaries values(3283, "2020-07-09"); +insert into diaries values(3284, "2020-07-10"); +insert into diaries values(3285, "2020-07-11"); +insert into diaries values(3286, "2020-07-12"); +insert into diaries values(3287, "2020-07-13"); +insert into diaries values(3288, "2020-07-14"); +insert into diaries values(3289, "2020-07-15"); +insert into diaries values(3290, "2020-07-16"); +insert into diaries values(3291, "2020-07-17"); +insert into diaries values(3292, "2020-07-18"); +insert into diaries values(3293, "2020-07-19"); +insert into diaries values(3294, "2020-07-20"); +insert into diaries values(3295, "2020-07-21"); +insert into diaries values(3296, "2020-07-22"); +insert into diaries values(3297, "2020-07-23"); +insert into diaries values(3298, "2020-07-24"); +insert into diaries values(3299, "2020-07-25"); +insert into diaries values(3300, "2020-07-26"); +insert into diaries values(3301, "2020-07-27"); +insert into diaries values(3302, "2020-07-28"); +insert into diaries values(3303, "2020-07-29"); +insert into diaries values(3304, "2020-07-30"); +insert into diaries values(3305, "2020-07-31"); +insert into diaries values(3306, "2020-08-01"); +insert into diaries values(3307, "2020-08-02"); +insert into diaries values(3308, "2020-08-03"); +insert into diaries values(3309, "2020-08-04"); +insert into diaries values(3310, "2020-08-05"); +insert into diaries values(3311, "2020-08-06"); +insert into diaries values(3312, "2020-08-07"); +insert into diaries values(3313, "2020-08-08"); +insert into diaries values(3314, "2020-08-09"); +insert into diaries values(3315, "2020-08-10"); +insert into diaries values(3316, "2020-08-11"); +insert into diaries values(3317, "2020-08-12"); +insert into diaries values(3318, "2020-08-13"); +insert into diaries values(3319, "2020-08-14"); +insert into diaries values(3320, "2020-08-15"); +insert into diaries values(3321, "2020-08-16"); +insert into diaries values(3322, "2020-08-17"); +insert into diaries values(3323, "2020-08-18"); +insert into diaries values(3324, "2020-08-19"); +insert into diaries values(3325, "2020-08-20"); +insert into diaries values(3326, "2020-08-21"); +insert into diaries values(3327, "2020-08-22"); +insert into diaries values(3328, "2020-08-23"); +insert into diaries values(3329, "2020-08-24"); +insert into diaries values(3330, "2020-08-25"); +insert into diaries values(3331, "2020-08-26"); +insert into diaries values(3332, "2020-08-27"); +insert into diaries values(3333, "2020-08-28"); +insert into diaries values(3334, "2020-08-29"); +insert into diaries values(3335, "2020-08-30"); +insert into diaries values(3336, "2020-08-31"); +insert into diaries values(3337, "2020-09-01"); +insert into diaries values(3338, "2020-09-02"); +insert into diaries values(3339, "2020-09-03"); +insert into diaries values(3340, "2020-09-04"); +insert into diaries values(3341, "2020-09-05"); +insert into diaries values(3342, "2020-09-06"); +insert into diaries values(3343, "2020-09-07"); +insert into diaries values(3344, "2020-09-08"); +insert into diaries values(3345, "2020-09-09"); +insert into diaries values(3346, "2020-09-10"); +insert into diaries values(3347, "2020-09-11"); +insert into diaries values(3348, "2020-09-12"); +insert into diaries values(3349, "2020-09-13"); +insert into diaries values(3350, "2020-09-14"); +insert into diaries values(3351, "2020-09-15"); +insert into diaries values(3352, "2020-09-16"); +insert into diaries values(3353, "2020-09-17"); +insert into diaries values(3354, "2020-09-18"); +insert into diaries values(3355, "2020-09-19"); +insert into diaries values(3356, "2020-09-20"); +insert into diaries values(3357, "2020-09-21"); +insert into diaries values(3358, "2020-09-22"); +insert into diaries values(3359, "2020-09-23"); +insert into diaries values(3360, "2020-09-24"); +insert into diaries values(3361, "2020-09-25"); +insert into diaries values(3362, "2020-09-26"); +insert into diaries values(3363, "2020-09-27"); +insert into diaries values(3364, "2020-09-28"); +insert into diaries values(3365, "2020-09-29"); +insert into diaries values(3366, "2020-09-30"); +insert into diaries values(3367, "2020-10-01"); +insert into diaries values(3368, "2020-10-02"); +insert into diaries values(3369, "2020-10-03"); +insert into diaries values(3370, "2020-10-04"); +insert into diaries values(3371, "2020-10-05"); +insert into diaries values(3372, "2020-10-06"); +insert into diaries values(3373, "2020-10-07"); +insert into diaries values(3374, "2020-10-08"); +insert into diaries values(3375, "2020-10-09"); +insert into diaries values(3376, "2020-10-10"); +insert into diaries values(3377, "2020-10-11"); +insert into diaries values(3378, "2020-10-12"); +insert into diaries values(3379, "2020-10-13"); +insert into diaries values(3380, "2020-10-14"); +insert into diaries values(3381, "2020-10-15"); +insert into diaries values(3382, "2020-10-16"); +insert into diaries values(3383, "2020-10-17"); +insert into diaries values(3384, "2020-10-18"); +insert into diaries values(3385, "2020-10-19"); +insert into diaries values(3386, "2020-10-20"); +insert into diaries values(3387, "2020-10-21"); +insert into diaries values(3388, "2020-10-22"); +insert into diaries values(3389, "2020-10-23"); +insert into diaries values(3390, "2020-10-24"); +insert into diaries values(3391, "2020-10-25"); +insert into diaries values(3392, "2020-10-26"); +insert into diaries values(3393, "2020-10-27"); +insert into diaries values(3394, "2020-10-28"); +insert into diaries values(3395, "2020-10-29"); +insert into diaries values(3396, "2020-10-30"); +insert into diaries values(3397, "2020-10-31"); +insert into diaries values(3398, "2020-11-01"); +insert into diaries values(3399, "2020-11-02"); +insert into diaries values(3400, "2020-11-03"); +insert into diaries values(3401, "2020-11-04"); +insert into diaries values(3402, "2020-11-05"); +insert into diaries values(3403, "2020-11-06"); +insert into diaries values(3404, "2020-11-07"); +insert into diaries values(3405, "2020-11-08"); +insert into diaries values(3406, "2020-11-09"); +insert into diaries values(3407, "2020-11-10"); +insert into diaries values(3408, "2020-11-11"); +insert into diaries values(3409, "2020-11-12"); +insert into diaries values(3410, "2020-11-13"); +insert into diaries values(3411, "2020-11-14"); +insert into diaries values(3412, "2020-11-15"); +insert into diaries values(3413, "2020-11-16"); +insert into diaries values(3414, "2020-11-17"); +insert into diaries values(3415, "2020-11-18"); +insert into diaries values(3416, "2020-11-19"); +insert into diaries values(3417, "2020-11-20"); +insert into diaries values(3418, "2020-11-21"); +insert into diaries values(3419, "2020-11-22"); +insert into diaries values(3420, "2020-11-23"); +insert into diaries values(3421, "2020-11-24"); +insert into diaries values(3422, "2020-11-25"); +insert into diaries values(3423, "2020-11-26"); +insert into diaries values(3424, "2020-11-27"); +insert into diaries values(3425, "2020-11-28"); +insert into diaries values(3426, "2020-11-29"); +insert into diaries values(3427, "2020-11-30"); +insert into diaries values(3428, "2020-12-01"); +insert into diaries values(3429, "2020-12-02"); +insert into diaries values(3430, "2020-12-03"); +insert into diaries values(3431, "2020-12-04"); +insert into diaries values(3432, "2020-12-05"); +insert into diaries values(3433, "2020-12-06"); +insert into diaries values(3434, "2020-12-07"); +insert into diaries values(3435, "2020-12-08"); +insert into diaries values(3436, "2020-12-09"); +insert into diaries values(3437, "2020-12-10"); +insert into diaries values(3438, "2020-12-11"); +insert into diaries values(3439, "2020-12-12"); +insert into diaries values(3440, "2020-12-13"); +insert into diaries values(3441, "2020-12-14"); +insert into diaries values(3442, "2020-12-15"); +insert into diaries values(3443, "2020-12-16"); +insert into diaries values(3444, "2020-12-17"); +insert into diaries values(3445, "2020-12-18"); +insert into diaries values(3446, "2020-12-19"); +insert into diaries values(3447, "2020-12-20"); +insert into diaries values(3448, "2020-12-21"); +insert into diaries values(3449, "2020-12-22"); +insert into diaries values(3450, "2020-12-23"); +insert into diaries values(3451, "2020-12-24"); +insert into diaries values(3452, "2020-12-25"); +insert into diaries values(3453, "2020-12-26"); +insert into diaries values(3454, "2020-12-27"); +insert into diaries values(3455, "2020-12-28"); +insert into diaries values(3456, "2020-12-29"); +insert into diaries values(3457, "2020-12-30"); +insert into diaries values(3458, "2020-12-31"); +insert into diaries values(3459, "2021-01-01"); +insert into diaries values(3460, "2021-01-02"); +insert into diaries values(3461, "2021-01-03"); +insert into diaries values(3462, "2021-01-04"); +insert into diaries values(3463, "2021-01-05"); +insert into diaries values(3464, "2021-01-06"); +insert into diaries values(3465, "2021-01-07"); +insert into diaries values(3466, "2021-01-08"); +insert into diaries values(3467, "2021-01-09"); +insert into diaries values(3468, "2021-01-10"); +insert into diaries values(3469, "2021-01-11"); +insert into diaries values(3470, "2021-01-12"); +insert into diaries values(3471, "2021-01-13"); +insert into diaries values(3472, "2021-01-14"); +insert into diaries values(3473, "2021-01-15"); +insert into diaries values(3474, "2021-01-16"); +insert into diaries values(3475, "2021-01-17"); +insert into diaries values(3476, "2021-01-18"); +insert into diaries values(3477, "2021-01-19"); +insert into diaries values(3478, "2021-01-20"); +insert into diaries values(3479, "2021-01-21"); +insert into diaries values(3480, "2021-01-22"); +insert into diaries values(3481, "2021-01-23"); +insert into diaries values(3482, "2021-01-24"); +insert into diaries values(3483, "2021-01-25"); +insert into diaries values(3484, "2021-01-26"); +insert into diaries values(3485, "2021-01-27"); +insert into diaries values(3486, "2021-01-28"); +insert into diaries values(3487, "2021-01-29"); +insert into diaries values(3488, "2021-01-30"); +insert into diaries values(3489, "2021-01-31"); +insert into diaries values(3490, "2021-02-01"); +insert into diaries values(3491, "2021-02-02"); +insert into diaries values(3492, "2021-02-03"); +insert into diaries values(3493, "2021-02-04"); +insert into diaries values(3494, "2021-02-05"); +insert into diaries values(3495, "2021-02-06"); +insert into diaries values(3496, "2021-02-07"); +insert into diaries values(3497, "2021-02-08"); +insert into diaries values(3498, "2021-02-09"); +insert into diaries values(3499, "2021-02-10"); +insert into diaries values(3500, "2021-02-11"); +insert into diaries values(3501, "2021-02-12"); +insert into diaries values(3502, "2021-02-13"); +insert into diaries values(3503, "2021-02-14"); +insert into diaries values(3504, "2021-02-15"); +insert into diaries values(3505, "2021-02-16"); +insert into diaries values(3506, "2021-02-17"); +insert into diaries values(3507, "2021-02-18"); +insert into diaries values(3508, "2021-02-19"); +insert into diaries values(3509, "2021-02-20"); +insert into diaries values(3510, "2021-02-21"); +insert into diaries values(3511, "2021-02-22"); +insert into diaries values(3512, "2021-02-23"); +insert into diaries values(3513, "2021-02-24"); +insert into diaries values(3514, "2021-02-25"); +insert into diaries values(3515, "2021-02-26"); +insert into diaries values(3516, "2021-02-27"); +insert into diaries values(3517, "2021-02-28"); +insert into diaries values(3518, "2021-03-01"); +insert into diaries values(3519, "2021-03-02"); +insert into diaries values(3520, "2021-03-03"); +insert into diaries values(3521, "2021-03-04"); +insert into diaries values(3522, "2021-03-05"); +insert into diaries values(3523, "2021-03-06"); +insert into diaries values(3524, "2021-03-07"); +insert into diaries values(3525, "2021-03-08"); +insert into diaries values(3526, "2021-03-09"); +insert into diaries values(3527, "2021-03-10"); +insert into diaries values(3528, "2021-03-11"); +insert into diaries values(3529, "2021-03-12"); +insert into diaries values(3530, "2021-03-13"); +insert into diaries values(3531, "2021-03-14"); +insert into diaries values(3532, "2021-03-15"); +insert into diaries values(3533, "2021-03-16"); +insert into diaries values(3534, "2021-03-17"); +insert into diaries values(3535, "2021-03-18"); +insert into diaries values(3536, "2021-03-19"); +insert into diaries values(3537, "2021-03-20"); +insert into diaries values(3538, "2021-03-21"); +insert into diaries values(3539, "2021-03-22"); +insert into diaries values(3540, "2021-03-23"); +insert into diaries values(3541, "2021-03-24"); +insert into diaries values(3542, "2021-03-25"); +insert into diaries values(3543, "2021-03-26"); +insert into diaries values(3544, "2021-03-27"); +insert into diaries values(3545, "2021-03-28"); +insert into diaries values(3546, "2021-03-29"); +insert into diaries values(3547, "2021-03-30"); +insert into diaries values(3548, "2021-03-31"); +insert into diaries values(3549, "2021-04-01"); +insert into diaries values(3550, "2021-04-02"); +insert into diaries values(3551, "2021-04-03"); +insert into diaries values(3552, "2021-04-04"); +insert into diaries values(3553, "2021-04-05"); +insert into diaries values(3554, "2021-04-06"); +insert into diaries values(3555, "2021-04-07"); +insert into diaries values(3556, "2021-04-08"); +insert into diaries values(3557, "2021-04-09"); +insert into diaries values(3558, "2021-04-10"); +insert into diaries values(3559, "2021-04-11"); +insert into diaries values(3560, "2021-04-12"); +insert into diaries values(3561, "2021-04-13"); +insert into diaries values(3562, "2021-04-14"); +insert into diaries values(3563, "2021-04-15"); +insert into diaries values(3564, "2021-04-16"); +insert into diaries values(3565, "2021-04-17"); +insert into diaries values(3566, "2021-04-18"); +insert into diaries values(3567, "2021-04-19"); +insert into diaries values(3568, "2021-04-20"); +insert into diaries values(3569, "2021-04-21"); +insert into diaries values(3570, "2021-04-22"); +insert into diaries values(3571, "2021-04-23"); +insert into diaries values(3572, "2021-04-24"); +insert into diaries values(3573, "2021-04-25"); +insert into diaries values(3574, "2021-04-26"); +insert into diaries values(3575, "2021-04-27"); +insert into diaries values(3576, "2021-04-28"); +insert into diaries values(3577, "2021-04-29"); +insert into diaries values(3578, "2021-04-30"); +insert into diaries values(3579, "2021-05-01"); +insert into diaries values(3580, "2021-05-02"); +insert into diaries values(3581, "2021-05-03"); +insert into diaries values(3582, "2021-05-04"); +insert into diaries values(3583, "2021-05-05"); +insert into diaries values(3584, "2021-05-06"); +insert into diaries values(3585, "2021-05-07"); +insert into diaries values(3586, "2021-05-08"); +insert into diaries values(3587, "2021-05-09"); +insert into diaries values(3588, "2021-05-10"); +insert into diaries values(3589, "2021-05-11"); +insert into diaries values(3590, "2021-05-12"); +insert into diaries values(3591, "2021-05-13"); +insert into diaries values(3592, "2021-05-14"); +insert into diaries values(3593, "2021-05-15"); +insert into diaries values(3594, "2021-05-16"); +insert into diaries values(3595, "2021-05-17"); +insert into diaries values(3596, "2021-05-18"); +insert into diaries values(3597, "2021-05-19"); +insert into diaries values(3598, "2021-05-20"); +insert into diaries values(3599, "2021-05-21"); +insert into diaries values(3600, "2021-05-22"); +insert into diaries values(3601, "2021-05-23"); +insert into diaries values(3602, "2021-05-24"); +insert into diaries values(3603, "2021-05-25"); +insert into diaries values(3604, "2021-05-26"); +insert into diaries values(3605, "2021-05-27"); +insert into diaries values(3606, "2021-05-28"); +insert into diaries values(3607, "2021-05-29"); +insert into diaries values(3608, "2021-05-30"); +insert into diaries values(3609, "2021-05-31"); +insert into diaries values(3610, "2021-06-01"); +insert into diaries values(3611, "2021-06-02"); +insert into diaries values(3612, "2021-06-03"); +insert into diaries values(3613, "2021-06-04"); +insert into diaries values(3614, "2021-06-05"); +insert into diaries values(3615, "2021-06-06"); +insert into diaries values(3616, "2021-06-07"); +insert into diaries values(3617, "2021-06-08"); +insert into diaries values(3618, "2021-06-09"); +insert into diaries values(3619, "2021-06-10"); +insert into diaries values(3620, "2021-06-11"); +insert into diaries values(3621, "2021-06-12"); +insert into diaries values(3622, "2021-06-13"); +insert into diaries values(3623, "2021-06-14"); +insert into diaries values(3624, "2021-06-15"); +insert into diaries values(3625, "2021-06-16"); +insert into diaries values(3626, "2021-06-17"); +insert into diaries values(3627, "2021-06-18"); +insert into diaries values(3628, "2021-06-19"); +insert into diaries values(3629, "2021-06-20"); +insert into diaries values(3630, "2021-06-21"); +insert into diaries values(3631, "2021-06-22"); +insert into diaries values(3632, "2021-06-23"); +insert into diaries values(3633, "2021-06-24"); +insert into diaries values(3634, "2021-06-25"); +insert into diaries values(3635, "2021-06-26"); +insert into diaries values(3636, "2021-06-27"); +insert into diaries values(3637, "2021-06-28"); +insert into diaries values(3638, "2021-06-29"); +insert into diaries values(3639, "2021-06-30"); +insert into diaries values(3640, "2021-07-01"); +insert into diaries values(3641, "2021-07-02"); +insert into diaries values(3642, "2021-07-03"); +insert into diaries values(3643, "2021-07-04"); +insert into diaries values(3644, "2021-07-05"); +insert into diaries values(3645, "2021-07-06"); +insert into diaries values(3646, "2021-07-07"); +insert into diaries values(3647, "2021-07-08"); +insert into diaries values(3648, "2021-07-09"); +insert into diaries values(3649, "2021-07-10"); +insert into diaries values(3650, "2021-07-11"); +insert into diaries values(3651, "2021-07-12"); +insert into diaries values(3652, "2021-07-13"); +insert into diaries values(3653, "2021-07-14"); +insert into diaries values(3654, "2021-07-15"); +insert into diaries values(3655, "2021-07-16"); +insert into diaries values(3656, "2021-07-17"); +insert into diaries values(3657, "2021-07-18"); +insert into diaries values(3658, "2021-07-19"); +insert into diaries values(3659, "2021-07-20"); +insert into diaries values(3660, "2021-07-21"); +insert into diaries values(3661, "2021-07-22"); +insert into diaries values(3662, "2021-07-23"); +insert into diaries values(3663, "2021-07-24"); +insert into diaries values(3664, "2021-07-25"); +insert into diaries values(3665, "2021-07-26"); +insert into diaries values(3666, "2021-07-27"); +insert into diaries values(3667, "2021-07-28"); +insert into diaries values(3668, "2021-07-29"); +insert into diaries values(3669, "2021-07-30"); +insert into diaries values(3670, "2021-07-31"); +insert into diaries values(3671, "2021-08-01"); +insert into diaries values(3672, "2021-08-02"); +insert into diaries values(3673, "2021-08-03"); +insert into diaries values(3674, "2021-08-04"); +insert into diaries values(3675, "2021-08-05"); +insert into diaries values(3676, "2021-08-06"); +insert into diaries values(3677, "2021-08-07"); +insert into diaries values(3678, "2021-08-08"); +insert into diaries values(3679, "2021-08-09"); +insert into diaries values(3680, "2021-08-10"); +insert into diaries values(3681, "2021-08-11"); +insert into diaries values(3682, "2021-08-12"); +insert into diaries values(3683, "2021-08-13"); +insert into diaries values(3684, "2021-08-14"); +insert into diaries values(3685, "2021-08-15"); +insert into diaries values(3686, "2021-08-16"); +insert into diaries values(3687, "2021-08-17"); +insert into diaries values(3688, "2021-08-18"); +insert into diaries values(3689, "2021-08-19"); +insert into diaries values(3690, "2021-08-20"); +insert into diaries values(3691, "2021-08-21"); +insert into diaries values(3692, "2021-08-22"); +insert into diaries values(3693, "2021-08-23"); +insert into diaries values(3694, "2021-08-24"); +insert into diaries values(3695, "2021-08-25"); +insert into diaries values(3696, "2021-08-26"); +insert into diaries values(3697, "2021-08-27"); +insert into diaries values(3698, "2021-08-28"); +insert into diaries values(3699, "2021-08-29"); +insert into diaries values(3700, "2021-08-30"); +insert into diaries values(3701, "2021-08-31"); +insert into diaries values(3702, "2021-09-01"); +insert into diaries values(3703, "2021-09-02"); +insert into diaries values(3704, "2021-09-03"); +insert into diaries values(3705, "2021-09-04"); +insert into diaries values(3706, "2021-09-05"); +insert into diaries values(3707, "2021-09-06"); +insert into diaries values(3708, "2021-09-07"); +insert into diaries values(3709, "2021-09-08"); +insert into diaries values(3710, "2021-09-09"); +insert into diaries values(3711, "2021-09-10"); +insert into diaries values(3712, "2021-09-11"); +insert into diaries values(3713, "2021-09-12"); +insert into diaries values(3714, "2021-09-13"); +insert into diaries values(3715, "2021-09-14"); +insert into diaries values(3716, "2021-09-15"); +insert into diaries values(3717, "2021-09-16"); +insert into diaries values(3718, "2021-09-17"); +insert into diaries values(3719, "2021-09-18"); +insert into diaries values(3720, "2021-09-19"); +insert into diaries values(3721, "2021-09-20"); +insert into diaries values(3722, "2021-09-21"); +insert into diaries values(3723, "2021-09-22"); +insert into diaries values(3724, "2021-09-23"); +insert into diaries values(3725, "2021-09-24"); +insert into diaries values(3726, "2021-09-25"); +insert into diaries values(3727, "2021-09-26"); +insert into diaries values(3728, "2021-09-27"); +insert into diaries values(3729, "2021-09-28"); +insert into diaries values(3730, "2021-09-29"); +insert into diaries values(3731, "2021-09-30"); +insert into diaries values(3732, "2021-10-01"); +insert into diaries values(3733, "2021-10-02"); +insert into diaries values(3734, "2021-10-03"); +insert into diaries values(3735, "2021-10-04"); +insert into diaries values(3736, "2021-10-05"); +insert into diaries values(3737, "2021-10-06"); +insert into diaries values(3738, "2021-10-07"); +insert into diaries values(3739, "2021-10-08"); +insert into diaries values(3740, "2021-10-09"); +insert into diaries values(3741, "2021-10-10"); +insert into diaries values(3742, "2021-10-11"); +insert into diaries values(3743, "2021-10-12"); +insert into diaries values(3744, "2021-10-13"); +insert into diaries values(3745, "2021-10-14"); +insert into diaries values(3746, "2021-10-15"); +insert into diaries values(3747, "2021-10-16"); +insert into diaries values(3748, "2021-10-17"); +insert into diaries values(3749, "2021-10-18"); +insert into diaries values(3750, "2021-10-19"); +insert into diaries values(3751, "2021-10-20"); +insert into diaries values(3752, "2021-10-21"); +insert into diaries values(3753, "2021-10-22"); +insert into diaries values(3754, "2021-10-23"); +insert into diaries values(3755, "2021-10-24"); +insert into diaries values(3756, "2021-10-25"); +insert into diaries values(3757, "2021-10-26"); +insert into diaries values(3758, "2021-10-27"); +insert into diaries values(3759, "2021-10-28"); +insert into diaries values(3760, "2021-10-29"); +insert into diaries values(3761, "2021-10-30"); +insert into diaries values(3762, "2021-10-31"); +insert into diaries values(3763, "2021-11-01"); +insert into diaries values(3764, "2021-11-02"); +insert into diaries values(3765, "2021-11-03"); +insert into diaries values(3766, "2021-11-04"); +insert into diaries values(3767, "2021-11-05"); +insert into diaries values(3768, "2021-11-06"); +insert into diaries values(3769, "2021-11-07"); +insert into diaries values(3770, "2021-11-08"); +insert into diaries values(3771, "2021-11-09"); +insert into diaries values(3772, "2021-11-10"); +insert into diaries values(3773, "2021-11-11"); +insert into diaries values(3774, "2021-11-12"); +insert into diaries values(3775, "2021-11-13"); +insert into diaries values(3776, "2021-11-14"); +insert into diaries values(3777, "2021-11-15"); +insert into diaries values(3778, "2021-11-16"); +insert into diaries values(3779, "2021-11-17"); +insert into diaries values(3780, "2021-11-18"); +insert into diaries values(3781, "2021-11-19"); +insert into diaries values(3782, "2021-11-20"); +insert into diaries values(3783, "2021-11-21"); +insert into diaries values(3784, "2021-11-22"); +insert into diaries values(3785, "2021-11-23"); +insert into diaries values(3786, "2021-11-24"); +insert into diaries values(3787, "2021-11-25"); +insert into diaries values(3788, "2021-11-26"); +insert into diaries values(3789, "2021-11-27"); +insert into diaries values(3790, "2021-11-28"); +insert into diaries values(3791, "2021-11-29"); +insert into diaries values(3792, "2021-11-30"); +insert into diaries values(3793, "2021-12-01"); +insert into diaries values(3794, "2021-12-02"); +insert into diaries values(3795, "2021-12-03"); +insert into diaries values(3796, "2021-12-04"); +insert into diaries values(3797, "2021-12-05"); +insert into diaries values(3798, "2021-12-06"); +insert into diaries values(3799, "2021-12-07"); +insert into diaries values(3800, "2021-12-08"); +insert into diaries values(3801, "2021-12-09"); +insert into diaries values(3802, "2021-12-10"); +insert into diaries values(3803, "2021-12-11"); +insert into diaries values(3804, "2021-12-12"); +insert into diaries values(3805, "2021-12-13"); +insert into diaries values(3806, "2021-12-14"); +insert into diaries values(3807, "2021-12-15"); +insert into diaries values(3808, "2021-12-16"); +insert into diaries values(3809, "2021-12-17"); +insert into diaries values(3810, "2021-12-18"); +insert into diaries values(3811, "2021-12-19"); +insert into diaries values(3812, "2021-12-20"); +insert into diaries values(3813, "2021-12-21"); +insert into diaries values(3814, "2021-12-22"); +insert into diaries values(3815, "2021-12-23"); +insert into diaries values(3816, "2021-12-24"); +insert into diaries values(3817, "2021-12-25"); +insert into diaries values(3818, "2021-12-26"); +insert into diaries values(3819, "2021-12-27"); +insert into diaries values(3820, "2021-12-28"); +insert into diaries values(3821, "2021-12-29"); +insert into diaries values(3822, "2021-12-30"); +insert into diaries values(3823, "2021-12-31"); +insert into diaries values(3824, "2022-01-01"); +insert into diaries values(3825, "2022-01-02"); +insert into diaries values(3826, "2022-01-03"); +insert into diaries values(3827, "2022-01-04"); +insert into diaries values(3828, "2022-01-05"); +insert into diaries values(3829, "2022-01-06"); +insert into diaries values(3830, "2022-01-07"); +insert into diaries values(3831, "2022-01-08"); +insert into diaries values(3832, "2022-01-09"); +insert into diaries values(3833, "2022-01-10"); +insert into diaries values(3834, "2022-01-11"); +insert into diaries values(3835, "2022-01-12"); +insert into diaries values(3836, "2022-01-13"); +insert into diaries values(3837, "2022-01-14"); +insert into diaries values(3838, "2022-01-15"); +insert into diaries values(3839, "2022-01-16"); +insert into diaries values(3840, "2022-01-17"); +insert into diaries values(3841, "2022-01-18"); +insert into diaries values(3842, "2022-01-19"); +insert into diaries values(3843, "2022-01-20"); +insert into diaries values(3844, "2022-01-21"); +insert into diaries values(3845, "2022-01-22"); +insert into diaries values(3846, "2022-01-23"); +insert into diaries values(3847, "2022-01-24"); +insert into diaries values(3848, "2022-01-25"); +insert into diaries values(3849, "2022-01-26"); +insert into diaries values(3850, "2022-01-27"); +insert into diaries values(3851, "2022-01-28"); +insert into diaries values(3852, "2022-01-29"); +insert into diaries values(3853, "2022-01-30"); +insert into diaries values(3854, "2022-01-31"); +insert into diaries values(3855, "2022-02-01"); +insert into diaries values(3856, "2022-02-02"); +insert into diaries values(3857, "2022-02-03"); +insert into diaries values(3858, "2022-02-04"); +insert into diaries values(3859, "2022-02-05"); +insert into diaries values(3860, "2022-02-06"); +insert into diaries values(3861, "2022-02-07"); +insert into diaries values(3862, "2022-02-08"); +insert into diaries values(3863, "2022-02-09"); +insert into diaries values(3864, "2022-02-10"); +insert into diaries values(3865, "2022-02-11"); +insert into diaries values(3866, "2022-02-12"); +insert into diaries values(3867, "2022-02-13"); +insert into diaries values(3868, "2022-02-14"); +insert into diaries values(3869, "2022-02-15"); +insert into diaries values(3870, "2022-02-16"); +insert into diaries values(3871, "2022-02-17"); +insert into diaries values(3872, "2022-02-18"); +insert into diaries values(3873, "2022-02-19"); +insert into diaries values(3874, "2022-02-20"); +insert into diaries values(3875, "2022-02-21"); +insert into diaries values(3876, "2022-02-22"); +insert into diaries values(3877, "2022-02-23"); +insert into diaries values(3878, "2022-02-24"); +insert into diaries values(3879, "2022-02-25"); +insert into diaries values(3880, "2022-02-26"); +insert into diaries values(3881, "2022-02-27"); +insert into diaries values(3882, "2022-02-28"); +insert into diaries values(3883, "2022-03-01"); +insert into diaries values(3884, "2022-03-02"); +insert into diaries values(3885, "2022-03-03"); +insert into diaries values(3886, "2022-03-04"); +insert into diaries values(3887, "2022-03-05"); +insert into diaries values(3888, "2022-03-06"); +insert into diaries values(3889, "2022-03-07"); +insert into diaries values(3890, "2022-03-08"); +insert into diaries values(3891, "2022-03-09"); +insert into diaries values(3892, "2022-03-10"); +insert into diaries values(3893, "2022-03-11"); +insert into diaries values(3894, "2022-03-12"); +insert into diaries values(3895, "2022-03-13"); +insert into diaries values(3896, "2022-03-14"); +insert into diaries values(3897, "2022-03-15"); +insert into diaries values(3898, "2022-03-16"); +insert into diaries values(3899, "2022-03-17"); +insert into diaries values(3900, "2022-03-18"); +insert into diaries values(3901, "2022-03-19"); +insert into diaries values(3902, "2022-03-20"); +insert into diaries values(3903, "2022-03-21"); +insert into diaries values(3904, "2022-03-22"); +insert into diaries values(3905, "2022-03-23"); +insert into diaries values(3906, "2022-03-24"); +insert into diaries values(3907, "2022-03-25"); +insert into diaries values(3908, "2022-03-26"); +insert into diaries values(3909, "2022-03-27"); +insert into diaries values(3910, "2022-03-28"); +insert into diaries values(3911, "2022-03-29"); +insert into diaries values(3912, "2022-03-30"); +insert into diaries values(3913, "2022-03-31"); +insert into diaries values(3914, "2022-04-01"); +insert into diaries values(3915, "2022-04-02"); +insert into diaries values(3916, "2022-04-03"); +insert into diaries values(3917, "2022-04-04"); +insert into diaries values(3918, "2022-04-05"); +insert into diaries values(3919, "2022-04-06"); +insert into diaries values(3920, "2022-04-07"); +insert into diaries values(3921, "2022-04-08"); +insert into diaries values(3922, "2022-04-09"); +insert into diaries values(3923, "2022-04-10"); +insert into diaries values(3924, "2022-04-11"); +insert into diaries values(3925, "2022-04-12"); +insert into diaries values(3926, "2022-04-13"); +insert into diaries values(3927, "2022-04-14"); +insert into diaries values(3928, "2022-04-15"); +insert into diaries values(3929, "2022-04-16"); +insert into diaries values(3930, "2022-04-17"); +insert into diaries values(3931, "2022-04-18"); +insert into diaries values(3932, "2022-04-19"); +insert into diaries values(3933, "2022-04-20"); +insert into diaries values(3934, "2022-04-21"); +insert into diaries values(3935, "2022-04-22"); +insert into diaries values(3936, "2022-04-23"); +insert into diaries values(3937, "2022-04-24"); +insert into diaries values(3938, "2022-04-25"); +insert into diaries values(3939, "2022-04-26"); +insert into diaries values(3940, "2022-04-27"); +insert into diaries values(3941, "2022-04-28"); +insert into diaries values(3942, "2022-04-29"); +insert into diaries values(3943, "2022-04-30"); +insert into diaries values(3944, "2022-05-01"); +insert into diaries values(3945, "2022-05-02"); +insert into diaries values(3946, "2022-05-03"); +insert into diaries values(3947, "2022-05-04"); +insert into diaries values(3948, "2022-05-05"); +insert into diaries values(3949, "2022-05-06"); +insert into diaries values(3950, "2022-05-07"); +insert into diaries values(3951, "2022-05-08"); +insert into diaries values(3952, "2022-05-09"); +insert into diaries values(3953, "2022-05-10"); +insert into diaries values(3954, "2022-05-11"); +insert into diaries values(3955, "2022-05-12"); +insert into diaries values(3956, "2022-05-13"); +insert into diaries values(3957, "2022-05-14"); +insert into diaries values(3958, "2022-05-15"); +insert into diaries values(3959, "2022-05-16"); +insert into diaries values(3960, "2022-05-17"); +insert into diaries values(3961, "2022-05-18"); +insert into diaries values(3962, "2022-05-19"); +insert into diaries values(3963, "2022-05-20"); +insert into diaries values(3964, "2022-05-21"); +insert into diaries values(3965, "2022-05-22"); +insert into diaries values(3966, "2022-05-23"); +insert into diaries values(3967, "2022-05-24"); +insert into diaries values(3968, "2022-05-25"); +insert into diaries values(3969, "2022-05-26"); +insert into diaries values(3970, "2022-05-27"); +insert into diaries values(3971, "2022-05-28"); +insert into diaries values(3972, "2022-05-29"); +insert into diaries values(3973, "2022-05-30"); +insert into diaries values(3974, "2022-05-31"); +insert into diaries values(3975, "2022-06-01"); +insert into diaries values(3976, "2022-06-02"); +insert into diaries values(3977, "2022-06-03"); +insert into diaries values(3978, "2022-06-04"); +insert into diaries values(3979, "2022-06-05"); +insert into diaries values(3980, "2022-06-06"); +insert into diaries values(3981, "2022-06-07"); +insert into diaries values(3982, "2022-06-08"); +insert into diaries values(3983, "2022-06-09"); +insert into diaries values(3984, "2022-06-10"); +insert into diaries values(3985, "2022-06-11"); +insert into diaries values(3986, "2022-06-12"); +insert into diaries values(3987, "2022-06-13"); +insert into diaries values(3988, "2022-06-14"); +insert into diaries values(3989, "2022-06-15"); +insert into diaries values(3990, "2022-06-16"); +insert into diaries values(3991, "2022-06-17"); +insert into diaries values(3992, "2022-06-18"); +insert into diaries values(3993, "2022-06-19"); +insert into diaries values(3994, "2022-06-20"); +insert into diaries values(3995, "2022-06-21"); +insert into diaries values(3996, "2022-06-22"); +insert into diaries values(3997, "2022-06-23"); +insert into diaries values(3998, "2022-06-24"); +insert into diaries values(3999, "2022-06-25"); +insert into diaries values(4000, "2022-06-26"); +insert into diaries values(4001, "2022-06-27"); +insert into diaries values(4002, "2022-06-28"); +insert into diaries values(4003, "2022-06-29"); +insert into diaries values(4004, "2022-06-30"); +insert into diaries values(4005, "2022-07-01"); +insert into diaries values(4006, "2022-07-02"); +insert into diaries values(4007, "2022-07-03"); +insert into diaries values(4008, "2022-07-04"); +insert into diaries values(4009, "2022-07-05"); +insert into diaries values(4010, "2022-07-06"); +insert into diaries values(4011, "2022-07-07"); +insert into diaries values(4012, "2022-07-08"); +insert into diaries values(4013, "2022-07-09"); +insert into diaries values(4014, "2022-07-10"); +insert into diaries values(4015, "2022-07-11"); +insert into diaries values(4016, "2022-07-12"); +insert into diaries values(4017, "2022-07-13"); +insert into diaries values(4018, "2022-07-14"); +insert into diaries values(4019, "2022-07-15"); +insert into diaries values(4020, "2022-07-16"); +insert into diaries values(4021, "2022-07-17"); +insert into diaries values(4022, "2022-07-18"); +insert into diaries values(4023, "2022-07-19"); +insert into diaries values(4024, "2022-07-20"); +insert into diaries values(4025, "2022-07-21"); +insert into diaries values(4026, "2022-07-22"); +insert into diaries values(4027, "2022-07-23"); +insert into diaries values(4028, "2022-07-24"); +insert into diaries values(4029, "2022-07-25"); +insert into diaries values(4030, "2022-07-26"); +insert into diaries values(4031, "2022-07-27"); +insert into diaries values(4032, "2022-07-28"); +insert into diaries values(4033, "2022-07-29"); +insert into diaries values(4034, "2022-07-30"); +insert into diaries values(4035, "2022-07-31"); +insert into diaries values(4036, "2022-08-01"); +insert into diaries values(4037, "2022-08-02"); +insert into diaries values(4038, "2022-08-03"); +insert into diaries values(4039, "2022-08-04"); +insert into diaries values(4040, "2022-08-05"); +insert into diaries values(4041, "2022-08-06"); +insert into diaries values(4042, "2022-08-07"); +insert into diaries values(4043, "2022-08-08"); +insert into diaries values(4044, "2022-08-09"); +insert into diaries values(4045, "2022-08-10"); +insert into diaries values(4046, "2022-08-11"); +insert into diaries values(4047, "2022-08-12"); +insert into diaries values(4048, "2022-08-13"); +insert into diaries values(4049, "2022-08-14"); +insert into diaries values(4050, "2022-08-15"); +insert into diaries values(4051, "2022-08-16"); +insert into diaries values(4052, "2022-08-17"); +insert into diaries values(4053, "2022-08-18"); +insert into diaries values(4054, "2022-08-19"); +insert into diaries values(4055, "2022-08-20"); +insert into diaries values(4056, "2022-08-21"); +insert into diaries values(4057, "2022-08-22"); +insert into diaries values(4058, "2022-08-23"); +insert into diaries values(4059, "2022-08-24"); +insert into diaries values(4060, "2022-08-25"); +insert into diaries values(4061, "2022-08-26"); +insert into diaries values(4062, "2022-08-27"); +insert into diaries values(4063, "2022-08-28"); +insert into diaries values(4064, "2022-08-29"); +insert into diaries values(4065, "2022-08-30"); +insert into diaries values(4066, "2022-08-31"); +insert into diaries values(4067, "2022-09-01"); +insert into diaries values(4068, "2022-09-02"); +insert into diaries values(4069, "2022-09-03"); +insert into diaries values(4070, "2022-09-04"); +insert into diaries values(4071, "2022-09-05"); +insert into diaries values(4072, "2022-09-06"); +insert into diaries values(4073, "2022-09-07"); +insert into diaries values(4074, "2022-09-08"); +insert into diaries values(4075, "2022-09-09"); +insert into diaries values(4076, "2022-09-10"); +insert into diaries values(4077, "2022-09-11"); +insert into diaries values(4078, "2022-09-12"); +insert into diaries values(4079, "2022-09-13"); +insert into diaries values(4080, "2022-09-14"); +insert into diaries values(4081, "2022-09-15"); +insert into diaries values(4082, "2022-09-16"); +insert into diaries values(4083, "2022-09-17"); +insert into diaries values(4084, "2022-09-18"); +insert into diaries values(4085, "2022-09-19"); +insert into diaries values(4086, "2022-09-20"); +insert into diaries values(4087, "2022-09-21"); +insert into diaries values(4088, "2022-09-22"); +insert into diaries values(4089, "2022-09-23"); +insert into diaries values(4090, "2022-09-24"); +insert into diaries values(4091, "2022-09-25"); +insert into diaries values(4092, "2022-09-26"); +insert into diaries values(4093, "2022-09-27"); +insert into diaries values(4094, "2022-09-28"); +insert into diaries values(4095, "2022-09-29"); +commit; +set autocommit=1; +select * from diaries where match(title) against("2022-09-0"); +id title +3824 2022-01-01 +3825 2022-01-02 +3826 2022-01-03 +3827 2022-01-04 +3828 2022-01-05 +3829 2022-01-06 +3830 2022-01-07 +3831 2022-01-08 +3832 2022-01-09 +3833 2022-01-10 +3834 2022-01-11 +3835 2022-01-12 +3836 2022-01-13 +3837 2022-01-14 +3838 2022-01-15 +3839 2022-01-16 +3840 2022-01-17 +3841 2022-01-18 +3842 2022-01-19 +3843 2022-01-20 +3844 2022-01-21 +3845 2022-01-22 +3846 2022-01-23 +3847 2022-01-24 +3848 2022-01-25 +3849 2022-01-26 +3850 2022-01-27 +3851 2022-01-28 +3852 2022-01-29 +3853 2022-01-30 +3854 2022-01-31 +3855 2022-02-01 +3856 2022-02-02 +3857 2022-02-03 +3858 2022-02-04 +3859 2022-02-05 +3860 2022-02-06 +3861 2022-02-07 +3862 2022-02-08 +3863 2022-02-09 +3864 2022-02-10 +3865 2022-02-11 +3866 2022-02-12 +3867 2022-02-13 +3868 2022-02-14 +3869 2022-02-15 +3870 2022-02-16 +3871 2022-02-17 +3872 2022-02-18 +3873 2022-02-19 +3874 2022-02-20 +3875 2022-02-21 +3876 2022-02-22 +3877 2022-02-23 +3878 2022-02-24 +3879 2022-02-25 +3880 2022-02-26 +3881 2022-02-27 +3882 2022-02-28 +3883 2022-03-01 +3884 2022-03-02 +3885 2022-03-03 +3886 2022-03-04 +3887 2022-03-05 +3888 2022-03-06 +3889 2022-03-07 +3890 2022-03-08 +3891 2022-03-09 +3892 2022-03-10 +3893 2022-03-11 +3894 2022-03-12 +3895 2022-03-13 +3896 2022-03-14 +3897 2022-03-15 +3898 2022-03-16 +3899 2022-03-17 +3900 2022-03-18 +3901 2022-03-19 +3902 2022-03-20 +3903 2022-03-21 +3904 2022-03-22 +3905 2022-03-23 +3906 2022-03-24 +3907 2022-03-25 +3908 2022-03-26 +3909 2022-03-27 +3910 2022-03-28 +3911 2022-03-29 +3912 2022-03-30 +3913 2022-03-31 +3914 2022-04-01 +3915 2022-04-02 +3916 2022-04-03 +3917 2022-04-04 +3918 2022-04-05 +3919 2022-04-06 +3920 2022-04-07 +3921 2022-04-08 +3922 2022-04-09 +3923 2022-04-10 +3924 2022-04-11 +3925 2022-04-12 +3926 2022-04-13 +3927 2022-04-14 +3928 2022-04-15 +3929 2022-04-16 +3930 2022-04-17 +3931 2022-04-18 +3932 2022-04-19 +3933 2022-04-20 +3934 2022-04-21 +3935 2022-04-22 +3936 2022-04-23 +3937 2022-04-24 +3938 2022-04-25 +3939 2022-04-26 +3940 2022-04-27 +3941 2022-04-28 +3942 2022-04-29 +3943 2022-04-30 +3944 2022-05-01 +3945 2022-05-02 +3946 2022-05-03 +3947 2022-05-04 +3948 2022-05-05 +3949 2022-05-06 +3950 2022-05-07 +3951 2022-05-08 +3952 2022-05-09 +3953 2022-05-10 +3954 2022-05-11 +3955 2022-05-12 +3956 2022-05-13 +3957 2022-05-14 +3958 2022-05-15 +3959 2022-05-16 +3960 2022-05-17 +3961 2022-05-18 +3962 2022-05-19 +3963 2022-05-20 +3964 2022-05-21 +3965 2022-05-22 +3966 2022-05-23 +3967 2022-05-24 +3968 2022-05-25 +3969 2022-05-26 +3970 2022-05-27 +3971 2022-05-28 +3972 2022-05-29 +3973 2022-05-30 +3974 2022-05-31 +3975 2022-06-01 +3976 2022-06-02 +3977 2022-06-03 +3978 2022-06-04 +3979 2022-06-05 +3980 2022-06-06 +3981 2022-06-07 +3982 2022-06-08 +3983 2022-06-09 +3984 2022-06-10 +3985 2022-06-11 +3986 2022-06-12 +3987 2022-06-13 +3988 2022-06-14 +3989 2022-06-15 +3990 2022-06-16 +3991 2022-06-17 +3992 2022-06-18 +3993 2022-06-19 +3994 2022-06-20 +3995 2022-06-21 +3996 2022-06-22 +3997 2022-06-23 +3998 2022-06-24 +3999 2022-06-25 +4000 2022-06-26 +4001 2022-06-27 +4002 2022-06-28 +4003 2022-06-29 +4004 2022-06-30 +4005 2022-07-01 +4006 2022-07-02 +4007 2022-07-03 +4008 2022-07-04 +4009 2022-07-05 +4010 2022-07-06 +4011 2022-07-07 +4012 2022-07-08 +4013 2022-07-09 +4014 2022-07-10 +4015 2022-07-11 +4016 2022-07-12 +4017 2022-07-13 +4018 2022-07-14 +4019 2022-07-15 +4020 2022-07-16 +4021 2022-07-17 +4022 2022-07-18 +4023 2022-07-19 +4024 2022-07-20 +4025 2022-07-21 +4026 2022-07-22 +4027 2022-07-23 +4028 2022-07-24 +4029 2022-07-25 +4030 2022-07-26 +4031 2022-07-27 +4032 2022-07-28 +4033 2022-07-29 +4034 2022-07-30 +4035 2022-07-31 +4036 2022-08-01 +4037 2022-08-02 +4038 2022-08-03 +4039 2022-08-04 +4040 2022-08-05 +4041 2022-08-06 +4042 2022-08-07 +4043 2022-08-08 +4044 2022-08-09 +4045 2022-08-10 +4046 2022-08-11 +4047 2022-08-12 +4048 2022-08-13 +4049 2022-08-14 +4050 2022-08-15 +4051 2022-08-16 +4052 2022-08-17 +4053 2022-08-18 +4054 2022-08-19 +4055 2022-08-20 +4056 2022-08-21 +4057 2022-08-22 +4058 2022-08-23 +4059 2022-08-24 +4060 2022-08-25 +4061 2022-08-26 +4062 2022-08-27 +4063 2022-08-28 +4064 2022-08-29 +4065 2022-08-30 +4066 2022-08-31 +4067 2022-09-01 +4068 2022-09-02 +4069 2022-09-03 +4070 2022-09-04 +4071 2022-09-05 +4072 2022-09-06 +4073 2022-09-07 +4074 2022-09-08 +4075 2022-09-09 +4076 2022-09-10 +4077 2022-09-11 +4078 2022-09-12 +4079 2022-09-13 +4080 2022-09-14 +4081 2022-09-15 +4082 2022-09-16 +4083 2022-09-17 +4084 2022-09-18 +4085 2022-09-19 +4086 2022-09-20 +4087 2022-09-21 +4088 2022-09-22 +4089 2022-09-23 +4090 2022-09-24 +4091 2022-09-25 +4092 2022-09-26 +4093 2022-09-27 +4094 2022-09-28 +4095 2022-09-29 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result new file mode 100644 index 00000000000..64acf4aaeae --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_delete.result @@ -0,0 +1,34 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(content) against("富士山"); +id title content +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result new file mode 100644 index 00000000000..c1661d7fcbf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_insert.result @@ -0,0 +1,40 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries where match(title) against("富士山"); +id title content +3 富士山 今日もãれã„。 +select * from diaries where match(content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result new file mode 100644 index 00000000000..604aca172a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_recreate.result @@ -0,0 +1,42 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +drop index title on diaries; +select * from diaries where match(title, content) against("富士山"); +ERROR HY000: Can't find FULLTEXT index matching the column list +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); +id title content +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +select * from diaries; +id title content +1 Hello ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 富士山 今日もãれã„。 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result new file mode 100644 index 00000000000..6f489bf37cc --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_column_index_update.result @@ -0,0 +1,37 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +title varchar(255), +content text, +fulltext index (title, content), +fulltext index (title), +fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`content`), + FULLTEXT KEY `title_2` (`title`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +update diaries set title = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒž" where id = 3; +update diaries set content = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±±" where id = 1; +select * from diaries where match(title, content) against("富士山"); +id title content +1 Hello ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±± +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+select * from diaries where match(title) against("富士山"); +id title content +select * from diaries where match(content) against("富士山"); +id title content +1 Hello ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±± +2 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result new file mode 100644 index 00000000000..d9448ee82ba --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_multiple_index.result @@ -0,0 +1,33 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +title text, +body text, +fulltext index title_index (title), +fulltext index body_index (body) +) comment = 'engine "innodb"' default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); +select * from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body +1 survey will start groonga! +select *, match(title) against("survey"), match(body) against("groonga") +from diaries +where match(title) against("survey") and +match(body) against("groonga"); +id title body match(title) against("survey") match(body) against("groonga") +1 survey will start groonga! 1048577 149797 +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result new file mode 100644 index 00000000000..de1b8d41906 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_myisam.result @@ -0,0 +1,202 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` text, + PRIMARY KEY (`c1`), + FULLTEXT KEY `ft` (`c2`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "myisam"' +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +flush tables; +select * from t1; +c1 c2 +1 hoge hoge +2 fuga fuga +3 moge moge +drop table t1; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 20 ka ki ku ke ko +3 30 sa si su se so +4 40 ta ti tu te to +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("su"); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("ii"); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +select * from t1 where match(c3) against("+su" in boolean mode); +c1 c2 c3 +3 30 sa si su se so +select * from t1 where match(c3) against("+ii" in boolean mode); +c1 c2 c3 +1 10 aa ii uu ee oo +5 50 aa ii uu ee oo +drop table t1; +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +3 dummy dummy +select * from t1 where match(c2) against("富士山"); +c1 c2 c3 +1 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠ã‚ã‚ã‚ã‚ã‚ã‚ã‚ +select * from t1 where match(c3) against("富士山"); +c1 c2 c3 +2 ã„ã„ã„ã„ㄠ明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“ +drop table t1; +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t2; +c1 c2 +1 aa ii uu ee oo +2 ka ki ku ke ko +3 aa ii ii ii oo +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t2 where c1=3; +c1 c2 +3 aa ii ii ii oo +select * from t1 where c1>3 order by c1 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c1>3 order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select * from t1 where c2>"s" order by c2 desc; +c1 c2 +5 ta ti ii ii to +4 sa si su se so +select * from t2 where c2>"s" order by c1 asc; +c1 c2 +4 sa si su se so +5 ta ti ii ii to +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +c1 c2 match(c2) against("ii") +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +1 aa ii uu ee oo 174763 +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +5 ta ti ii ii to 349526 +3 aa ii ii ii oo 524289 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +c1 c2 match(c2) against("ii") +1 aa ii uu ee oo 174763 +3 aa ii ii ii oo 524289 +5 ta ti ii ii to 349526 +drop table t1,t2; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select *,match(c3) against("uu") from t1 where match(c3) against("uu"); +c1 c2 c3 match(c3) against("uu") +1 10 aa ii uu ee oo 131073 +3 10 aa ii uu ee oo 131073 +5 20 aa ii uu ee oo 131073 +7 20 aa ii uu ee oo 131073 +select * from t1 where not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +c1 c2 c3 match(c3) against("dummy") +select * from t1 where not match(c3) against("dummy"); +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("uu"); +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result new file mode 100644 index 00000000000..bbe23df3e0f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_not_match_against.result @@ -0,0 +1,68 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select *,match(c3) against("uu") from t1 where match(c3) against("uu"); +c1 c2 c3 match(c3) against("uu") +1 10 aa ii uu ee oo 131073 +3 10 aa ii uu ee oo 131073 +5 20 aa ii uu ee oo 131073 +7 20 aa ii uu ee oo 131073 +select * from t1 where not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +c1 c2 c3 match(c3) against("dummy") +select * from t1 where not match(c3) against("dummy"); +c1 c2 c3 +1 10 aa ii uu ee oo +2 10 ka ki ku ke ko +3 10 aa ii uu ee oo +4 10 ka ki ku ke ko +5 20 aa ii uu ee oo +6 20 ka ki ku ke ko +7 20 aa ii uu ee oo +8 20 ka ki ku ke ko +select * from t1 where c1 = 4 and not match(c3) against("uu"); +c1 c2 c3 +4 10 ka ki ku ke ko +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c1 > 4 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 = 10 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +c1 c2 c3 +6 20 ka ki ku ke ko +8 20 ka ki ku ke ko +select * from t1 where c2 < 15 and not match(c3) against("uu"); +c1 c2 c3 +2 10 ka ki ku ke ko +4 10 ka ki ku ke ko +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..279ad8bf985 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_TODO_SPLIT_ME.result @@ -0,0 +1,50 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE ft( +a INT, +b TEXT, +c TEXT, +PRIMARY KEY(a), +FULLTEXT KEY ftx1(b), +FULLTEXT KEY ftx2(c) +)ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; +SHOW CREATE TABLE ft; +Table Create Table +ft CREATE TABLE `ft` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` text, + `c` text, + PRIMARY KEY (`a`), + FULLTEXT KEY `ftx1` (`b`), + FULLTEXT KEY `ftx2` (`c`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +INSERT INTO ft VALUES(1,'aaaaa','abcde'); +INSERT INTO ft VALUES(2,'bbbbb','bcdef'); +INSERT INTO ft VALUES(3,'ccccc','cdefg'); +INSERT INTO ft VALUES(4,'ddddd','defgh'); +INSERT INTO ft VALUES(5,'eeeee','efghi'); +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +2 bbbbb bcdef +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +2 bbbbb bcdef +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +2 bbbbb bcdef +SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) +2 bbbbb bcdef 1 0 +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) +2 bbbbb bcdef 1 0 +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), a; +a b c MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) +1 aaaaa abcde 0 0 +3 ccccc cdefg 0 0 +4 ddddd defgh 0 0 +5 eeeee efghi 0 0 +2 bbbbb bcdef 1 0 +DROP TABLE ft; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result new file mode 100644 index 00000000000..3da64b2de1f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_order_transaction.result @@ -0,0 +1,50 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +START TRANSACTION; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +USE test; +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +COMMIT; +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(body) AGAINST("groonga") +ORDER BY id; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result new file mode 100644 index 00000000000..d7b20a3714f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/fulltext_parser_comment.result @@ -0,0 +1,29 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) COMMENT 'parser "TokenBigramSplitSymbolAlphaDigit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +select * from diaries where match(body) against("start"); +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result new file mode 100644 index 00000000000..9edbd3c9b3b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_grn_id.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS ids; +DROP FUNCTION IF EXISTS last_insert_grn_id; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +SELECT last_insert_grn_id(); +last_insert_grn_id() +0 +INSERT INTO ids VALUES(); +SELECT last_insert_grn_id(); +last_insert_grn_id() +0 +SELECT * FROM ids; +id +1 +DROP TABLE ids; +DROP FUNCTION last_insert_grn_id; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result new file mode 100644 index 00000000000..d31d5454169 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_reference.result @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +SELECT last_insert_id(); +last_insert_id() +0 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result new file mode 100644 index 00000000000..39791b93ba2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/function_last_insert_id_set.result @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; +SELECT last_insert_id(); +last_insert_id() +0 +SELECT last_insert_id(10); +last_insert_id(10) +10 +SELECT last_insert_id(); +last_insert_id() +10 +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +last_insert_id() +1 +SELECT * FROM ids; +id +1 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result new file mode 100644 index 00000000000..29163384e6a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_contains.result @@ -0,0 +1,169 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into shops (name, location) +values ('nezu-no-taiyaki', +GeomFromText('POINT(139.762573 35.720253)')); +insert into shops (name, location) +values ('taiyaki-kataoka', +GeomFromText('POINT(139.715591 35.712521)')); +insert into shops (name, location) +values ('soba-taiyaki-ku', +GeomFromText('POINT(139.659088 35.683712)')); +insert into shops (name, location) +values ('kuruma', +GeomFromText('POINT(139.706207 35.721516)')); +insert into shops (name, location) +values ('hirose-ya', +GeomFromText('POINT(139.685608 35.714844)')); +insert into shops (name, location) +values ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +insert into shops (name, location) +values ('omede-taiyaki', +GeomFromText('POINT(139.817154 35.700516)')); +insert into shops (name, location) +values ('onaga-ya', +GeomFromText('POINT(139.81105 35.698254)')); +insert into shops (name, location) +values ('shiro-ya', +GeomFromText('POINT(139.638611 35.705517)')); +insert into shops (name, location) +values ('fuji-ya', +GeomFromText('POINT(139.637115 35.703938)')); +insert into shops (name, location) +values ('miyoshi', +GeomFromText('POINT(139.537323 35.644539)')); +insert into shops (name, location) +values ('juju-ya', +GeomFromText('POINT(139.695755 35.628922)')); +insert into shops (name, location) +values ('tatsumi-ya', +GeomFromText('POINT(139.638657 35.665501)')); +insert into shops (name, location) +values ('tetsuji', +GeomFromText('POINT(139.76857 35.680912)')); +insert into shops (name, location) +values ('gazuma-ya', +GeomFromText('POINT(139.647598 35.700817)')); +insert into shops (name, location) +values ('honma-mon', +GeomFromText('POINT(139.652573 35.722736)')); +insert into shops (name, location) +values ('naniwa-ya', +GeomFromText('POINT(139.796234 35.730061)')); +insert into shops (name, location) +values ('kuro-dai', +GeomFromText('POINT(139.704834 35.650345)')); +insert into shops (name, location) +values ('daruma', +GeomFromText('POINT(139.770599 35.681461)')); +insert into shops (name, location) +values ('yanagi-ya', +GeomFromText('POINT(139.783981 35.685341)')); +insert into shops (name, location) +values ('sharaku', +GeomFromText('POINT(139.794846 35.716969)')); +insert into shops (name, location) +values ('takane', +GeomFromText('POINT(139.560913 35.698601)')); +insert into shops (name, location) +values ('chiyoda', +GeomFromText('POINT(139.652817 35.642601)')); +insert into shops (name, location) +values ('da-ka-po', +GeomFromText('POINT(139.727356 35.627346)')); +insert into shops (name, location) +values ('matsushima-ya', +GeomFromText('POINT(139.737381 35.640556)')); +insert into shops (name, location) +values ('kazuya', +GeomFromText('POINT(139.760895 35.673508)')); +insert into shops (name, location) +values ('furuya-kogane-an', +GeomFromText('POINT(139.676071 35.680603)')); +insert into shops (name, location) +values ('hachi-no-ie', +GeomFromText('POINT(139.668106 35.608021)')); +insert into shops (name, location) +values ('azuki-chan', +GeomFromText('POINT(139.673203 35.64151)')); +insert into shops (name, location) +values ('kuriko-an', +GeomFromText('POINT(139.796829 35.712013)')); +insert into shops (name, location) +values ('yume-no-aru-machi-no-taiyaki-ya-san', +GeomFromText('POINT(139.712524 35.616199)')); +insert into shops (name, location) +values ('naze-ya', +GeomFromText('POINT(139.665833 35.609039)')); +insert into shops (name, location) +values ('sanoki-ya', +GeomFromText('POINT(139.770721 35.66592)')); +insert into shops (name, location) +values ('shigeta', +GeomFromText('POINT(139.780273 35.672626)')); +insert into shops (name, location) +values ('nishimi-ya', +GeomFromText('POINT(139.774628 35.671825)')); +insert into shops (name, location) +values ('hiiragi', +GeomFromText('POINT(139.711517 35.647701)')); +select id, name, AsText(location) as location_text from shops; +id name location_text +1 nezu-no-taiyaki POINT(139.762573 35.720253) +2 taiyaki-kataoka POINT(139.715591 35.712521) +3 soba-taiyaki-ku POINT(139.659088 35.683712) +4 kuruma POINT(139.706207 35.721516) +5 hirose-ya POINT(139.685608 35.714844) +6 sazare POINT(139.685043 35.714653) +7 omede-taiyaki POINT(139.817154 35.700516) +8 onaga-ya POINT(139.81105 35.698254) +9 shiro-ya POINT(139.638611 35.705517) +10 fuji-ya POINT(139.637115 35.703938) +11 miyoshi POINT(139.537323 35.644539) +12 juju-ya POINT(139.695755 35.628922) +13 tatsumi-ya POINT(139.638657 35.665501) +14 tetsuji POINT(139.76857 35.680912) +15 gazuma-ya POINT(139.647598 35.700817) +16 honma-mon POINT(139.652573 35.722736) +17 naniwa-ya POINT(139.796234 35.730061) +18 kuro-dai POINT(139.704834 35.650345) +19 daruma POINT(139.770599 35.681461) +20 yanagi-ya POINT(139.783981 35.685341) +21 sharaku POINT(139.794846 35.716969) +22 takane POINT(139.560913 35.698601) +23 chiyoda POINT(139.652817 35.642601) +24 da-ka-po POINT(139.727356 35.627346) +25 matsushima-ya POINT(139.737381 35.640556) +26 kazuya POINT(139.760895 35.673508) +27 furuya-kogane-an POINT(139.676071 35.680603) +28 hachi-no-ie POINT(139.668106 35.608021) +29 azuki-chan POINT(139.673203 35.64151) +30 kuriko-an POINT(139.796829 35.712013) +31 yume-no-aru-machi-no-taiyaki-ya-san POINT(139.712524 35.616199) +32 naze-ya POINT(139.665833 35.609039) +33 sanoki-ya POINT(139.770721 35.66592) +34 shigeta POINT(139.780273 35.672626) +35 nishimi-ya POINT(139.774628 35.671825) +36 hiiragi POINT(139.711517 35.647701) +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location); +id name location_text +14 tetsuji POINT(139.76857 35.680912) +19 daruma POINT(139.770599 35.681461) +26 kazuya POINT(139.760895 35.673508) +drop table shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result new file mode 100644 index 00000000000..53aa00ecbab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_delete.result @@ -0,0 +1,31 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into shops (name, location) +values ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +id name location_text +1 sazare POINT(139.685043 35.714653) +delete from shops +where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +id name location_text +select id, name, AsText(location) as location_text from shops; +id name location_text +drop table shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result new file mode 100644 index 00000000000..e982e0b95ce --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/geometry_update.result @@ -0,0 +1,36 @@ +drop table if exists shops; +create table shops ( +id int primary key auto_increment, +name text, +location geometry NOT NULL, +spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; +Table Create Table +shops CREATE TABLE `shops` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` text, + `location` geometry NOT NULL, + PRIMARY KEY (`id`), + SPATIAL KEY `location_index` (`location`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into shops (name, location) +values ('sazare', +GeomFromText('POINT(139.685043 35.714653)')); +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +id name location_text +1 sazare POINT(139.685043 35.714653) +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location); +id name location_text +update shops set location = GeomFromText('POINT(139.66116 35.57566)') +where name = 'sazare'; +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +id name location_text +select id, name, AsText(location) as location_text from shops +where MBRContains(GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location); +id name location_text +1 sazare POINT(139.66116 35.57566) +drop table shops; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result new file mode 100644 index 00000000000..3fbc85ff051 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/index_force_index_not_used.result @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS ids; +CREATE TABLE ids ( +id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET UTF8 COMMENT = 'engine "InnoDB"'; +SELECT COUNT(*) FROM ids FORCE INDEX(PRIMARY); +COUNT(*) +0 +DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..93c05bff080 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_TODO_SPLIT_ME.result @@ -0,0 +1,78 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +c1 +1 +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +c1 +0.5 +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26"); +select * from t1; +c1 +2010-03-26 +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("11:22:33"); +select * from t1; +c1 +11:22:33 +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010"); +select * from t1; +c1 +2010 +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +c1 +2010-03-26 11:22:33 +drop table t1; +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +select * from t1; +c1 c2 +1 100 +insert into t1 values(1,200); +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select * from t1; +c1 c2 +1 100 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result new file mode 100644 index 00000000000..be61419477f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_bulk.result @@ -0,0 +1,30 @@ +drop table if exists diaries; +set names utf8; +create table diaries ( +id int primary key, +content text, +fulltext index (content) +) default charset utf8 comment = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL, + `content` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +LOCK TABLE diaries WRITE; +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +UNLOCK TABLES; +select * from diaries; +id content +1 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +select * from diaries where match(content) against("天気"); +id content +2 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result new file mode 100644 index 00000000000..f0ceb937a01 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result @@ -0,0 +1,36 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +date TIMESTAMP NOT NULL, +title VARCHAR(100) NOT NULL, +content TEXT NOT NULL, +PRIMARY KEY (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` varchar(100) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`date`,`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "MyISAM"' +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +SELECT * FROM diaries; +date title content +2012-03-04 00:00:00 cloudy day Today is cloudy day... +2012-03-04 00:00:00 shopping I buy a new shirt. +2012-03-05 00:00:00 rainy day Today is rainy day... +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy new shoes.") +ON DUPLICATE KEY UPDATE date = "2012-03-03", +content = "I buy a new hat."; +SELECT * FROM diaries; +date title content +2012-03-04 00:00:00 cloudy day Today is cloudy day... +2012-03-03 00:00:00 shopping I buy a new hat. +2012-03-05 00:00:00 rainy day Today is rainy day... +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result new file mode 100644 index 00000000000..97428b768a6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result @@ -0,0 +1,39 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +date TIMESTAMP NOT NULL, +title VARCHAR(100) NOT NULL, +content TEXT NOT NULL, +UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `title` varchar(100) NOT NULL, + `content` text NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `date` (`date`,`title`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "MyISAM"' +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); +SELECT * FROM diaries; +id date title content +1 2012-03-04 00:00:00 cloudy day Today is cloudy day... +2 2012-03-04 00:00:00 shopping I buy a new shirt. +3 2012-03-05 00:00:00 rainy day Today is rainy day... +INSERT INTO diaries (date, title, content) +VALUES ("2012-03-04", "shopping", "I buy new shoes.") +ON DUPLICATE KEY UPDATE date = "2012-03-03", +content = "I buy a new hat."; +SELECT * FROM diaries; +id date title content +1 2012-03-04 00:00:00 cloudy day Today is cloudy day... +2 2012-03-03 00:00:00 shopping I buy a new hat. +3 2012-03-05 00:00:00 rainy day Today is rainy day... +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result new file mode 100644 index 00000000000..aa7a32dbd3a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/multi_range_read_disk_sweep.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS integers; +SET optimizer_switch='mrr_cost_based=off'; +CREATE TABLE integers ( +id INT PRIMARY KEY AUTO_INCREMENT, +value INT, +KEY (value) +) COMMENT='engine "InnoDB"'; +INSERT INTO integers (value) VALUES (0), (1), (2), (3); +EXPLAIN SELECT * FROM integers +WHERE value IN (0, 2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE integers range value value 5 NULL 2 Using where; Using MRR +SELECT * FROM integers +WHERE value IN (0, 2); +id value +1 0 +3 2 +DROP TABLE integers; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result new file mode 100644 index 00000000000..5f43aee6997 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_TODO_SPLIT_ME.result @@ -0,0 +1,67 @@ +drop table if exists t1; +flush status; +create table t1 ( +c1 int primary key, +c2 int, +c3 text, +key idx1(c2), +fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); +select *, match(c3) against("ii") from t1 +where match(c3) against("ii") order by c1 desc limit 1; +c1 c2 c3 match(c3) against("ii") +5 50 aa ii uu ii oo 349526 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select *, match(c3) against("ii") from t1 +where match(c3) against("ii") order by c1 limit 1; +c1 c2 c3 match(c3) against("ii") +1 10 aa ii uu ee oo 174763 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") desc; +c3 match(c3) against("ii") +ii si ii se ii 524289 +aa ii uu ii oo 349526 +aa ii uu ee oo 174763 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") desc limit 1, 1; +c3 match(c3) against("ii") +aa ii uu ii oo 349526 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii"); +c3 match(c3) against("ii") +aa ii uu ee oo 174763 +aa ii uu ii oo 349526 +ii si ii se ii 524289 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +select c3, match(c3) against("ii") from t1 +where match(c3) against("ii") order by match(c3) against("ii") limit 1; +c3 match(c3) against("ii") +aa ii uu ee oo 174763 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 2 +select count(*) from t1 where match(c3) against("ii") limit 1; +count(*) +3 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result new file mode 100644 index 00000000000..b31d2ee5360 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/optimization_order_limit_no_where_clause.result @@ -0,0 +1,24 @@ +drop table if exists t1; +flush status; +create table t1 ( +c1 int primary key, +c2 int, +c3 text, +key idx1(c2), +fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 0 +select *, match(c3) against("ii") from t1 order by c1 desc limit 1; +c1 c2 c3 match(c3) against("ii") +5 50 aa ii uu ii oo 349526 +show status like 'mroonga_fast_order_limit'; +Variable_name Value +Mroonga_fast_order_limit 1 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result new file mode 100644 index 00000000000..61c8e18b17d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_files.result @@ -0,0 +1,42 @@ +DROP DATABASE IF EXISTS repair_test; +CREATE DATABASE repair_test; +USE repair_test; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX body_index (body) +) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +FLUSH TABLES; +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +ERROR HY000: mroonga: failed to open table: +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +repair_test.diaries repair status OK +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +DROP TABLE diaries; +DROP DATABASE repair_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result new file mode 100644 index 00000000000..140b5a92b75 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/repair_table_no_index_file.result @@ -0,0 +1,42 @@ +DROP DATABASE IF EXISTS repair_test; +CREATE DATABASE repair_test; +USE repair_test; +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX body_index (body) +) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +FLUSH TABLES; +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +ERROR HY000: syscall error 'repair_test.mrn.0000104' (No such file or directory) +REPAIR TABLE diaries; +Table Op Msg_type Msg_text +repair_test.diaries repair status OK +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); +id title body +2 groonga (1) starting groonga... +DROP TABLE diaries; +DROP DATABASE repair_test; +USE test; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result new file mode 100644 index 00000000000..b01e85aa483 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/temporary_table.result @@ -0,0 +1,21 @@ +DROP TEMPORARY TABLE IF EXISTS diaries; +CREATE TEMPORARY TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT +) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TEMPORARY TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); +SELECT * FROM diaries; +id title +1 clear day +2 rainy day +3 cloudy day +DROP TEMPORARY TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result new file mode 100644 index 00000000000..54afac7a1a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_query_cache.result @@ -0,0 +1,28 @@ +SET @tmp_query_cache_size = @@query_cache_size; +SET GLOBAL query_cache_size = 1048576; +DROP TABLE IF EXISTS simple_table; +CREATE TABLE simple_table ( +id INT PRIMARY KEY +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE simple_table; +Table Create Table +simple_table CREATE TABLE `simple_table` ( + `id` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO simple_table (id) VALUES (1),(2); +USE test; +START TRANSACTION; +INSERT INTO simple_table (id) VALUES (3); +SELECT * FROM simple_table; +id +1 +2 +COMMIT; +SELECT * FROM simple_table; +id +1 +2 +3 +DROP TABLE simple_table; +SET GLOBAL query_cache_size = @tmp_query_cache_size; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result new file mode 100644 index 00000000000..11cc1874257 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_delete.result @@ -0,0 +1,50 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +1 survey will start groonga! +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +DELETE FROM diaries WHERE id = 1; +Warnings: +Warning 1026 failed to get record ID for deleting from groonga: key=<> +SELECT * FROM diaries; +id title body +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey") AND +MATCH(body) AGAINST("groonga"); +id title body +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result new file mode 100644 index 00000000000..7dde8518db0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/transaction_rollback_delete_update.result @@ -0,0 +1,47 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +body TEXT, +FULLTEXT INDEX title_index (title), +FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `title_index` (`title`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +1 survey will start groonga! +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; +SELECT * FROM diaries; +id title body +1 survey will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +UPDATE diaries SET title = "survey day!" WHERE id = 1; +SELECT * FROM diaries; +id title body +1 survey day! will start groonga! +2 groonga (1) starting groonga... +3 groonga (2) started groonga. +SELECT * FROM diaries +WHERE MATCH(title) AGAINST("survey"); +id title body +1 survey day! will start groonga! +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result new file mode 100644 index 00000000000..35b273d348f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/truncate.result @@ -0,0 +1,55 @@ +DROP TABLE IF EXISTS diaries; +SET NAMES UTF8; +CREATE TABLE diaries ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +year INT UNSIGNED, +month INT UNSIGNED, +day INT UNSIGNED, +title VARCHAR(255), +content TEXT, +FULLTEXT INDEX(content), +KEY(day) +) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `year` int(10) unsigned DEFAULT NULL, + `month` int(10) unsigned DEFAULT NULL, + `day` int(10) unsigned DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `content` text, + PRIMARY KEY (`id`), + KEY `day` (`day`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +id year month day title content +1 2011 11 9 Hello 今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚ +3 2011 11 11 富士山 今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚ +2 2011 11 10 天気 明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„㦠+TRUNCATE TABLE diaries; +SELECT * FROM diaries; +id year month day title content +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +id year month day title content +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼"); +SELECT * FROM diaries; +id year month day title content +1 2011 11 11 å¸°ã‚Šé“ ã¤ã‹ã‚ŒãŸãƒ¼ +2 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +3 2011 12 2 åˆé›ª 今年ã¯ã˜ã‚ã¦ã®é›ªï¼ +SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE); +id year month day title content +2 2011 12 1 ä¹…ã—ã¶ã‚Š å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚ +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result new file mode 100644 index 00000000000..655d2424ba7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_fulltext.result @@ -0,0 +1,33 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); +select * from t1; +c1 c2 +10 aa ii uu ee +20 ka ki ku ke +30 sa si su se +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +20 ta ti tu te +30 sa si su se +select * from t1 where match(c2) against("ti"); +c1 c2 +20 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +update t1 set c1=40 where c1=20; +select * from t1; +c1 c2 +10 aa ii uu ee +30 sa si su se +40 ta ti tu te +select * from t1 where match(c2) against("ti"); +c1 c2 +40 ta ti tu te +select * from t1 where match(c2) against("ki"); +c1 c2 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result new file mode 100644 index 00000000000..5506f6b10b0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/update_int.result @@ -0,0 +1,36 @@ +drop table if exists t1, t2, t3; +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=Mroonga DEFAULT CHARSET=latin1 COMMENT='engine "innodb"' +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; +c1 c2 +1 100 +2 101 +3 102 +update t1 set c2=c2+100 where c1=1; +select * from t1; +c1 c2 +1 200 +2 101 +3 102 +update t1 set c2=c2+100 where c1=2; +select * from t1; +c1 c2 +1 200 +2 201 +3 102 +update t1 set c2=c2+100 where c1=3; +select * from t1; +c1 c2 +1 200 +2 201 +3 202 +drop table t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result new file mode 100644 index 00000000000..e451b2b99fe --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_delete.result @@ -0,0 +1,53 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +set mroonga_dry_write=true; +delete from diaries where id = 2; +select * from diaries; +id body +1 will start groonga! +3 started groonga. +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +3 started groonga. +set mroonga_dry_write=false; +delete from diaries where id = 3; +select * from diaries; +id body +1 will start groonga! +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +insert into diaries (id, body) values (2, "sleeping..."); +select * from diaries; +id body +1 will start groonga! +2 sleeping... +select * from diaries where match (body) against ("starting"); +id body +2 sleeping... +select * from diaries where match (body) against ("started"); +id body +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result new file mode 100644 index 00000000000..f11398f3710 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_insert.result @@ -0,0 +1,42 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +id body +1 will start groonga! +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +id body +1 will start groonga! +2 starting groonga... +3 started groonga. +select * from diaries where match (body) against ("groonga"); +id body +1 will start groonga! +3 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result new file mode 100644 index 00000000000..47a844c8e68 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_dry_write_update.result @@ -0,0 +1,39 @@ +drop table if exists diaries; +create table diaries ( +id int primary key auto_increment, +body text, +fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `body` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `body_index` (`body`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='engine "innodb"' +insert into diaries (body) values ("will start groonga!"); +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +id body +1 starting groonga... +select * from diaries where match (body) against ("will"); +id body +1 starting groonga... +select * from diaries where match (body) against ("starting"); +id body +set mroonga_dry_write=false; +update diaries set body = "started groonga." where id = 1; +select * from diaries; +id body +1 started groonga. +select * from diaries where match (body) against ("will"); +id body +1 started groonga. +select * from diaries where match (body) against ("starting"); +id body +select * from diaries where match (body) against ("started"); +id body +1 started groonga. +drop table diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result new file mode 100644 index 00000000000..0cf3d49c3c3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_global.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +SET GLOBAL mroonga_match_escalation_threshold = -1; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `tags` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result new file mode 100644 index 00000000000..3d94ebc93ad --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/variable_match_escalation_threshold_session.result @@ -0,0 +1,33 @@ +DROP TABLE IF EXISTS diaries; +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +title TEXT, +tags TEXT, +FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text, + `tags` text, + PRIMARY KEY (`id`), + FULLTEXT KEY `tags_index` (`tags`) COMMENT 'parser "TokenDelimit"' +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +2 Hello mroonga! mroonga install +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +SET mroonga_match_escalation_threshold = -1; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); +id title tags +1 Hello groonga! groonga install +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/version_55_performance_schema.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/version_55_performance_schema.result new file mode 100644 index 00000000000..f6e3bbdca82 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/version_55_performance_schema.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS diaries; +SHOW VARIABLES LIKE 'performance_schema'; +Variable_name Value +performance_schema ON +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +content VARCHAR(255), +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `content` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!"); +SHOW TABLES FROM performance_schema; +Tables_in_performance_schema +cond_instances +events_waits_current +events_waits_history +events_waits_history_long +events_waits_summary_by_instance +events_waits_summary_by_thread_by_event_name +events_waits_summary_global_by_event_name +file_instances +file_summary_by_event_name +file_summary_by_instance +mutex_instances +performance_timers +rwlock_instances +setup_consumers +setup_instruments +setup_timers +threads +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/version_56_or_later_performance_schema.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/version_56_or_later_performance_schema.result new file mode 100644 index 00000000000..548dc32707f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/version_56_or_later_performance_schema.result @@ -0,0 +1,73 @@ +DROP TABLE IF EXISTS diaries; +SHOW VARIABLES LIKE 'performance_schema'; +Variable_name Value +performance_schema ON +CREATE TABLE diaries ( +id INT PRIMARY KEY AUTO_INCREMENT, +content VARCHAR(255), +FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; +Table Create Table +diaries CREATE TABLE `diaries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `content` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `content` (`content`) +) ENGINE=Mroonga DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"' +INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!"); +SHOW TABLES FROM performance_schema; +Tables_in_performance_schema +accounts +cond_instances +events_stages_current +events_stages_history +events_stages_history_long +events_stages_summary_by_account_by_event_name +events_stages_summary_by_host_by_event_name +events_stages_summary_by_thread_by_event_name +events_stages_summary_by_user_by_event_name +events_stages_summary_global_by_event_name +events_statements_current +events_statements_history +events_statements_history_long +events_statements_summary_by_account_by_event_name +events_statements_summary_by_digest +events_statements_summary_by_host_by_event_name +events_statements_summary_by_thread_by_event_name +events_statements_summary_by_user_by_event_name +events_statements_summary_global_by_event_name +events_waits_current +events_waits_history +events_waits_history_long +events_waits_summary_by_account_by_event_name +events_waits_summary_by_host_by_event_name +events_waits_summary_by_instance +events_waits_summary_by_thread_by_event_name +events_waits_summary_by_user_by_event_name +events_waits_summary_global_by_event_name +file_instances +file_summary_by_event_name +file_summary_by_instance +host_cache +hosts +mutex_instances +objects_summary_global_by_type +performance_timers +rwlock_instances +session_account_connect_attrs +session_connect_attrs +setup_actors +setup_consumers +setup_instruments +setup_objects +setup_timers +socket_instances +socket_summary_by_event_name +socket_summary_by_instance +table_io_waits_summary_by_index_usage +table_io_waits_summary_by_table +table_lock_waits_summary_by_table +threads +users +DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt b/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt new file mode 100644 index 00000000000..d5a1e5190a7 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.opt @@ -0,0 +1 @@ +--loose-plugin-load-add=$HA_MROONGA_SO --loose-plugin-mroonga=ON diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm new file mode 100644 index 00000000000..528ccc5d693 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/suite.pm @@ -0,0 +1,23 @@ +package My::Suite::Mroonga; + +@ISA = qw(My::Suite); + +return "No Mroonga engine" unless $ENV{HA_MROONGA_SO} or + $::mysqld_variables{'mroonga'} eq "ON"; + +sub is_default { 1 } + +my $groonga_normalizer_mysql_dir=$::basedir . '/storage/mroonga/vendor/groonga/vendor/plugins/groonga-normalizer-mysql'; +my $groonga_normalizer_mysql_install_dir=$::basedir . '/lib/groonga/plugins'; + +if (-d $groonga_normalizer_mysql_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_dir; +} +elsif (-d $groonga_normalizer_mysql_install_dir) +{ + $ENV{GRN_PLUGINS_DIR}=$groonga_normalizer_mysql_install_dir; +} + +bless { }; + diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test new file mode 100644 index 00000000000..f25fdf95dab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column.test @@ -0,0 +1,46 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test new file mode 100644 index 00000000000..bbc5ca49818 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_column_comment.test @@ -0,0 +1,40 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +ALTER TABLE bugs + CHANGE COLUMN + tag + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test new file mode 100644 index 00000000000..38a13bf8a5e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_change_engine.test @@ -0,0 +1,55 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) ENGINE MyISAM DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +ALTER TABLE diaries ENGINE = mroonga COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga" IN BOOLEAN MODE) AND + MATCH(body) AGAINST("groonga" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test new file mode 100644 index 00000000000..2c85cc68266 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_comment_change_engine.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(64), + content TEXT, + FULLTEXT INDEX(content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; +SHOW CREATE TABLE memos; + +INSERT INTO memos (title, content) VALUES ("Hello", "I start to write memos!"); +INSERT INTO memos (title, content) VALUES ("groonga", "I start to use groonga!"); +INSERT INTO memos (title, content) VALUES ("mroonga", "I use mroonga too!"); + +ALTER TABLE memos COMMENT='engine "MyISAM"'; +SHOW CREATE TABLE memos; + +SELECT * FROM memos; +SELECT * FROM memos WHERE MATCH(content) AGAINST("start" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test new file mode 100644 index 00000000000..00b6ecf565e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_create_fulltext.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + WHERE MATCH (title) AGAINST ("富士山"); + +CREATE FULLTEXT INDEX title_index on diaries (title); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test new file mode 100644 index 00000000000..f81b4e82b06 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_fulltext.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries DISABLE KEYS; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test new file mode 100644 index 00000000000..760a4bc99bd --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_multiple_column.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test new file mode 100644 index 00000000000..89a62e78baa --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_normal.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test new file mode 100644 index 00000000000..63f0b8ad404 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_primary.test @@ -0,0 +1,48 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries DISABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test new file mode 100644 index 00000000000..9d0f1f3dc1a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_disable_keys_updating.test @@ -0,0 +1,42 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 ( + c1 int NOT NULL, + c2 text NOT NULL, + c3 int NOT NULL, + c4 int NOT NULL, + PRIMARY KEY(c1), + KEY idx1(c3,c4), + FULLTEXT KEY ft1(c2) +) COMMENT='ENGINE "MyISAM"' DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES(1, 'test1', 1, 1); +INSERT INTO t1 VALUES(2, 'test2', 2, 2); +INSERT INTO t1 VALUES(3, 'test3', 1, 3); +ALTER TABLE t1 DISABLE KEYS; +DELETE FROM t1 WHERE c1 = 2; +UPDATE t1 SET c4 = 4 WHERE c1 = 1; +INSERT INTO t1 VALUES(4, 'test4', 2, 4); +TRUNCATE t1; +DROP TABLE t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test new file mode 100644 index 00000000000..41a09b8721b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_drop_column.test @@ -0,0 +1,45 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; + +ALTER TABLE diaries DROP COLUMN body; +SHOW CREATE TABLE diaries; +SELECT * FROM diaries; + +INSERT INTO diaries (title) values ("groonga (1)"); +INSERT INTO diaries (title) values ("groonga (2)"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test new file mode 100644 index 00000000000..293bc8b7963 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_fulltext.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + FULLTEXT KEY title_index (title) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_index) + WHERE MATCH (title) AGAINST ("富士山"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test new file mode 100644 index 00000000000..0756c27f9f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_lock_tables.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +CREATE TABLE IF NOT EXISTS memos ( + id VARCHAR(45) NOT NULL PRIMARY KEY, + text TEXT NOT NULL, + FULLTEXT KEY (text) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +LOCK TABLES memos WRITE; +ALTER TABLE memos DISABLE KEYS; + +INSERT INTO memos + VALUES (00000, 'text0'), + (00001, 'text1'), + (00002, 'text2'); + +ALTER TABLE memos ENABLE KEYS; +UNLOCK TABLES; + +SELECT * FROM memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test new file mode 100644 index 00000000000..f8b93e19000 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_multiple_column.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY title_and_created_at_index (title, created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (title_and_created_at_index) + WHERE title = "天気" AND + created_at = "2012-04-30 23:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test new file mode 100644 index 00000000000..3dd0f332fe6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_normal.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + created_at datetime, + KEY created_at_index (created_at) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello", "2012-04-30 20:00:00"); +INSERT INTO diaries VALUES (2, "天気" , "2012-04-30 23:00:00"); +INSERT INTO diaries VALUES (3, "富士山", "2012-04-30 19:00:00"); + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (created_at_index) + WHERE created_at = "2012-04-30 20:00:00"; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test new file mode 100644 index 00000000000..bfa11c9eb8c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_enable_keys_primary.test @@ -0,0 +1,50 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255) +) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; + +ALTER TABLE diaries DISABLE KEYS; + +INSERT INTO diaries VALUES (1, "Hello"); +INSERT INTO diaries VALUES (2, "天気"); +INSERT INTO diaries VALUES (3, "富士山"); + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +ALTER TABLE diaries ENABLE KEYS; + +SELECT * + FROM diaries + FORCE INDEX (PRIMARY) + WHERE id = 2; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test new file mode 100644 index 00000000000..f4bd0b391b6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_fulltext.test @@ -0,0 +1,57 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + FULLTEXT INDEX title_index (title) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("survey"); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD COLUMN body TEXT; +UPDATE diaries SET body = "will start groonga!"; +SELECT * FROM diaries; + +INSERT INTO diaries (title, body) values ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) values ("groonga (2)", "started groonga."); +SELECT * FROM diaries; + +ALTER TABLE diaries ADD FULLTEXT INDEX body_index (body); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +SHOW CREATE TABLE diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test new file mode 100644 index 00000000000..595a850ae03 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_rename_table.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries, memos; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +ALTER TABLE diaries RENAME memos; +SELECT * FROM memos; +SELECT * FROM memos + WHERE MATCH(title) AGAINST("groonga") AND + MATCH(body) AGAINST("starting"); + +SHOW CREATE TABLE memos; + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test new file mode 100644 index 00000000000..37ea8aaf149 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_spatial.test @@ -0,0 +1,150 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS shops; +--enable_warnings + +CREATE TABLE shops ( + id INT PRIMARY KEY AUTO_INCREMENT, + name TEXT, + location GEOMETRY NOT NULL +) COMMENT = 'ENGINE "InnoDB"'; + +INSERT INTO shops (name, location) + VALUES ('nezu-no-taiyaki', + GeomFromText('POINT(139.762573 35.720253)')); +INSERT INTO shops (name, location) + VALUES ('taiyaki-kataoka', + GeomFromText('POINT(139.715591 35.712521)')); +INSERT INTO shops (name, location) + VALUES ('soba-taiyaki-ku', + GeomFromText('POINT(139.659088 35.683712)')); +INSERT INTO shops (name, location) + VALUES ('kuruma', + GeomFromText('POINT(139.706207 35.721516)')); +INSERT INTO shops (name, location) + VALUES ('hirose-ya', + GeomFromText('POINT(139.685608 35.714844)')); +INSERT INTO shops (name, location) + VALUES ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +INSERT INTO shops (name, location) + VALUES ('omede-taiyaki', + GeomFromText('POINT(139.817154 35.700516)')); +INSERT INTO shops (name, location) + VALUES ('onaga-ya', + GeomFromText('POINT(139.81105 35.698254)')); +INSERT INTO shops (name, location) + VALUES ('shiro-ya', + GeomFromText('POINT(139.638611 35.705517)')); +INSERT INTO shops (name, location) + VALUES ('fuji-ya', + GeomFromText('POINT(139.637115 35.703938)')); +INSERT INTO shops (name, location) + VALUES ('miyoshi', + GeomFromText('POINT(139.537323 35.644539)')); +INSERT INTO shops (name, location) + VALUES ('juju-ya', + GeomFromText('POINT(139.695755 35.628922)')); +INSERT INTO shops (name, location) + VALUES ('tatsumi-ya', + GeomFromText('POINT(139.638657 35.665501)')); +INSERT INTO shops (name, location) + VALUES ('tetsuji', + GeomFromText('POINT(139.76857 35.680912)')); +INSERT INTO shops (name, location) + VALUES ('gazuma-ya', + GeomFromText('POINT(139.647598 35.700817)')); +INSERT INTO shops (name, location) + VALUES ('honma-mon', + GeomFromText('POINT(139.652573 35.722736)')); +INSERT INTO shops (name, location) + VALUES ('naniwa-ya', + GeomFromText('POINT(139.796234 35.730061)')); +INSERT INTO shops (name, location) + VALUES ('kuro-dai', + GeomFromText('POINT(139.704834 35.650345)')); +INSERT INTO shops (name, location) + VALUES ('daruma', + GeomFromText('POINT(139.770599 35.681461)')); +INSERT INTO shops (name, location) + VALUES ('yanagi-ya', + GeomFromText('POINT(139.783981 35.685341)')); +INSERT INTO shops (name, location) + VALUES ('sharaku', + GeomFromText('POINT(139.794846 35.716969)')); +INSERT INTO shops (name, location) + VALUES ('takane', + GeomFromText('POINT(139.560913 35.698601)')); +INSERT INTO shops (name, location) + VALUES ('chiyoda', + GeomFromText('POINT(139.652817 35.642601)')); +INSERT INTO shops (name, location) + VALUES ('da-ka-po', + GeomFromText('POINT(139.727356 35.627346)')); +INSERT INTO shops (name, location) + VALUES ('matsushima-ya', + GeomFromText('POINT(139.737381 35.640556)')); +INSERT INTO shops (name, location) + VALUES ('kazuya', + GeomFromText('POINT(139.760895 35.673508)')); +INSERT INTO shops (name, location) + VALUES ('furuya-kogane-an', + GeomFromText('POINT(139.676071 35.680603)')); +INSERT INTO shops (name, location) + VALUES ('hachi-no-ie', + GeomFromText('POINT(139.668106 35.608021)')); +INSERT INTO shops (name, location) + VALUES ('azuki-chan', + GeomFromText('POINT(139.673203 35.64151)')); +INSERT INTO shops (name, location) + VALUES ('kuriko-an', + GeomFromText('POINT(139.796829 35.712013)')); +INSERT INTO shops (name, location) + VALUES ('yume-no-aru-machi-no-taiyaki-ya-san', + GeomFromText('POINT(139.712524 35.616199)')); +INSERT INTO shops (name, location) + VALUES ('naze-ya', + GeomFromText('POINT(139.665833 35.609039)')); +INSERT INTO shops (name, location) + VALUES ('sanoki-ya', + GeomFromText('POINT(139.770721 35.66592)')); +INSERT INTO shops (name, location) + VALUES ('shigeta', + GeomFromText('POINT(139.780273 35.672626)')); +INSERT INTO shops (name, location) + VALUES ('nishimi-ya', + GeomFromText('POINT(139.774628 35.671825)')); +INSERT INTO shops (name, location) + VALUES ('hiiragi', + GeomFromText('POINT(139.711517 35.647701)')); + +ALTER TABLE shops ADD SPATIAL KEY location_index (location); + +SELECT id, name, AsText(location) AS location_text FROM shops + WHERE MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location); + +SHOW CREATE TABLE shops; + +DROP TABLE shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test new file mode 100644 index 00000000000..e702cb5d591 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/auto_increment_text.test @@ -0,0 +1,34 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text +) comment = 'engine "innodb"'; +insert into diaries (body) values ("started groonga (long text)"); +select * from diaries; +insert into diaries (body) values ("sleeping... (short text)"); +select * from diaries; +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..230ab87b391 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test @@ -0,0 +1,55 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +show variables like 'log_bin'; + +set binlog_format="STATEMENT"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="ROW"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +set binlog_format="MIXED"; + +create table t1 (c1 int primary key, c2 int) engine = mroonga COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +insert into t1 values(2,100); +commit; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test new file mode 100644 index 00000000000..3bc3c069705 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_comment_index_not_for_mroonga.test @@ -0,0 +1,37 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64), + INDEX (tag) COMMENT 'Tag search is required.' +) DEFAULT CHARSET=utf8 + COMMENT='engine "InnoDB"'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test new file mode 100644 index 00000000000..73065ffd7bb --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_normal_comment.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY, + tag VARCHAR(64) COMMENT 'It must consist of only alphabet and number.' +) DEFAULT CHARSET=utf8 COMMENT='engine "InnoDB"'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test new file mode 100644 index 00000000000..f8b77becdde --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/count_star_with_index.test @@ -0,0 +1,54 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries_innodb; +DROP TABLE IF EXISTS diaries_mroonga; +--enable_warnings + +CREATE TABLE diaries_innodb ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) ENGINE = InnoDB DEFAULT CHARSET UTF8; + +CREATE TABLE diaries_mroonga ( + id INT PRIMARY KEY AUTO_INCREMENT, + body TEXT, + flag TINYINT(2), + INDEX (flag) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; + +INSERT INTO diaries_innodb (body) VALUES ("will start groonga!"); +INSERT INTO diaries_innodb (body) VALUES ("starting groonga..."); +INSERT INTO diaries_innodb (body) VALUES ("started groonga."); + +INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); +INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); +INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); + +EXPLAIN SELECT COUNT(*) FROM diaries_innodb; +EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; + +DROP TABLE diaries_innodb; +DROP TABLE diaries_mroonga; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..6df44e79665 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_TODO_SPLIT_ME.test @@ -0,0 +1,99 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# simple test +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key) COMMENT = 'engine "innodb"'; +create table t3 (c1 int primary key) COMMENT = 'engine "innodb"'; +drop table t1,t2,t3; +create table t1 (c1 int primary key, c2 int, c3 int) COMMENT = 'engine "innodb"'; +drop table t1; + +# data type support +create table t1 (c1 bit primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 decimal primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 char(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 varchar(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 binary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 varbinary(10) primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 enum("yes","no") primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; +create table t1 (c1 set("A","B","AB","O") primary key) COMMENT = 'engine "innodb"'; +desc t1; +drop table t1; + +# error test +--error ER_REQUIRES_PRIMARY_KEY +create table t1 (c1 int) COMMENT = 'engine "innodb"'; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test new file mode 100644 index 00000000000..f9a7dc3168b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -0,0 +1,35 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS bugs; +--enable_warnings + +CREATE TABLE bugs ( + id INT UNSIGNED PRIMARY KEY +) DEFAULT CHARSET=utf8 + COMMENT='Free style normal comment, engine "InnoDB"'; + +SHOW CREATE TABLE bugs; + +DROP TABLE bugs; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test new file mode 100644 index 00000000000..c4265ffd22e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_normalizer_fulltext_index.test @@ -0,0 +1,43 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE diaries ( + day DATE PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'normalizer "NormalizerAuto"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +INSERT INTO diaries VALUES ("2013-04-23", "ブラックコーヒーを飲んã ã€‚"); + +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ãµã‚‰ã¤ã" IN BOOLEAN MODE); +SELECT * FROM diaries + WHERE MATCH (content) AGAINST ("+ブラック" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test new file mode 100644 index 00000000000..9ba941f8701 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_multiple_token_filters.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test new file mode 100644 index 00000000000..91ac84c04d5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_comment_one_token_filter.test @@ -0,0 +1,42 @@ +# Copyright(C) 2014 Naoya Murakami +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/load_mroonga_functions.inc + +--disable_query_log +DROP DATABASE test; +CREATE DATABASE test; +USE test; +--enable_query_log + +SELECT mroonga_command("register token_filters/stop_word"); + +SET NAMES utf8; + +CREATE TABLE memos ( + id INT NOT NULL PRIMARY KEY, + content VARCHAR(64) NOT NULL, + FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' +) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; + +SELECT mroonga_command("dump"); + +DROP TABLE memos; + +--source ../../include/mroonga/unload_mroonga_functions.inc +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..1e82a2dff60 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_TODO_SPLIT_ME.test @@ -0,0 +1,59 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int) COMMENT 'engine = "innodb"'; +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +insert into t1 values (4, 102); +select * from t1; + +delete from t1 where c1=3; +select * from t1; + +flush tables; + +delete from t1 where c1=2; +select * from t1; + +delete from t1; +select * from t1; + +drop table t1; + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT 'engine = "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +select * from t1 where match(c2) against("ki"); +delete from t1 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test new file mode 100644 index 00000000000..c77a9cdeac3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/delete_all.test @@ -0,0 +1,44 @@ +# Copyright(C) 2014 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS users; +--enable_warnings + +SET NAMES utf8; + +CREATE TABLE users ( + id int PRIMARY KEY, + name varchar(100), + FULLTEXT INDEX (name) +) COMMENT 'engine = "InnoDB"' DEFAULT CHARSET=utf8; + +INSERT INTO users VALUES (1, 'Alice'); +INSERT INTO users VALUES (2, 'Bob'); +INSERT INTO users VALUES (3, 'Chris'); + +SELECT * FROM users; + +DELETE FROM users; + +SELECT * FROM users; + +DROP TABLE users; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test new file mode 100644 index 00000000000..fb55d609855 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_leading_not.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT * FROM diaries WHERE MATCH(content) AGAINST("-明日 +天気" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test new file mode 100644 index 00000000000..483cca04c8a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_multiple_match_against.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title), + FULLTEXT INDEX (content) +) DEFAULT CHARSET = UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, "富士山", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気 1月1日", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "天気 4月4日", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT COUNT(*) FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +SELECT * FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); +SELECT 1 FROM diaries WHERE MATCH(title) AGAINST("+天気" IN BOOLEAN MODE) AND MATCH(content) AGAINST("+今日" IN BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test new file mode 100644 index 00000000000..2e96b8ed4f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_no_operator.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- fine is be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test new file mode 100644 index 00000000000..6eb46419c4d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_or.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- is OR be fine" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test new file mode 100644 index 00000000000..301365610c5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_minus_with_plus.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Yesterday was good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D- good +day be" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test new file mode 100644 index 00000000000..6a89d7556ab --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_no_operator.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test new file mode 100644 index 00000000000..790d2f1c9a9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_minus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today -good tomorrow" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test new file mode 100644 index 00000000000..a45c414580d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_or_with_plus.test @@ -0,0 +1,42 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be fine."); +INSERT INTO memos VALUES (NULL, "Yesterday was fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*DOR today +good tomorrow" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test new file mode 100644 index 00000000000..d013578a8f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_no_operator.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today good" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test new file mode 100644 index 00000000000..91b0a7f7891 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_minus.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today -good is" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test new file mode 100644 index 00000000000..29c1c0d9d98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_default_operator_plus_with_or.test @@ -0,0 +1,40 @@ +# Copyright(C) 2011-2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS memos; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE memos ( + id INT PRIMARY KEY AUTO_INCREMENT, + content TEXT, + FULLTEXT INDEX (content) +) DEFAULT CHARSET=utf8 COMMENT='engine "InnODB"'; + +INSERT INTO memos VALUES (NULL, "Today is good day."); +INSERT INTO memos VALUES (NULL, "Tomorrow will be good day."); +INSERT INTO memos VALUES (NULL, "Today is fine."); + +SELECT * FROM memos + WHERE MATCH (content) AGAINST ("*D+ today OR tomorrow day" IN BOOLEAN MODE); + +DROP TABLE memos; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test new file mode 100644 index 00000000000..027b05d5320 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_full_spec.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:10,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test new file mode 100644 index 00000000000..41b814de80f --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_no_weight.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1,2:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test new file mode 100644 index 00000000000..1db4134d0a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_boolean_mode_pragma_weight_omit_section.test @@ -0,0 +1,44 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id INT PRIMARY KEY, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX (title, content) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; + +INSERT INTO diaries VALUES(1, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT *, MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE) AS score + FROM diaries + WHERE MATCH(title, content) + AGAINST("*W1:2 +天気" in BOOLEAN MODE); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test new file mode 100644 index 00000000000..33e23e801ff --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_ascii.test @@ -0,0 +1,38 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su"); +select * from t1 where match(c3) against("ii"); +select * from t1 where match(c3) against("+su" in boolean mode); +select * from t1 where match(c3) against("+ii" in boolean mode); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test new file mode 100644 index 00000000000..75853611f69 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_cp932.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_cp932.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names cp932; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset cp932 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚ɂ‚¢‚Ä","‚ ‚ ‚ ‚ ‚ ‚ ‚ "); +insert into t1 values(2, "‚¢‚¢‚¢‚¢‚¢","–¾“ú‚Ì•xŽmŽR‚Ì“V‹C‚Í•ª‚©‚è‚Ü‚¹‚ñ"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("•xŽmŽR"); +select * from t1 where match(c3) against("•xŽmŽR"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test new file mode 100644 index 00000000000..3f1cba869f8 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_eucjpms.test @@ -0,0 +1,35 @@ +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_eucjpms.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names eucjpms; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset eucjpms COMMENT = 'engine "innodb"'; +insert into t1 values(1, "ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ë¤Ä¤¤¤Æ","¤¢¤¢¤¢¤¢¤¢¤¢¤¢"); +insert into t1 values(2, "¤¤¤¤¤¤¤¤¤¤","ÌÀÆü¤ÎÉٻ볤ÎÅ·µ¤¤Ïʬ¤«¤ê¤Þ¤»¤ó"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("Éٻλ³"); +select * from t1 where match(c3) against("Éٻλ³"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test new file mode 100644 index 00000000000..27524ac2ed0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_charset_japanese.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山"); +select * from t1 where match(c3) against("富士山"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test new file mode 100644 index 00000000000..0115ed0699c --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_index_recreate.test @@ -0,0 +1,51 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES utf8; +CREATE TABLE diaries ( + id int PRIMARY KEY, + title varchar(255), + content text, + FULLTEXT INDEX (title) +) DEFAULT CHARSET=utf8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES (1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES (2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES (3, "富士山", "今日もãれã„。"); + +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); + +DROP INDEX title ON diaries; + +--error ER_FT_MATCHING_KEY_NOT_FOUND +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +SELECT * FROM diaries; + +CREATE FULLTEXT INDEX new_title_index ON diaries (title); +SELECT * FROM diaries WHERE MATCH (title) AGAINST ("富士山"); +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test new file mode 100644 index 00000000000..6037ab61da0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_select.test @@ -0,0 +1,47 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "innodb"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +drop table t1,t2; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test new file mode 100644 index 00000000000..43237cdc96a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_insert_values.test @@ -0,0 +1,35 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "innodb"'; +show create table t1; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test new file mode 100644 index 00000000000..c12441f3c5a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_many_records.test @@ -0,0 +1,4136 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + fulltext index (title) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; + +set autocommit=0; +insert into diaries values(0, "2011-07-14"); +insert into diaries values(1, "2011-07-15"); +insert into diaries values(2, "2011-07-16"); +insert into diaries values(3, "2011-07-17"); +insert into diaries values(4, "2011-07-18"); +insert into diaries values(5, "2011-07-19"); +insert into diaries values(6, "2011-07-20"); +insert into diaries values(7, "2011-07-21"); +insert into diaries values(8, "2011-07-22"); +insert into diaries values(9, "2011-07-23"); +insert into diaries values(10, "2011-07-24"); +insert into diaries values(11, "2011-07-25"); +insert into diaries values(12, "2011-07-26"); +insert into diaries values(13, "2011-07-27"); +insert into diaries values(14, "2011-07-28"); +insert into diaries values(15, "2011-07-29"); +insert into diaries values(16, "2011-07-30"); +insert into diaries values(17, "2011-07-31"); +insert into diaries values(18, "2011-08-01"); +insert into diaries values(19, "2011-08-02"); +insert into diaries values(20, "2011-08-03"); +insert into diaries values(21, "2011-08-04"); +insert into diaries values(22, "2011-08-05"); +insert into diaries values(23, "2011-08-06"); +insert into diaries values(24, "2011-08-07"); +insert into diaries values(25, "2011-08-08"); +insert into diaries values(26, "2011-08-09"); +insert into diaries values(27, "2011-08-10"); +insert into diaries values(28, "2011-08-11"); +insert into diaries values(29, "2011-08-12"); +insert into diaries values(30, "2011-08-13"); +insert into diaries values(31, "2011-08-14"); +insert into diaries values(32, "2011-08-15"); +insert into diaries values(33, "2011-08-16"); +insert into diaries values(34, "2011-08-17"); +insert into diaries values(35, "2011-08-18"); +insert into diaries values(36, "2011-08-19"); +insert into diaries values(37, "2011-08-20"); +insert into diaries values(38, "2011-08-21"); +insert into diaries values(39, "2011-08-22"); +insert into diaries values(40, "2011-08-23"); +insert into diaries values(41, "2011-08-24"); +insert into diaries values(42, "2011-08-25"); +insert into diaries values(43, "2011-08-26"); +insert into diaries values(44, "2011-08-27"); +insert into diaries values(45, "2011-08-28"); +insert into diaries values(46, "2011-08-29"); +insert into diaries values(47, "2011-08-30"); +insert into diaries values(48, "2011-08-31"); +insert into diaries values(49, "2011-09-01"); +insert into diaries values(50, "2011-09-02"); +insert into diaries values(51, "2011-09-03"); +insert into diaries values(52, "2011-09-04"); +insert into diaries values(53, "2011-09-05"); +insert into diaries values(54, "2011-09-06"); +insert into diaries values(55, "2011-09-07"); +insert into diaries values(56, "2011-09-08"); +insert into diaries values(57, "2011-09-09"); +insert into diaries values(58, "2011-09-10"); +insert into diaries values(59, "2011-09-11"); +insert into diaries values(60, "2011-09-12"); +insert into diaries values(61, "2011-09-13"); +insert into diaries values(62, "2011-09-14"); +insert into diaries values(63, "2011-09-15"); +insert into diaries values(64, "2011-09-16"); +insert into diaries values(65, "2011-09-17"); +insert into diaries values(66, "2011-09-18"); +insert into diaries values(67, "2011-09-19"); +insert into diaries values(68, "2011-09-20"); +insert into diaries values(69, "2011-09-21"); +insert into diaries values(70, "2011-09-22"); +insert into diaries values(71, "2011-09-23"); +insert into diaries values(72, "2011-09-24"); +insert into diaries values(73, "2011-09-25"); +insert into diaries values(74, "2011-09-26"); +insert into diaries values(75, "2011-09-27"); +insert into diaries values(76, "2011-09-28"); +insert into diaries values(77, "2011-09-29"); +insert into diaries values(78, "2011-09-30"); +insert into diaries values(79, "2011-10-01"); +insert into diaries values(80, "2011-10-02"); +insert into diaries values(81, "2011-10-03"); +insert into diaries values(82, "2011-10-04"); +insert into diaries values(83, "2011-10-05"); +insert into diaries values(84, "2011-10-06"); +insert into diaries values(85, "2011-10-07"); +insert into diaries values(86, "2011-10-08"); +insert into diaries values(87, "2011-10-09"); +insert into diaries values(88, "2011-10-10"); +insert into diaries values(89, "2011-10-11"); +insert into diaries values(90, "2011-10-12"); +insert into diaries values(91, "2011-10-13"); +insert into diaries values(92, "2011-10-14"); +insert into diaries values(93, "2011-10-15"); +insert into diaries values(94, "2011-10-16"); +insert into diaries values(95, "2011-10-17"); +insert into diaries values(96, "2011-10-18"); +insert into diaries values(97, "2011-10-19"); +insert into diaries values(98, "2011-10-20"); +insert into diaries values(99, "2011-10-21"); +insert into diaries values(100, "2011-10-22"); +insert into diaries values(101, "2011-10-23"); +insert into diaries values(102, "2011-10-24"); +insert into diaries values(103, "2011-10-25"); +insert into diaries values(104, "2011-10-26"); +insert into diaries values(105, "2011-10-27"); +insert into diaries values(106, "2011-10-28"); +insert into diaries values(107, "2011-10-29"); +insert into diaries values(108, "2011-10-30"); +insert into diaries values(109, "2011-10-31"); +insert into diaries values(110, "2011-11-01"); +insert into diaries values(111, "2011-11-02"); +insert into diaries values(112, "2011-11-03"); +insert into diaries values(113, "2011-11-04"); +insert into diaries values(114, "2011-11-05"); +insert into diaries values(115, "2011-11-06"); +insert into diaries values(116, "2011-11-07"); +insert into diaries values(117, "2011-11-08"); +insert into diaries values(118, "2011-11-09"); +insert into diaries values(119, "2011-11-10"); +insert into diaries values(120, "2011-11-11"); +insert into diaries values(121, "2011-11-12"); +insert into diaries values(122, "2011-11-13"); +insert into diaries values(123, "2011-11-14"); +insert into diaries values(124, "2011-11-15"); +insert into diaries values(125, "2011-11-16"); +insert into diaries values(126, "2011-11-17"); +insert into diaries values(127, "2011-11-18"); +insert into diaries values(128, "2011-11-19"); +insert into diaries values(129, "2011-11-20"); +insert into diaries values(130, "2011-11-21"); +insert into diaries values(131, "2011-11-22"); +insert into diaries values(132, "2011-11-23"); +insert into diaries values(133, "2011-11-24"); +insert into diaries values(134, "2011-11-25"); +insert into diaries values(135, "2011-11-26"); +insert into diaries values(136, "2011-11-27"); +insert into diaries values(137, "2011-11-28"); +insert into diaries values(138, "2011-11-29"); +insert into diaries values(139, "2011-11-30"); +insert into diaries values(140, "2011-12-01"); +insert into diaries values(141, "2011-12-02"); +insert into diaries values(142, "2011-12-03"); +insert into diaries values(143, "2011-12-04"); +insert into diaries values(144, "2011-12-05"); +insert into diaries values(145, "2011-12-06"); +insert into diaries values(146, "2011-12-07"); +insert into diaries values(147, "2011-12-08"); +insert into diaries values(148, "2011-12-09"); +insert into diaries values(149, "2011-12-10"); +insert into diaries values(150, "2011-12-11"); +insert into diaries values(151, "2011-12-12"); +insert into diaries values(152, "2011-12-13"); +insert into diaries values(153, "2011-12-14"); +insert into diaries values(154, "2011-12-15"); +insert into diaries values(155, "2011-12-16"); +insert into diaries values(156, "2011-12-17"); +insert into diaries values(157, "2011-12-18"); +insert into diaries values(158, "2011-12-19"); +insert into diaries values(159, "2011-12-20"); +insert into diaries values(160, "2011-12-21"); +insert into diaries values(161, "2011-12-22"); +insert into diaries values(162, "2011-12-23"); +insert into diaries values(163, "2011-12-24"); +insert into diaries values(164, "2011-12-25"); +insert into diaries values(165, "2011-12-26"); +insert into diaries values(166, "2011-12-27"); +insert into diaries values(167, "2011-12-28"); +insert into diaries values(168, "2011-12-29"); +insert into diaries values(169, "2011-12-30"); +insert into diaries values(170, "2011-12-31"); +insert into diaries values(171, "2012-01-01"); +insert into diaries values(172, "2012-01-02"); +insert into diaries values(173, "2012-01-03"); +insert into diaries values(174, "2012-01-04"); +insert into diaries values(175, "2012-01-05"); +insert into diaries values(176, "2012-01-06"); +insert into diaries values(177, "2012-01-07"); +insert into diaries values(178, "2012-01-08"); +insert into diaries values(179, "2012-01-09"); +insert into diaries values(180, "2012-01-10"); +insert into diaries values(181, "2012-01-11"); +insert into diaries values(182, "2012-01-12"); +insert into diaries values(183, "2012-01-13"); +insert into diaries values(184, "2012-01-14"); +insert into diaries values(185, "2012-01-15"); +insert into diaries values(186, "2012-01-16"); +insert into diaries values(187, "2012-01-17"); +insert into diaries values(188, "2012-01-18"); +insert into diaries values(189, "2012-01-19"); +insert into diaries values(190, "2012-01-20"); +insert into diaries values(191, "2012-01-21"); +insert into diaries values(192, "2012-01-22"); +insert into diaries values(193, "2012-01-23"); +insert into diaries values(194, "2012-01-24"); +insert into diaries values(195, "2012-01-25"); +insert into diaries values(196, "2012-01-26"); +insert into diaries values(197, "2012-01-27"); +insert into diaries values(198, "2012-01-28"); +insert into diaries values(199, "2012-01-29"); +insert into diaries values(200, "2012-01-30"); +insert into diaries values(201, "2012-01-31"); +insert into diaries values(202, "2012-02-01"); +insert into diaries values(203, "2012-02-02"); +insert into diaries values(204, "2012-02-03"); +insert into diaries values(205, "2012-02-04"); +insert into diaries values(206, "2012-02-05"); +insert into diaries values(207, "2012-02-06"); +insert into diaries values(208, "2012-02-07"); +insert into diaries values(209, "2012-02-08"); +insert into diaries values(210, "2012-02-09"); +insert into diaries values(211, "2012-02-10"); +insert into diaries values(212, "2012-02-11"); +insert into diaries values(213, "2012-02-12"); +insert into diaries values(214, "2012-02-13"); +insert into diaries values(215, "2012-02-14"); +insert into diaries values(216, "2012-02-15"); +insert into diaries values(217, "2012-02-16"); +insert into diaries values(218, "2012-02-17"); +insert into diaries values(219, "2012-02-18"); +insert into diaries values(220, "2012-02-19"); +insert into diaries values(221, "2012-02-20"); +insert into diaries values(222, "2012-02-21"); +insert into diaries values(223, "2012-02-22"); +insert into diaries values(224, "2012-02-23"); +insert into diaries values(225, "2012-02-24"); +insert into diaries values(226, "2012-02-25"); +insert into diaries values(227, "2012-02-26"); +insert into diaries values(228, "2012-02-27"); +insert into diaries values(229, "2012-02-28"); +insert into diaries values(230, "2012-02-29"); +insert into diaries values(231, "2012-03-01"); +insert into diaries values(232, "2012-03-02"); +insert into diaries values(233, "2012-03-03"); +insert into diaries values(234, "2012-03-04"); +insert into diaries values(235, "2012-03-05"); +insert into diaries values(236, "2012-03-06"); +insert into diaries values(237, "2012-03-07"); +insert into diaries values(238, "2012-03-08"); +insert into diaries values(239, "2012-03-09"); +insert into diaries values(240, "2012-03-10"); +insert into diaries values(241, "2012-03-11"); +insert into diaries values(242, "2012-03-12"); +insert into diaries values(243, "2012-03-13"); +insert into diaries values(244, "2012-03-14"); +insert into diaries values(245, "2012-03-15"); +insert into diaries values(246, "2012-03-16"); +insert into diaries values(247, "2012-03-17"); +insert into diaries values(248, "2012-03-18"); +insert into diaries values(249, "2012-03-19"); +insert into diaries values(250, "2012-03-20"); +insert into diaries values(251, "2012-03-21"); +insert into diaries values(252, "2012-03-22"); +insert into diaries values(253, "2012-03-23"); +insert into diaries values(254, "2012-03-24"); +insert into diaries values(255, "2012-03-25"); +insert into diaries values(256, "2012-03-26"); +insert into diaries values(257, "2012-03-27"); +insert into diaries values(258, "2012-03-28"); +insert into diaries values(259, "2012-03-29"); +insert into diaries values(260, "2012-03-30"); +insert into diaries values(261, "2012-03-31"); +insert into diaries values(262, "2012-04-01"); +insert into diaries values(263, "2012-04-02"); +insert into diaries values(264, "2012-04-03"); +insert into diaries values(265, "2012-04-04"); +insert into diaries values(266, "2012-04-05"); +insert into diaries values(267, "2012-04-06"); +insert into diaries values(268, "2012-04-07"); +insert into diaries values(269, "2012-04-08"); +insert into diaries values(270, "2012-04-09"); +insert into diaries values(271, "2012-04-10"); +insert into diaries values(272, "2012-04-11"); +insert into diaries values(273, "2012-04-12"); +insert into diaries values(274, "2012-04-13"); +insert into diaries values(275, "2012-04-14"); +insert into diaries values(276, "2012-04-15"); +insert into diaries values(277, "2012-04-16"); +insert into diaries values(278, "2012-04-17"); +insert into diaries values(279, "2012-04-18"); +insert into diaries values(280, "2012-04-19"); +insert into diaries values(281, "2012-04-20"); +insert into diaries values(282, "2012-04-21"); +insert into diaries values(283, "2012-04-22"); +insert into diaries values(284, "2012-04-23"); +insert into diaries values(285, "2012-04-24"); +insert into diaries values(286, "2012-04-25"); +insert into diaries values(287, "2012-04-26"); +insert into diaries values(288, "2012-04-27"); +insert into diaries values(289, "2012-04-28"); +insert into diaries values(290, "2012-04-29"); +insert into diaries values(291, "2012-04-30"); +insert into diaries values(292, "2012-05-01"); +insert into diaries values(293, "2012-05-02"); +insert into diaries values(294, "2012-05-03"); +insert into diaries values(295, "2012-05-04"); +insert into diaries values(296, "2012-05-05"); +insert into diaries values(297, "2012-05-06"); +insert into diaries values(298, "2012-05-07"); +insert into diaries values(299, "2012-05-08"); +insert into diaries values(300, "2012-05-09"); +insert into diaries values(301, "2012-05-10"); +insert into diaries values(302, "2012-05-11"); +insert into diaries values(303, "2012-05-12"); +insert into diaries values(304, "2012-05-13"); +insert into diaries values(305, "2012-05-14"); +insert into diaries values(306, "2012-05-15"); +insert into diaries values(307, "2012-05-16"); +insert into diaries values(308, "2012-05-17"); +insert into diaries values(309, "2012-05-18"); +insert into diaries values(310, "2012-05-19"); +insert into diaries values(311, "2012-05-20"); +insert into diaries values(312, "2012-05-21"); +insert into diaries values(313, "2012-05-22"); +insert into diaries values(314, "2012-05-23"); +insert into diaries values(315, "2012-05-24"); +insert into diaries values(316, "2012-05-25"); +insert into diaries values(317, "2012-05-26"); +insert into diaries values(318, "2012-05-27"); +insert into diaries values(319, "2012-05-28"); +insert into diaries values(320, "2012-05-29"); +insert into diaries values(321, "2012-05-30"); +insert into diaries values(322, "2012-05-31"); +insert into diaries values(323, "2012-06-01"); +insert into diaries values(324, "2012-06-02"); +insert into diaries values(325, "2012-06-03"); +insert into diaries values(326, "2012-06-04"); +insert into diaries values(327, "2012-06-05"); +insert into diaries values(328, "2012-06-06"); +insert into diaries values(329, "2012-06-07"); +insert into diaries values(330, "2012-06-08"); +insert into diaries values(331, "2012-06-09"); +insert into diaries values(332, "2012-06-10"); +insert into diaries values(333, "2012-06-11"); +insert into diaries values(334, "2012-06-12"); +insert into diaries values(335, "2012-06-13"); +insert into diaries values(336, "2012-06-14"); +insert into diaries values(337, "2012-06-15"); +insert into diaries values(338, "2012-06-16"); +insert into diaries values(339, "2012-06-17"); +insert into diaries values(340, "2012-06-18"); +insert into diaries values(341, "2012-06-19"); +insert into diaries values(342, "2012-06-20"); +insert into diaries values(343, "2012-06-21"); +insert into diaries values(344, "2012-06-22"); +insert into diaries values(345, "2012-06-23"); +insert into diaries values(346, "2012-06-24"); +insert into diaries values(347, "2012-06-25"); +insert into diaries values(348, "2012-06-26"); +insert into diaries values(349, "2012-06-27"); +insert into diaries values(350, "2012-06-28"); +insert into diaries values(351, "2012-06-29"); +insert into diaries values(352, "2012-06-30"); +insert into diaries values(353, "2012-07-01"); +insert into diaries values(354, "2012-07-02"); +insert into diaries values(355, "2012-07-03"); +insert into diaries values(356, "2012-07-04"); +insert into diaries values(357, "2012-07-05"); +insert into diaries values(358, "2012-07-06"); +insert into diaries values(359, "2012-07-07"); +insert into diaries values(360, "2012-07-08"); +insert into diaries values(361, "2012-07-09"); +insert into diaries values(362, "2012-07-10"); +insert into diaries values(363, "2012-07-11"); +insert into diaries values(364, "2012-07-12"); +insert into diaries values(365, "2012-07-13"); +insert into diaries values(366, "2012-07-14"); +insert into diaries values(367, "2012-07-15"); +insert into diaries values(368, "2012-07-16"); +insert into diaries values(369, "2012-07-17"); +insert into diaries values(370, "2012-07-18"); +insert into diaries values(371, "2012-07-19"); +insert into diaries values(372, "2012-07-20"); +insert into diaries values(373, "2012-07-21"); +insert into diaries values(374, "2012-07-22"); +insert into diaries values(375, "2012-07-23"); +insert into diaries values(376, "2012-07-24"); +insert into diaries values(377, "2012-07-25"); +insert into diaries values(378, "2012-07-26"); +insert into diaries values(379, "2012-07-27"); +insert into diaries values(380, "2012-07-28"); +insert into diaries values(381, "2012-07-29"); +insert into diaries values(382, "2012-07-30"); +insert into diaries values(383, "2012-07-31"); +insert into diaries values(384, "2012-08-01"); +insert into diaries values(385, "2012-08-02"); +insert into diaries values(386, "2012-08-03"); +insert into diaries values(387, "2012-08-04"); +insert into diaries values(388, "2012-08-05"); +insert into diaries values(389, "2012-08-06"); +insert into diaries values(390, "2012-08-07"); +insert into diaries values(391, "2012-08-08"); +insert into diaries values(392, "2012-08-09"); +insert into diaries values(393, "2012-08-10"); +insert into diaries values(394, "2012-08-11"); +insert into diaries values(395, "2012-08-12"); +insert into diaries values(396, "2012-08-13"); +insert into diaries values(397, "2012-08-14"); +insert into diaries values(398, "2012-08-15"); +insert into diaries values(399, "2012-08-16"); +insert into diaries values(400, "2012-08-17"); +insert into diaries values(401, "2012-08-18"); +insert into diaries values(402, "2012-08-19"); +insert into diaries values(403, "2012-08-20"); +insert into diaries values(404, "2012-08-21"); +insert into diaries values(405, "2012-08-22"); +insert into diaries values(406, "2012-08-23"); +insert into diaries values(407, "2012-08-24"); +insert into diaries values(408, "2012-08-25"); +insert into diaries values(409, "2012-08-26"); +insert into diaries values(410, "2012-08-27"); +insert into diaries values(411, "2012-08-28"); +insert into diaries values(412, "2012-08-29"); +insert into diaries values(413, "2012-08-30"); +insert into diaries values(414, "2012-08-31"); +insert into diaries values(415, "2012-09-01"); +insert into diaries values(416, "2012-09-02"); +insert into diaries values(417, "2012-09-03"); +insert into diaries values(418, "2012-09-04"); +insert into diaries values(419, "2012-09-05"); +insert into diaries values(420, "2012-09-06"); +insert into diaries values(421, "2012-09-07"); +insert into diaries values(422, "2012-09-08"); +insert into diaries values(423, "2012-09-09"); +insert into diaries values(424, "2012-09-10"); +insert into diaries values(425, "2012-09-11"); +insert into diaries values(426, "2012-09-12"); +insert into diaries values(427, "2012-09-13"); +insert into diaries values(428, "2012-09-14"); +insert into diaries values(429, "2012-09-15"); +insert into diaries values(430, "2012-09-16"); +insert into diaries values(431, "2012-09-17"); +insert into diaries values(432, "2012-09-18"); +insert into diaries values(433, "2012-09-19"); +insert into diaries values(434, "2012-09-20"); +insert into diaries values(435, "2012-09-21"); +insert into diaries values(436, "2012-09-22"); +insert into diaries values(437, "2012-09-23"); +insert into diaries values(438, "2012-09-24"); +insert into diaries values(439, "2012-09-25"); +insert into diaries values(440, "2012-09-26"); +insert into diaries values(441, "2012-09-27"); +insert into diaries values(442, "2012-09-28"); +insert into diaries values(443, "2012-09-29"); +insert into diaries values(444, "2012-09-30"); +insert into diaries values(445, "2012-10-01"); +insert into diaries values(446, "2012-10-02"); +insert into diaries values(447, "2012-10-03"); +insert into diaries values(448, "2012-10-04"); +insert into diaries values(449, "2012-10-05"); +insert into diaries values(450, "2012-10-06"); +insert into diaries values(451, "2012-10-07"); +insert into diaries values(452, "2012-10-08"); +insert into diaries values(453, "2012-10-09"); +insert into diaries values(454, "2012-10-10"); +insert into diaries values(455, "2012-10-11"); +insert into diaries values(456, "2012-10-12"); +insert into diaries values(457, "2012-10-13"); +insert into diaries values(458, "2012-10-14"); +insert into diaries values(459, "2012-10-15"); +insert into diaries values(460, "2012-10-16"); +insert into diaries values(461, "2012-10-17"); +insert into diaries values(462, "2012-10-18"); +insert into diaries values(463, "2012-10-19"); +insert into diaries values(464, "2012-10-20"); +insert into diaries values(465, "2012-10-21"); +insert into diaries values(466, "2012-10-22"); +insert into diaries values(467, "2012-10-23"); +insert into diaries values(468, "2012-10-24"); +insert into diaries values(469, "2012-10-25"); +insert into diaries values(470, "2012-10-26"); +insert into diaries values(471, "2012-10-27"); +insert into diaries values(472, "2012-10-28"); +insert into diaries values(473, "2012-10-29"); +insert into diaries values(474, "2012-10-30"); +insert into diaries values(475, "2012-10-31"); +insert into diaries values(476, "2012-11-01"); +insert into diaries values(477, "2012-11-02"); +insert into diaries values(478, "2012-11-03"); +insert into diaries values(479, "2012-11-04"); +insert into diaries values(480, "2012-11-05"); +insert into diaries values(481, "2012-11-06"); +insert into diaries values(482, "2012-11-07"); +insert into diaries values(483, "2012-11-08"); +insert into diaries values(484, "2012-11-09"); +insert into diaries values(485, "2012-11-10"); +insert into diaries values(486, "2012-11-11"); +insert into diaries values(487, "2012-11-12"); +insert into diaries values(488, "2012-11-13"); +insert into diaries values(489, "2012-11-14"); +insert into diaries values(490, "2012-11-15"); +insert into diaries values(491, "2012-11-16"); +insert into diaries values(492, "2012-11-17"); +insert into diaries values(493, "2012-11-18"); +insert into diaries values(494, "2012-11-19"); +insert into diaries values(495, "2012-11-20"); +insert into diaries values(496, "2012-11-21"); +insert into diaries values(497, "2012-11-22"); +insert into diaries values(498, "2012-11-23"); +insert into diaries values(499, "2012-11-24"); +insert into diaries values(500, "2012-11-25"); +insert into diaries values(501, "2012-11-26"); +insert into diaries values(502, "2012-11-27"); +insert into diaries values(503, "2012-11-28"); +insert into diaries values(504, "2012-11-29"); +insert into diaries values(505, "2012-11-30"); +insert into diaries values(506, "2012-12-01"); +insert into diaries values(507, "2012-12-02"); +insert into diaries values(508, "2012-12-03"); +insert into diaries values(509, "2012-12-04"); +insert into diaries values(510, "2012-12-05"); +insert into diaries values(511, "2012-12-06"); +insert into diaries values(512, "2012-12-07"); +insert into diaries values(513, "2012-12-08"); +insert into diaries values(514, "2012-12-09"); +insert into diaries values(515, "2012-12-10"); +insert into diaries values(516, "2012-12-11"); +insert into diaries values(517, "2012-12-12"); +insert into diaries values(518, "2012-12-13"); +insert into diaries values(519, "2012-12-14"); +insert into diaries values(520, "2012-12-15"); +insert into diaries values(521, "2012-12-16"); +insert into diaries values(522, "2012-12-17"); +insert into diaries values(523, "2012-12-18"); +insert into diaries values(524, "2012-12-19"); +insert into diaries values(525, "2012-12-20"); +insert into diaries values(526, "2012-12-21"); +insert into diaries values(527, "2012-12-22"); +insert into diaries values(528, "2012-12-23"); +insert into diaries values(529, "2012-12-24"); +insert into diaries values(530, "2012-12-25"); +insert into diaries values(531, "2012-12-26"); +insert into diaries values(532, "2012-12-27"); +insert into diaries values(533, "2012-12-28"); +insert into diaries values(534, "2012-12-29"); +insert into diaries values(535, "2012-12-30"); +insert into diaries values(536, "2012-12-31"); +insert into diaries values(537, "2013-01-01"); +insert into diaries values(538, "2013-01-02"); +insert into diaries values(539, "2013-01-03"); +insert into diaries values(540, "2013-01-04"); +insert into diaries values(541, "2013-01-05"); +insert into diaries values(542, "2013-01-06"); +insert into diaries values(543, "2013-01-07"); +insert into diaries values(544, "2013-01-08"); +insert into diaries values(545, "2013-01-09"); +insert into diaries values(546, "2013-01-10"); +insert into diaries values(547, "2013-01-11"); +insert into diaries values(548, "2013-01-12"); +insert into diaries values(549, "2013-01-13"); +insert into diaries values(550, "2013-01-14"); +insert into diaries values(551, "2013-01-15"); +insert into diaries values(552, "2013-01-16"); +insert into diaries values(553, "2013-01-17"); +insert into diaries values(554, "2013-01-18"); +insert into diaries values(555, "2013-01-19"); +insert into diaries values(556, "2013-01-20"); +insert into diaries values(557, "2013-01-21"); +insert into diaries values(558, "2013-01-22"); +insert into diaries values(559, "2013-01-23"); +insert into diaries values(560, "2013-01-24"); +insert into diaries values(561, "2013-01-25"); +insert into diaries values(562, "2013-01-26"); +insert into diaries values(563, "2013-01-27"); +insert into diaries values(564, "2013-01-28"); +insert into diaries values(565, "2013-01-29"); +insert into diaries values(566, "2013-01-30"); +insert into diaries values(567, "2013-01-31"); +insert into diaries values(568, "2013-02-01"); +insert into diaries values(569, "2013-02-02"); +insert into diaries values(570, "2013-02-03"); +insert into diaries values(571, "2013-02-04"); +insert into diaries values(572, "2013-02-05"); +insert into diaries values(573, "2013-02-06"); +insert into diaries values(574, "2013-02-07"); +insert into diaries values(575, "2013-02-08"); +insert into diaries values(576, "2013-02-09"); +insert into diaries values(577, "2013-02-10"); +insert into diaries values(578, "2013-02-11"); +insert into diaries values(579, "2013-02-12"); +insert into diaries values(580, "2013-02-13"); +insert into diaries values(581, "2013-02-14"); +insert into diaries values(582, "2013-02-15"); +insert into diaries values(583, "2013-02-16"); +insert into diaries values(584, "2013-02-17"); +insert into diaries values(585, "2013-02-18"); +insert into diaries values(586, "2013-02-19"); +insert into diaries values(587, "2013-02-20"); +insert into diaries values(588, "2013-02-21"); +insert into diaries values(589, "2013-02-22"); +insert into diaries values(590, "2013-02-23"); +insert into diaries values(591, "2013-02-24"); +insert into diaries values(592, "2013-02-25"); +insert into diaries values(593, "2013-02-26"); +insert into diaries values(594, "2013-02-27"); +insert into diaries values(595, "2013-02-28"); +insert into diaries values(596, "2013-03-01"); +insert into diaries values(597, "2013-03-02"); +insert into diaries values(598, "2013-03-03"); +insert into diaries values(599, "2013-03-04"); +insert into diaries values(600, "2013-03-05"); +insert into diaries values(601, "2013-03-06"); +insert into diaries values(602, "2013-03-07"); +insert into diaries values(603, "2013-03-08"); +insert into diaries values(604, "2013-03-09"); +insert into diaries values(605, "2013-03-10"); +insert into diaries values(606, "2013-03-11"); +insert into diaries values(607, "2013-03-12"); +insert into diaries values(608, "2013-03-13"); +insert into diaries values(609, "2013-03-14"); +insert into diaries values(610, "2013-03-15"); +insert into diaries values(611, "2013-03-16"); +insert into diaries values(612, "2013-03-17"); +insert into diaries values(613, "2013-03-18"); +insert into diaries values(614, "2013-03-19"); +insert into diaries values(615, "2013-03-20"); +insert into diaries values(616, "2013-03-21"); +insert into diaries values(617, "2013-03-22"); +insert into diaries values(618, "2013-03-23"); +insert into diaries values(619, "2013-03-24"); +insert into diaries values(620, "2013-03-25"); +insert into diaries values(621, "2013-03-26"); +insert into diaries values(622, "2013-03-27"); +insert into diaries values(623, "2013-03-28"); +insert into diaries values(624, "2013-03-29"); +insert into diaries values(625, "2013-03-30"); +insert into diaries values(626, "2013-03-31"); +insert into diaries values(627, "2013-04-01"); +insert into diaries values(628, "2013-04-02"); +insert into diaries values(629, "2013-04-03"); +insert into diaries values(630, "2013-04-04"); +insert into diaries values(631, "2013-04-05"); +insert into diaries values(632, "2013-04-06"); +insert into diaries values(633, "2013-04-07"); +insert into diaries values(634, "2013-04-08"); +insert into diaries values(635, "2013-04-09"); +insert into diaries values(636, "2013-04-10"); +insert into diaries values(637, "2013-04-11"); +insert into diaries values(638, "2013-04-12"); +insert into diaries values(639, "2013-04-13"); +insert into diaries values(640, "2013-04-14"); +insert into diaries values(641, "2013-04-15"); +insert into diaries values(642, "2013-04-16"); +insert into diaries values(643, "2013-04-17"); +insert into diaries values(644, "2013-04-18"); +insert into diaries values(645, "2013-04-19"); +insert into diaries values(646, "2013-04-20"); +insert into diaries values(647, "2013-04-21"); +insert into diaries values(648, "2013-04-22"); +insert into diaries values(649, "2013-04-23"); +insert into diaries values(650, "2013-04-24"); +insert into diaries values(651, "2013-04-25"); +insert into diaries values(652, "2013-04-26"); +insert into diaries values(653, "2013-04-27"); +insert into diaries values(654, "2013-04-28"); +insert into diaries values(655, "2013-04-29"); +insert into diaries values(656, "2013-04-30"); +insert into diaries values(657, "2013-05-01"); +insert into diaries values(658, "2013-05-02"); +insert into diaries values(659, "2013-05-03"); +insert into diaries values(660, "2013-05-04"); +insert into diaries values(661, "2013-05-05"); +insert into diaries values(662, "2013-05-06"); +insert into diaries values(663, "2013-05-07"); +insert into diaries values(664, "2013-05-08"); +insert into diaries values(665, "2013-05-09"); +insert into diaries values(666, "2013-05-10"); +insert into diaries values(667, "2013-05-11"); +insert into diaries values(668, "2013-05-12"); +insert into diaries values(669, "2013-05-13"); +insert into diaries values(670, "2013-05-14"); +insert into diaries values(671, "2013-05-15"); +insert into diaries values(672, "2013-05-16"); +insert into diaries values(673, "2013-05-17"); +insert into diaries values(674, "2013-05-18"); +insert into diaries values(675, "2013-05-19"); +insert into diaries values(676, "2013-05-20"); +insert into diaries values(677, "2013-05-21"); +insert into diaries values(678, "2013-05-22"); +insert into diaries values(679, "2013-05-23"); +insert into diaries values(680, "2013-05-24"); +insert into diaries values(681, "2013-05-25"); +insert into diaries values(682, "2013-05-26"); +insert into diaries values(683, "2013-05-27"); +insert into diaries values(684, "2013-05-28"); +insert into diaries values(685, "2013-05-29"); +insert into diaries values(686, "2013-05-30"); +insert into diaries values(687, "2013-05-31"); +insert into diaries values(688, "2013-06-01"); +insert into diaries values(689, "2013-06-02"); +insert into diaries values(690, "2013-06-03"); +insert into diaries values(691, "2013-06-04"); +insert into diaries values(692, "2013-06-05"); +insert into diaries values(693, "2013-06-06"); +insert into diaries values(694, "2013-06-07"); +insert into diaries values(695, "2013-06-08"); +insert into diaries values(696, "2013-06-09"); +insert into diaries values(697, "2013-06-10"); +insert into diaries values(698, "2013-06-11"); +insert into diaries values(699, "2013-06-12"); +insert into diaries values(700, "2013-06-13"); +insert into diaries values(701, "2013-06-14"); +insert into diaries values(702, "2013-06-15"); +insert into diaries values(703, "2013-06-16"); +insert into diaries values(704, "2013-06-17"); +insert into diaries values(705, "2013-06-18"); +insert into diaries values(706, "2013-06-19"); +insert into diaries values(707, "2013-06-20"); +insert into diaries values(708, "2013-06-21"); +insert into diaries values(709, "2013-06-22"); +insert into diaries values(710, "2013-06-23"); +insert into diaries values(711, "2013-06-24"); +insert into diaries values(712, "2013-06-25"); +insert into diaries values(713, "2013-06-26"); +insert into diaries values(714, "2013-06-27"); +insert into diaries values(715, "2013-06-28"); +insert into diaries values(716, "2013-06-29"); +insert into diaries values(717, "2013-06-30"); +insert into diaries values(718, "2013-07-01"); +insert into diaries values(719, "2013-07-02"); +insert into diaries values(720, "2013-07-03"); +insert into diaries values(721, "2013-07-04"); +insert into diaries values(722, "2013-07-05"); +insert into diaries values(723, "2013-07-06"); +insert into diaries values(724, "2013-07-07"); +insert into diaries values(725, "2013-07-08"); +insert into diaries values(726, "2013-07-09"); +insert into diaries values(727, "2013-07-10"); +insert into diaries values(728, "2013-07-11"); +insert into diaries values(729, "2013-07-12"); +insert into diaries values(730, "2013-07-13"); +insert into diaries values(731, "2013-07-14"); +insert into diaries values(732, "2013-07-15"); +insert into diaries values(733, "2013-07-16"); +insert into diaries values(734, "2013-07-17"); +insert into diaries values(735, "2013-07-18"); +insert into diaries values(736, "2013-07-19"); +insert into diaries values(737, "2013-07-20"); +insert into diaries values(738, "2013-07-21"); +insert into diaries values(739, "2013-07-22"); +insert into diaries values(740, "2013-07-23"); +insert into diaries values(741, "2013-07-24"); +insert into diaries values(742, "2013-07-25"); +insert into diaries values(743, "2013-07-26"); +insert into diaries values(744, "2013-07-27"); +insert into diaries values(745, "2013-07-28"); +insert into diaries values(746, "2013-07-29"); +insert into diaries values(747, "2013-07-30"); +insert into diaries values(748, "2013-07-31"); +insert into diaries values(749, "2013-08-01"); +insert into diaries values(750, "2013-08-02"); +insert into diaries values(751, "2013-08-03"); +insert into diaries values(752, "2013-08-04"); +insert into diaries values(753, "2013-08-05"); +insert into diaries values(754, "2013-08-06"); +insert into diaries values(755, "2013-08-07"); +insert into diaries values(756, "2013-08-08"); +insert into diaries values(757, "2013-08-09"); +insert into diaries values(758, "2013-08-10"); +insert into diaries values(759, "2013-08-11"); +insert into diaries values(760, "2013-08-12"); +insert into diaries values(761, "2013-08-13"); +insert into diaries values(762, "2013-08-14"); +insert into diaries values(763, "2013-08-15"); +insert into diaries values(764, "2013-08-16"); +insert into diaries values(765, "2013-08-17"); +insert into diaries values(766, "2013-08-18"); +insert into diaries values(767, "2013-08-19"); +insert into diaries values(768, "2013-08-20"); +insert into diaries values(769, "2013-08-21"); +insert into diaries values(770, "2013-08-22"); +insert into diaries values(771, "2013-08-23"); +insert into diaries values(772, "2013-08-24"); +insert into diaries values(773, "2013-08-25"); +insert into diaries values(774, "2013-08-26"); +insert into diaries values(775, "2013-08-27"); +insert into diaries values(776, "2013-08-28"); +insert into diaries values(777, "2013-08-29"); +insert into diaries values(778, "2013-08-30"); +insert into diaries values(779, "2013-08-31"); +insert into diaries values(780, "2013-09-01"); +insert into diaries values(781, "2013-09-02"); +insert into diaries values(782, "2013-09-03"); +insert into diaries values(783, "2013-09-04"); +insert into diaries values(784, "2013-09-05"); +insert into diaries values(785, "2013-09-06"); +insert into diaries values(786, "2013-09-07"); +insert into diaries values(787, "2013-09-08"); +insert into diaries values(788, "2013-09-09"); +insert into diaries values(789, "2013-09-10"); +insert into diaries values(790, "2013-09-11"); +insert into diaries values(791, "2013-09-12"); +insert into diaries values(792, "2013-09-13"); +insert into diaries values(793, "2013-09-14"); +insert into diaries values(794, "2013-09-15"); +insert into diaries values(795, "2013-09-16"); +insert into diaries values(796, "2013-09-17"); +insert into diaries values(797, "2013-09-18"); +insert into diaries values(798, "2013-09-19"); +insert into diaries values(799, "2013-09-20"); +insert into diaries values(800, "2013-09-21"); +insert into diaries values(801, "2013-09-22"); +insert into diaries values(802, "2013-09-23"); +insert into diaries values(803, "2013-09-24"); +insert into diaries values(804, "2013-09-25"); +insert into diaries values(805, "2013-09-26"); +insert into diaries values(806, "2013-09-27"); +insert into diaries values(807, "2013-09-28"); +insert into diaries values(808, "2013-09-29"); +insert into diaries values(809, "2013-09-30"); +insert into diaries values(810, "2013-10-01"); +insert into diaries values(811, "2013-10-02"); +insert into diaries values(812, "2013-10-03"); +insert into diaries values(813, "2013-10-04"); +insert into diaries values(814, "2013-10-05"); +insert into diaries values(815, "2013-10-06"); +insert into diaries values(816, "2013-10-07"); +insert into diaries values(817, "2013-10-08"); +insert into diaries values(818, "2013-10-09"); +insert into diaries values(819, "2013-10-10"); +insert into diaries values(820, "2013-10-11"); +insert into diaries values(821, "2013-10-12"); +insert into diaries values(822, "2013-10-13"); +insert into diaries values(823, "2013-10-14"); +insert into diaries values(824, "2013-10-15"); +insert into diaries values(825, "2013-10-16"); +insert into diaries values(826, "2013-10-17"); +insert into diaries values(827, "2013-10-18"); +insert into diaries values(828, "2013-10-19"); +insert into diaries values(829, "2013-10-20"); +insert into diaries values(830, "2013-10-21"); +insert into diaries values(831, "2013-10-22"); +insert into diaries values(832, "2013-10-23"); +insert into diaries values(833, "2013-10-24"); +insert into diaries values(834, "2013-10-25"); +insert into diaries values(835, "2013-10-26"); +insert into diaries values(836, "2013-10-27"); +insert into diaries values(837, "2013-10-28"); +insert into diaries values(838, "2013-10-29"); +insert into diaries values(839, "2013-10-30"); +insert into diaries values(840, "2013-10-31"); +insert into diaries values(841, "2013-11-01"); +insert into diaries values(842, "2013-11-02"); +insert into diaries values(843, "2013-11-03"); +insert into diaries values(844, "2013-11-04"); +insert into diaries values(845, "2013-11-05"); +insert into diaries values(846, "2013-11-06"); +insert into diaries values(847, "2013-11-07"); +insert into diaries values(848, "2013-11-08"); +insert into diaries values(849, "2013-11-09"); +insert into diaries values(850, "2013-11-10"); +insert into diaries values(851, "2013-11-11"); +insert into diaries values(852, "2013-11-12"); +insert into diaries values(853, "2013-11-13"); +insert into diaries values(854, "2013-11-14"); +insert into diaries values(855, "2013-11-15"); +insert into diaries values(856, "2013-11-16"); +insert into diaries values(857, "2013-11-17"); +insert into diaries values(858, "2013-11-18"); +insert into diaries values(859, "2013-11-19"); +insert into diaries values(860, "2013-11-20"); +insert into diaries values(861, "2013-11-21"); +insert into diaries values(862, "2013-11-22"); +insert into diaries values(863, "2013-11-23"); +insert into diaries values(864, "2013-11-24"); +insert into diaries values(865, "2013-11-25"); +insert into diaries values(866, "2013-11-26"); +insert into diaries values(867, "2013-11-27"); +insert into diaries values(868, "2013-11-28"); +insert into diaries values(869, "2013-11-29"); +insert into diaries values(870, "2013-11-30"); +insert into diaries values(871, "2013-12-01"); +insert into diaries values(872, "2013-12-02"); +insert into diaries values(873, "2013-12-03"); +insert into diaries values(874, "2013-12-04"); +insert into diaries values(875, "2013-12-05"); +insert into diaries values(876, "2013-12-06"); +insert into diaries values(877, "2013-12-07"); +insert into diaries values(878, "2013-12-08"); +insert into diaries values(879, "2013-12-09"); +insert into diaries values(880, "2013-12-10"); +insert into diaries values(881, "2013-12-11"); +insert into diaries values(882, "2013-12-12"); +insert into diaries values(883, "2013-12-13"); +insert into diaries values(884, "2013-12-14"); +insert into diaries values(885, "2013-12-15"); +insert into diaries values(886, "2013-12-16"); +insert into diaries values(887, "2013-12-17"); +insert into diaries values(888, "2013-12-18"); +insert into diaries values(889, "2013-12-19"); +insert into diaries values(890, "2013-12-20"); +insert into diaries values(891, "2013-12-21"); +insert into diaries values(892, "2013-12-22"); +insert into diaries values(893, "2013-12-23"); +insert into diaries values(894, "2013-12-24"); +insert into diaries values(895, "2013-12-25"); +insert into diaries values(896, "2013-12-26"); +insert into diaries values(897, "2013-12-27"); +insert into diaries values(898, "2013-12-28"); +insert into diaries values(899, "2013-12-29"); +insert into diaries values(900, "2013-12-30"); +insert into diaries values(901, "2013-12-31"); +insert into diaries values(902, "2014-01-01"); +insert into diaries values(903, "2014-01-02"); +insert into diaries values(904, "2014-01-03"); +insert into diaries values(905, "2014-01-04"); +insert into diaries values(906, "2014-01-05"); +insert into diaries values(907, "2014-01-06"); +insert into diaries values(908, "2014-01-07"); +insert into diaries values(909, "2014-01-08"); +insert into diaries values(910, "2014-01-09"); +insert into diaries values(911, "2014-01-10"); +insert into diaries values(912, "2014-01-11"); +insert into diaries values(913, "2014-01-12"); +insert into diaries values(914, "2014-01-13"); +insert into diaries values(915, "2014-01-14"); +insert into diaries values(916, "2014-01-15"); +insert into diaries values(917, "2014-01-16"); +insert into diaries values(918, "2014-01-17"); +insert into diaries values(919, "2014-01-18"); +insert into diaries values(920, "2014-01-19"); +insert into diaries values(921, "2014-01-20"); +insert into diaries values(922, "2014-01-21"); +insert into diaries values(923, "2014-01-22"); +insert into diaries values(924, "2014-01-23"); +insert into diaries values(925, "2014-01-24"); +insert into diaries values(926, "2014-01-25"); +insert into diaries values(927, "2014-01-26"); +insert into diaries values(928, "2014-01-27"); +insert into diaries values(929, "2014-01-28"); +insert into diaries values(930, "2014-01-29"); +insert into diaries values(931, "2014-01-30"); +insert into diaries values(932, "2014-01-31"); +insert into diaries values(933, "2014-02-01"); +insert into diaries values(934, "2014-02-02"); +insert into diaries values(935, "2014-02-03"); +insert into diaries values(936, "2014-02-04"); +insert into diaries values(937, "2014-02-05"); +insert into diaries values(938, "2014-02-06"); +insert into diaries values(939, "2014-02-07"); +insert into diaries values(940, "2014-02-08"); +insert into diaries values(941, "2014-02-09"); +insert into diaries values(942, "2014-02-10"); +insert into diaries values(943, "2014-02-11"); +insert into diaries values(944, "2014-02-12"); +insert into diaries values(945, "2014-02-13"); +insert into diaries values(946, "2014-02-14"); +insert into diaries values(947, "2014-02-15"); +insert into diaries values(948, "2014-02-16"); +insert into diaries values(949, "2014-02-17"); +insert into diaries values(950, "2014-02-18"); +insert into diaries values(951, "2014-02-19"); +insert into diaries values(952, "2014-02-20"); +insert into diaries values(953, "2014-02-21"); +insert into diaries values(954, "2014-02-22"); +insert into diaries values(955, "2014-02-23"); +insert into diaries values(956, "2014-02-24"); +insert into diaries values(957, "2014-02-25"); +insert into diaries values(958, "2014-02-26"); +insert into diaries values(959, "2014-02-27"); +insert into diaries values(960, "2014-02-28"); +insert into diaries values(961, "2014-03-01"); +insert into diaries values(962, "2014-03-02"); +insert into diaries values(963, "2014-03-03"); +insert into diaries values(964, "2014-03-04"); +insert into diaries values(965, "2014-03-05"); +insert into diaries values(966, "2014-03-06"); +insert into diaries values(967, "2014-03-07"); +insert into diaries values(968, "2014-03-08"); +insert into diaries values(969, "2014-03-09"); +insert into diaries values(970, "2014-03-10"); +insert into diaries values(971, "2014-03-11"); +insert into diaries values(972, "2014-03-12"); +insert into diaries values(973, "2014-03-13"); +insert into diaries values(974, "2014-03-14"); +insert into diaries values(975, "2014-03-15"); +insert into diaries values(976, "2014-03-16"); +insert into diaries values(977, "2014-03-17"); +insert into diaries values(978, "2014-03-18"); +insert into diaries values(979, "2014-03-19"); +insert into diaries values(980, "2014-03-20"); +insert into diaries values(981, "2014-03-21"); +insert into diaries values(982, "2014-03-22"); +insert into diaries values(983, "2014-03-23"); +insert into diaries values(984, "2014-03-24"); +insert into diaries values(985, "2014-03-25"); +insert into diaries values(986, "2014-03-26"); +insert into diaries values(987, "2014-03-27"); +insert into diaries values(988, "2014-03-28"); +insert into diaries values(989, "2014-03-29"); +insert into diaries values(990, "2014-03-30"); +insert into diaries values(991, "2014-03-31"); +insert into diaries values(992, "2014-04-01"); +insert into diaries values(993, "2014-04-02"); +insert into diaries values(994, "2014-04-03"); +insert into diaries values(995, "2014-04-04"); +insert into diaries values(996, "2014-04-05"); +insert into diaries values(997, "2014-04-06"); +insert into diaries values(998, "2014-04-07"); +insert into diaries values(999, "2014-04-08"); +insert into diaries values(1000, "2014-04-09"); +insert into diaries values(1001, "2014-04-10"); +insert into diaries values(1002, "2014-04-11"); +insert into diaries values(1003, "2014-04-12"); +insert into diaries values(1004, "2014-04-13"); +insert into diaries values(1005, "2014-04-14"); +insert into diaries values(1006, "2014-04-15"); +insert into diaries values(1007, "2014-04-16"); +insert into diaries values(1008, "2014-04-17"); +insert into diaries values(1009, "2014-04-18"); +insert into diaries values(1010, "2014-04-19"); +insert into diaries values(1011, "2014-04-20"); +insert into diaries values(1012, "2014-04-21"); +insert into diaries values(1013, "2014-04-22"); +insert into diaries values(1014, "2014-04-23"); +insert into diaries values(1015, "2014-04-24"); +insert into diaries values(1016, "2014-04-25"); +insert into diaries values(1017, "2014-04-26"); +insert into diaries values(1018, "2014-04-27"); +insert into diaries values(1019, "2014-04-28"); +insert into diaries values(1020, "2014-04-29"); +insert into diaries values(1021, "2014-04-30"); +insert into diaries values(1022, "2014-05-01"); +insert into diaries values(1023, "2014-05-02"); +insert into diaries values(1024, "2014-05-03"); +insert into diaries values(1025, "2014-05-04"); +insert into diaries values(1026, "2014-05-05"); +insert into diaries values(1027, "2014-05-06"); +insert into diaries values(1028, "2014-05-07"); +insert into diaries values(1029, "2014-05-08"); +insert into diaries values(1030, "2014-05-09"); +insert into diaries values(1031, "2014-05-10"); +insert into diaries values(1032, "2014-05-11"); +insert into diaries values(1033, "2014-05-12"); +insert into diaries values(1034, "2014-05-13"); +insert into diaries values(1035, "2014-05-14"); +insert into diaries values(1036, "2014-05-15"); +insert into diaries values(1037, "2014-05-16"); +insert into diaries values(1038, "2014-05-17"); +insert into diaries values(1039, "2014-05-18"); +insert into diaries values(1040, "2014-05-19"); +insert into diaries values(1041, "2014-05-20"); +insert into diaries values(1042, "2014-05-21"); +insert into diaries values(1043, "2014-05-22"); +insert into diaries values(1044, "2014-05-23"); +insert into diaries values(1045, "2014-05-24"); +insert into diaries values(1046, "2014-05-25"); +insert into diaries values(1047, "2014-05-26"); +insert into diaries values(1048, "2014-05-27"); +insert into diaries values(1049, "2014-05-28"); +insert into diaries values(1050, "2014-05-29"); +insert into diaries values(1051, "2014-05-30"); +insert into diaries values(1052, "2014-05-31"); +insert into diaries values(1053, "2014-06-01"); +insert into diaries values(1054, "2014-06-02"); +insert into diaries values(1055, "2014-06-03"); +insert into diaries values(1056, "2014-06-04"); +insert into diaries values(1057, "2014-06-05"); +insert into diaries values(1058, "2014-06-06"); +insert into diaries values(1059, "2014-06-07"); +insert into diaries values(1060, "2014-06-08"); +insert into diaries values(1061, "2014-06-09"); +insert into diaries values(1062, "2014-06-10"); +insert into diaries values(1063, "2014-06-11"); +insert into diaries values(1064, "2014-06-12"); +insert into diaries values(1065, "2014-06-13"); +insert into diaries values(1066, "2014-06-14"); +insert into diaries values(1067, "2014-06-15"); +insert into diaries values(1068, "2014-06-16"); +insert into diaries values(1069, "2014-06-17"); +insert into diaries values(1070, "2014-06-18"); +insert into diaries values(1071, "2014-06-19"); +insert into diaries values(1072, "2014-06-20"); +insert into diaries values(1073, "2014-06-21"); +insert into diaries values(1074, "2014-06-22"); +insert into diaries values(1075, "2014-06-23"); +insert into diaries values(1076, "2014-06-24"); +insert into diaries values(1077, "2014-06-25"); +insert into diaries values(1078, "2014-06-26"); +insert into diaries values(1079, "2014-06-27"); +insert into diaries values(1080, "2014-06-28"); +insert into diaries values(1081, "2014-06-29"); +insert into diaries values(1082, "2014-06-30"); +insert into diaries values(1083, "2014-07-01"); +insert into diaries values(1084, "2014-07-02"); +insert into diaries values(1085, "2014-07-03"); +insert into diaries values(1086, "2014-07-04"); +insert into diaries values(1087, "2014-07-05"); +insert into diaries values(1088, "2014-07-06"); +insert into diaries values(1089, "2014-07-07"); +insert into diaries values(1090, "2014-07-08"); +insert into diaries values(1091, "2014-07-09"); +insert into diaries values(1092, "2014-07-10"); +insert into diaries values(1093, "2014-07-11"); +insert into diaries values(1094, "2014-07-12"); +insert into diaries values(1095, "2014-07-13"); +insert into diaries values(1096, "2014-07-14"); +insert into diaries values(1097, "2014-07-15"); +insert into diaries values(1098, "2014-07-16"); +insert into diaries values(1099, "2014-07-17"); +insert into diaries values(1100, "2014-07-18"); +insert into diaries values(1101, "2014-07-19"); +insert into diaries values(1102, "2014-07-20"); +insert into diaries values(1103, "2014-07-21"); +insert into diaries values(1104, "2014-07-22"); +insert into diaries values(1105, "2014-07-23"); +insert into diaries values(1106, "2014-07-24"); +insert into diaries values(1107, "2014-07-25"); +insert into diaries values(1108, "2014-07-26"); +insert into diaries values(1109, "2014-07-27"); +insert into diaries values(1110, "2014-07-28"); +insert into diaries values(1111, "2014-07-29"); +insert into diaries values(1112, "2014-07-30"); +insert into diaries values(1113, "2014-07-31"); +insert into diaries values(1114, "2014-08-01"); +insert into diaries values(1115, "2014-08-02"); +insert into diaries values(1116, "2014-08-03"); +insert into diaries values(1117, "2014-08-04"); +insert into diaries values(1118, "2014-08-05"); +insert into diaries values(1119, "2014-08-06"); +insert into diaries values(1120, "2014-08-07"); +insert into diaries values(1121, "2014-08-08"); +insert into diaries values(1122, "2014-08-09"); +insert into diaries values(1123, "2014-08-10"); +insert into diaries values(1124, "2014-08-11"); +insert into diaries values(1125, "2014-08-12"); +insert into diaries values(1126, "2014-08-13"); +insert into diaries values(1127, "2014-08-14"); +insert into diaries values(1128, "2014-08-15"); +insert into diaries values(1129, "2014-08-16"); +insert into diaries values(1130, "2014-08-17"); +insert into diaries values(1131, "2014-08-18"); +insert into diaries values(1132, "2014-08-19"); +insert into diaries values(1133, "2014-08-20"); +insert into diaries values(1134, "2014-08-21"); +insert into diaries values(1135, "2014-08-22"); +insert into diaries values(1136, "2014-08-23"); +insert into diaries values(1137, "2014-08-24"); +insert into diaries values(1138, "2014-08-25"); +insert into diaries values(1139, "2014-08-26"); +insert into diaries values(1140, "2014-08-27"); +insert into diaries values(1141, "2014-08-28"); +insert into diaries values(1142, "2014-08-29"); +insert into diaries values(1143, "2014-08-30"); +insert into diaries values(1144, "2014-08-31"); +insert into diaries values(1145, "2014-09-01"); +insert into diaries values(1146, "2014-09-02"); +insert into diaries values(1147, "2014-09-03"); +insert into diaries values(1148, "2014-09-04"); +insert into diaries values(1149, "2014-09-05"); +insert into diaries values(1150, "2014-09-06"); +insert into diaries values(1151, "2014-09-07"); +insert into diaries values(1152, "2014-09-08"); +insert into diaries values(1153, "2014-09-09"); +insert into diaries values(1154, "2014-09-10"); +insert into diaries values(1155, "2014-09-11"); +insert into diaries values(1156, "2014-09-12"); +insert into diaries values(1157, "2014-09-13"); +insert into diaries values(1158, "2014-09-14"); +insert into diaries values(1159, "2014-09-15"); +insert into diaries values(1160, "2014-09-16"); +insert into diaries values(1161, "2014-09-17"); +insert into diaries values(1162, "2014-09-18"); +insert into diaries values(1163, "2014-09-19"); +insert into diaries values(1164, "2014-09-20"); +insert into diaries values(1165, "2014-09-21"); +insert into diaries values(1166, "2014-09-22"); +insert into diaries values(1167, "2014-09-23"); +insert into diaries values(1168, "2014-09-24"); +insert into diaries values(1169, "2014-09-25"); +insert into diaries values(1170, "2014-09-26"); +insert into diaries values(1171, "2014-09-27"); +insert into diaries values(1172, "2014-09-28"); +insert into diaries values(1173, "2014-09-29"); +insert into diaries values(1174, "2014-09-30"); +insert into diaries values(1175, "2014-10-01"); +insert into diaries values(1176, "2014-10-02"); +insert into diaries values(1177, "2014-10-03"); +insert into diaries values(1178, "2014-10-04"); +insert into diaries values(1179, "2014-10-05"); +insert into diaries values(1180, "2014-10-06"); +insert into diaries values(1181, "2014-10-07"); +insert into diaries values(1182, "2014-10-08"); +insert into diaries values(1183, "2014-10-09"); +insert into diaries values(1184, "2014-10-10"); +insert into diaries values(1185, "2014-10-11"); +insert into diaries values(1186, "2014-10-12"); +insert into diaries values(1187, "2014-10-13"); +insert into diaries values(1188, "2014-10-14"); +insert into diaries values(1189, "2014-10-15"); +insert into diaries values(1190, "2014-10-16"); +insert into diaries values(1191, "2014-10-17"); +insert into diaries values(1192, "2014-10-18"); +insert into diaries values(1193, "2014-10-19"); +insert into diaries values(1194, "2014-10-20"); +insert into diaries values(1195, "2014-10-21"); +insert into diaries values(1196, "2014-10-22"); +insert into diaries values(1197, "2014-10-23"); +insert into diaries values(1198, "2014-10-24"); +insert into diaries values(1199, "2014-10-25"); +insert into diaries values(1200, "2014-10-26"); +insert into diaries values(1201, "2014-10-27"); +insert into diaries values(1202, "2014-10-28"); +insert into diaries values(1203, "2014-10-29"); +insert into diaries values(1204, "2014-10-30"); +insert into diaries values(1205, "2014-10-31"); +insert into diaries values(1206, "2014-11-01"); +insert into diaries values(1207, "2014-11-02"); +insert into diaries values(1208, "2014-11-03"); +insert into diaries values(1209, "2014-11-04"); +insert into diaries values(1210, "2014-11-05"); +insert into diaries values(1211, "2014-11-06"); +insert into diaries values(1212, "2014-11-07"); +insert into diaries values(1213, "2014-11-08"); +insert into diaries values(1214, "2014-11-09"); +insert into diaries values(1215, "2014-11-10"); +insert into diaries values(1216, "2014-11-11"); +insert into diaries values(1217, "2014-11-12"); +insert into diaries values(1218, "2014-11-13"); +insert into diaries values(1219, "2014-11-14"); +insert into diaries values(1220, "2014-11-15"); +insert into diaries values(1221, "2014-11-16"); +insert into diaries values(1222, "2014-11-17"); +insert into diaries values(1223, "2014-11-18"); +insert into diaries values(1224, "2014-11-19"); +insert into diaries values(1225, "2014-11-20"); +insert into diaries values(1226, "2014-11-21"); +insert into diaries values(1227, "2014-11-22"); +insert into diaries values(1228, "2014-11-23"); +insert into diaries values(1229, "2014-11-24"); +insert into diaries values(1230, "2014-11-25"); +insert into diaries values(1231, "2014-11-26"); +insert into diaries values(1232, "2014-11-27"); +insert into diaries values(1233, "2014-11-28"); +insert into diaries values(1234, "2014-11-29"); +insert into diaries values(1235, "2014-11-30"); +insert into diaries values(1236, "2014-12-01"); +insert into diaries values(1237, "2014-12-02"); +insert into diaries values(1238, "2014-12-03"); +insert into diaries values(1239, "2014-12-04"); +insert into diaries values(1240, "2014-12-05"); +insert into diaries values(1241, "2014-12-06"); +insert into diaries values(1242, "2014-12-07"); +insert into diaries values(1243, "2014-12-08"); +insert into diaries values(1244, "2014-12-09"); +insert into diaries values(1245, "2014-12-10"); +insert into diaries values(1246, "2014-12-11"); +insert into diaries values(1247, "2014-12-12"); +insert into diaries values(1248, "2014-12-13"); +insert into diaries values(1249, "2014-12-14"); +insert into diaries values(1250, "2014-12-15"); +insert into diaries values(1251, "2014-12-16"); +insert into diaries values(1252, "2014-12-17"); +insert into diaries values(1253, "2014-12-18"); +insert into diaries values(1254, "2014-12-19"); +insert into diaries values(1255, "2014-12-20"); +insert into diaries values(1256, "2014-12-21"); +insert into diaries values(1257, "2014-12-22"); +insert into diaries values(1258, "2014-12-23"); +insert into diaries values(1259, "2014-12-24"); +insert into diaries values(1260, "2014-12-25"); +insert into diaries values(1261, "2014-12-26"); +insert into diaries values(1262, "2014-12-27"); +insert into diaries values(1263, "2014-12-28"); +insert into diaries values(1264, "2014-12-29"); +insert into diaries values(1265, "2014-12-30"); +insert into diaries values(1266, "2014-12-31"); +insert into diaries values(1267, "2015-01-01"); +insert into diaries values(1268, "2015-01-02"); +insert into diaries values(1269, "2015-01-03"); +insert into diaries values(1270, "2015-01-04"); +insert into diaries values(1271, "2015-01-05"); +insert into diaries values(1272, "2015-01-06"); +insert into diaries values(1273, "2015-01-07"); +insert into diaries values(1274, "2015-01-08"); +insert into diaries values(1275, "2015-01-09"); +insert into diaries values(1276, "2015-01-10"); +insert into diaries values(1277, "2015-01-11"); +insert into diaries values(1278, "2015-01-12"); +insert into diaries values(1279, "2015-01-13"); +insert into diaries values(1280, "2015-01-14"); +insert into diaries values(1281, "2015-01-15"); +insert into diaries values(1282, "2015-01-16"); +insert into diaries values(1283, "2015-01-17"); +insert into diaries values(1284, "2015-01-18"); +insert into diaries values(1285, "2015-01-19"); +insert into diaries values(1286, "2015-01-20"); +insert into diaries values(1287, "2015-01-21"); +insert into diaries values(1288, "2015-01-22"); +insert into diaries values(1289, "2015-01-23"); +insert into diaries values(1290, "2015-01-24"); +insert into diaries values(1291, "2015-01-25"); +insert into diaries values(1292, "2015-01-26"); +insert into diaries values(1293, "2015-01-27"); +insert into diaries values(1294, "2015-01-28"); +insert into diaries values(1295, "2015-01-29"); +insert into diaries values(1296, "2015-01-30"); +insert into diaries values(1297, "2015-01-31"); +insert into diaries values(1298, "2015-02-01"); +insert into diaries values(1299, "2015-02-02"); +insert into diaries values(1300, "2015-02-03"); +insert into diaries values(1301, "2015-02-04"); +insert into diaries values(1302, "2015-02-05"); +insert into diaries values(1303, "2015-02-06"); +insert into diaries values(1304, "2015-02-07"); +insert into diaries values(1305, "2015-02-08"); +insert into diaries values(1306, "2015-02-09"); +insert into diaries values(1307, "2015-02-10"); +insert into diaries values(1308, "2015-02-11"); +insert into diaries values(1309, "2015-02-12"); +insert into diaries values(1310, "2015-02-13"); +insert into diaries values(1311, "2015-02-14"); +insert into diaries values(1312, "2015-02-15"); +insert into diaries values(1313, "2015-02-16"); +insert into diaries values(1314, "2015-02-17"); +insert into diaries values(1315, "2015-02-18"); +insert into diaries values(1316, "2015-02-19"); +insert into diaries values(1317, "2015-02-20"); +insert into diaries values(1318, "2015-02-21"); +insert into diaries values(1319, "2015-02-22"); +insert into diaries values(1320, "2015-02-23"); +insert into diaries values(1321, "2015-02-24"); +insert into diaries values(1322, "2015-02-25"); +insert into diaries values(1323, "2015-02-26"); +insert into diaries values(1324, "2015-02-27"); +insert into diaries values(1325, "2015-02-28"); +insert into diaries values(1326, "2015-03-01"); +insert into diaries values(1327, "2015-03-02"); +insert into diaries values(1328, "2015-03-03"); +insert into diaries values(1329, "2015-03-04"); +insert into diaries values(1330, "2015-03-05"); +insert into diaries values(1331, "2015-03-06"); +insert into diaries values(1332, "2015-03-07"); +insert into diaries values(1333, "2015-03-08"); +insert into diaries values(1334, "2015-03-09"); +insert into diaries values(1335, "2015-03-10"); +insert into diaries values(1336, "2015-03-11"); +insert into diaries values(1337, "2015-03-12"); +insert into diaries values(1338, "2015-03-13"); +insert into diaries values(1339, "2015-03-14"); +insert into diaries values(1340, "2015-03-15"); +insert into diaries values(1341, "2015-03-16"); +insert into diaries values(1342, "2015-03-17"); +insert into diaries values(1343, "2015-03-18"); +insert into diaries values(1344, "2015-03-19"); +insert into diaries values(1345, "2015-03-20"); +insert into diaries values(1346, "2015-03-21"); +insert into diaries values(1347, "2015-03-22"); +insert into diaries values(1348, "2015-03-23"); +insert into diaries values(1349, "2015-03-24"); +insert into diaries values(1350, "2015-03-25"); +insert into diaries values(1351, "2015-03-26"); +insert into diaries values(1352, "2015-03-27"); +insert into diaries values(1353, "2015-03-28"); +insert into diaries values(1354, "2015-03-29"); +insert into diaries values(1355, "2015-03-30"); +insert into diaries values(1356, "2015-03-31"); +insert into diaries values(1357, "2015-04-01"); +insert into diaries values(1358, "2015-04-02"); +insert into diaries values(1359, "2015-04-03"); +insert into diaries values(1360, "2015-04-04"); +insert into diaries values(1361, "2015-04-05"); +insert into diaries values(1362, "2015-04-06"); +insert into diaries values(1363, "2015-04-07"); +insert into diaries values(1364, "2015-04-08"); +insert into diaries values(1365, "2015-04-09"); +insert into diaries values(1366, "2015-04-10"); +insert into diaries values(1367, "2015-04-11"); +insert into diaries values(1368, "2015-04-12"); +insert into diaries values(1369, "2015-04-13"); +insert into diaries values(1370, "2015-04-14"); +insert into diaries values(1371, "2015-04-15"); +insert into diaries values(1372, "2015-04-16"); +insert into diaries values(1373, "2015-04-17"); +insert into diaries values(1374, "2015-04-18"); +insert into diaries values(1375, "2015-04-19"); +insert into diaries values(1376, "2015-04-20"); +insert into diaries values(1377, "2015-04-21"); +insert into diaries values(1378, "2015-04-22"); +insert into diaries values(1379, "2015-04-23"); +insert into diaries values(1380, "2015-04-24"); +insert into diaries values(1381, "2015-04-25"); +insert into diaries values(1382, "2015-04-26"); +insert into diaries values(1383, "2015-04-27"); +insert into diaries values(1384, "2015-04-28"); +insert into diaries values(1385, "2015-04-29"); +insert into diaries values(1386, "2015-04-30"); +insert into diaries values(1387, "2015-05-01"); +insert into diaries values(1388, "2015-05-02"); +insert into diaries values(1389, "2015-05-03"); +insert into diaries values(1390, "2015-05-04"); +insert into diaries values(1391, "2015-05-05"); +insert into diaries values(1392, "2015-05-06"); +insert into diaries values(1393, "2015-05-07"); +insert into diaries values(1394, "2015-05-08"); +insert into diaries values(1395, "2015-05-09"); +insert into diaries values(1396, "2015-05-10"); +insert into diaries values(1397, "2015-05-11"); +insert into diaries values(1398, "2015-05-12"); +insert into diaries values(1399, "2015-05-13"); +insert into diaries values(1400, "2015-05-14"); +insert into diaries values(1401, "2015-05-15"); +insert into diaries values(1402, "2015-05-16"); +insert into diaries values(1403, "2015-05-17"); +insert into diaries values(1404, "2015-05-18"); +insert into diaries values(1405, "2015-05-19"); +insert into diaries values(1406, "2015-05-20"); +insert into diaries values(1407, "2015-05-21"); +insert into diaries values(1408, "2015-05-22"); +insert into diaries values(1409, "2015-05-23"); +insert into diaries values(1410, "2015-05-24"); +insert into diaries values(1411, "2015-05-25"); +insert into diaries values(1412, "2015-05-26"); +insert into diaries values(1413, "2015-05-27"); +insert into diaries values(1414, "2015-05-28"); +insert into diaries values(1415, "2015-05-29"); +insert into diaries values(1416, "2015-05-30"); +insert into diaries values(1417, "2015-05-31"); +insert into diaries values(1418, "2015-06-01"); +insert into diaries values(1419, "2015-06-02"); +insert into diaries values(1420, "2015-06-03"); +insert into diaries values(1421, "2015-06-04"); +insert into diaries values(1422, "2015-06-05"); +insert into diaries values(1423, "2015-06-06"); +insert into diaries values(1424, "2015-06-07"); +insert into diaries values(1425, "2015-06-08"); +insert into diaries values(1426, "2015-06-09"); +insert into diaries values(1427, "2015-06-10"); +insert into diaries values(1428, "2015-06-11"); +insert into diaries values(1429, "2015-06-12"); +insert into diaries values(1430, "2015-06-13"); +insert into diaries values(1431, "2015-06-14"); +insert into diaries values(1432, "2015-06-15"); +insert into diaries values(1433, "2015-06-16"); +insert into diaries values(1434, "2015-06-17"); +insert into diaries values(1435, "2015-06-18"); +insert into diaries values(1436, "2015-06-19"); +insert into diaries values(1437, "2015-06-20"); +insert into diaries values(1438, "2015-06-21"); +insert into diaries values(1439, "2015-06-22"); +insert into diaries values(1440, "2015-06-23"); +insert into diaries values(1441, "2015-06-24"); +insert into diaries values(1442, "2015-06-25"); +insert into diaries values(1443, "2015-06-26"); +insert into diaries values(1444, "2015-06-27"); +insert into diaries values(1445, "2015-06-28"); +insert into diaries values(1446, "2015-06-29"); +insert into diaries values(1447, "2015-06-30"); +insert into diaries values(1448, "2015-07-01"); +insert into diaries values(1449, "2015-07-02"); +insert into diaries values(1450, "2015-07-03"); +insert into diaries values(1451, "2015-07-04"); +insert into diaries values(1452, "2015-07-05"); +insert into diaries values(1453, "2015-07-06"); +insert into diaries values(1454, "2015-07-07"); +insert into diaries values(1455, "2015-07-08"); +insert into diaries values(1456, "2015-07-09"); +insert into diaries values(1457, "2015-07-10"); +insert into diaries values(1458, "2015-07-11"); +insert into diaries values(1459, "2015-07-12"); +insert into diaries values(1460, "2015-07-13"); +insert into diaries values(1461, "2015-07-14"); +insert into diaries values(1462, "2015-07-15"); +insert into diaries values(1463, "2015-07-16"); +insert into diaries values(1464, "2015-07-17"); +insert into diaries values(1465, "2015-07-18"); +insert into diaries values(1466, "2015-07-19"); +insert into diaries values(1467, "2015-07-20"); +insert into diaries values(1468, "2015-07-21"); +insert into diaries values(1469, "2015-07-22"); +insert into diaries values(1470, "2015-07-23"); +insert into diaries values(1471, "2015-07-24"); +insert into diaries values(1472, "2015-07-25"); +insert into diaries values(1473, "2015-07-26"); +insert into diaries values(1474, "2015-07-27"); +insert into diaries values(1475, "2015-07-28"); +insert into diaries values(1476, "2015-07-29"); +insert into diaries values(1477, "2015-07-30"); +insert into diaries values(1478, "2015-07-31"); +insert into diaries values(1479, "2015-08-01"); +insert into diaries values(1480, "2015-08-02"); +insert into diaries values(1481, "2015-08-03"); +insert into diaries values(1482, "2015-08-04"); +insert into diaries values(1483, "2015-08-05"); +insert into diaries values(1484, "2015-08-06"); +insert into diaries values(1485, "2015-08-07"); +insert into diaries values(1486, "2015-08-08"); +insert into diaries values(1487, "2015-08-09"); +insert into diaries values(1488, "2015-08-10"); +insert into diaries values(1489, "2015-08-11"); +insert into diaries values(1490, "2015-08-12"); +insert into diaries values(1491, "2015-08-13"); +insert into diaries values(1492, "2015-08-14"); +insert into diaries values(1493, "2015-08-15"); +insert into diaries values(1494, "2015-08-16"); +insert into diaries values(1495, "2015-08-17"); +insert into diaries values(1496, "2015-08-18"); +insert into diaries values(1497, "2015-08-19"); +insert into diaries values(1498, "2015-08-20"); +insert into diaries values(1499, "2015-08-21"); +insert into diaries values(1500, "2015-08-22"); +insert into diaries values(1501, "2015-08-23"); +insert into diaries values(1502, "2015-08-24"); +insert into diaries values(1503, "2015-08-25"); +insert into diaries values(1504, "2015-08-26"); +insert into diaries values(1505, "2015-08-27"); +insert into diaries values(1506, "2015-08-28"); +insert into diaries values(1507, "2015-08-29"); +insert into diaries values(1508, "2015-08-30"); +insert into diaries values(1509, "2015-08-31"); +insert into diaries values(1510, "2015-09-01"); +insert into diaries values(1511, "2015-09-02"); +insert into diaries values(1512, "2015-09-03"); +insert into diaries values(1513, "2015-09-04"); +insert into diaries values(1514, "2015-09-05"); +insert into diaries values(1515, "2015-09-06"); +insert into diaries values(1516, "2015-09-07"); +insert into diaries values(1517, "2015-09-08"); +insert into diaries values(1518, "2015-09-09"); +insert into diaries values(1519, "2015-09-10"); +insert into diaries values(1520, "2015-09-11"); +insert into diaries values(1521, "2015-09-12"); +insert into diaries values(1522, "2015-09-13"); +insert into diaries values(1523, "2015-09-14"); +insert into diaries values(1524, "2015-09-15"); +insert into diaries values(1525, "2015-09-16"); +insert into diaries values(1526, "2015-09-17"); +insert into diaries values(1527, "2015-09-18"); +insert into diaries values(1528, "2015-09-19"); +insert into diaries values(1529, "2015-09-20"); +insert into diaries values(1530, "2015-09-21"); +insert into diaries values(1531, "2015-09-22"); +insert into diaries values(1532, "2015-09-23"); +insert into diaries values(1533, "2015-09-24"); +insert into diaries values(1534, "2015-09-25"); +insert into diaries values(1535, "2015-09-26"); +insert into diaries values(1536, "2015-09-27"); +insert into diaries values(1537, "2015-09-28"); +insert into diaries values(1538, "2015-09-29"); +insert into diaries values(1539, "2015-09-30"); +insert into diaries values(1540, "2015-10-01"); +insert into diaries values(1541, "2015-10-02"); +insert into diaries values(1542, "2015-10-03"); +insert into diaries values(1543, "2015-10-04"); +insert into diaries values(1544, "2015-10-05"); +insert into diaries values(1545, "2015-10-06"); +insert into diaries values(1546, "2015-10-07"); +insert into diaries values(1547, "2015-10-08"); +insert into diaries values(1548, "2015-10-09"); +insert into diaries values(1549, "2015-10-10"); +insert into diaries values(1550, "2015-10-11"); +insert into diaries values(1551, "2015-10-12"); +insert into diaries values(1552, "2015-10-13"); +insert into diaries values(1553, "2015-10-14"); +insert into diaries values(1554, "2015-10-15"); +insert into diaries values(1555, "2015-10-16"); +insert into diaries values(1556, "2015-10-17"); +insert into diaries values(1557, "2015-10-18"); +insert into diaries values(1558, "2015-10-19"); +insert into diaries values(1559, "2015-10-20"); +insert into diaries values(1560, "2015-10-21"); +insert into diaries values(1561, "2015-10-22"); +insert into diaries values(1562, "2015-10-23"); +insert into diaries values(1563, "2015-10-24"); +insert into diaries values(1564, "2015-10-25"); +insert into diaries values(1565, "2015-10-26"); +insert into diaries values(1566, "2015-10-27"); +insert into diaries values(1567, "2015-10-28"); +insert into diaries values(1568, "2015-10-29"); +insert into diaries values(1569, "2015-10-30"); +insert into diaries values(1570, "2015-10-31"); +insert into diaries values(1571, "2015-11-01"); +insert into diaries values(1572, "2015-11-02"); +insert into diaries values(1573, "2015-11-03"); +insert into diaries values(1574, "2015-11-04"); +insert into diaries values(1575, "2015-11-05"); +insert into diaries values(1576, "2015-11-06"); +insert into diaries values(1577, "2015-11-07"); +insert into diaries values(1578, "2015-11-08"); +insert into diaries values(1579, "2015-11-09"); +insert into diaries values(1580, "2015-11-10"); +insert into diaries values(1581, "2015-11-11"); +insert into diaries values(1582, "2015-11-12"); +insert into diaries values(1583, "2015-11-13"); +insert into diaries values(1584, "2015-11-14"); +insert into diaries values(1585, "2015-11-15"); +insert into diaries values(1586, "2015-11-16"); +insert into diaries values(1587, "2015-11-17"); +insert into diaries values(1588, "2015-11-18"); +insert into diaries values(1589, "2015-11-19"); +insert into diaries values(1590, "2015-11-20"); +insert into diaries values(1591, "2015-11-21"); +insert into diaries values(1592, "2015-11-22"); +insert into diaries values(1593, "2015-11-23"); +insert into diaries values(1594, "2015-11-24"); +insert into diaries values(1595, "2015-11-25"); +insert into diaries values(1596, "2015-11-26"); +insert into diaries values(1597, "2015-11-27"); +insert into diaries values(1598, "2015-11-28"); +insert into diaries values(1599, "2015-11-29"); +insert into diaries values(1600, "2015-11-30"); +insert into diaries values(1601, "2015-12-01"); +insert into diaries values(1602, "2015-12-02"); +insert into diaries values(1603, "2015-12-03"); +insert into diaries values(1604, "2015-12-04"); +insert into diaries values(1605, "2015-12-05"); +insert into diaries values(1606, "2015-12-06"); +insert into diaries values(1607, "2015-12-07"); +insert into diaries values(1608, "2015-12-08"); +insert into diaries values(1609, "2015-12-09"); +insert into diaries values(1610, "2015-12-10"); +insert into diaries values(1611, "2015-12-11"); +insert into diaries values(1612, "2015-12-12"); +insert into diaries values(1613, "2015-12-13"); +insert into diaries values(1614, "2015-12-14"); +insert into diaries values(1615, "2015-12-15"); +insert into diaries values(1616, "2015-12-16"); +insert into diaries values(1617, "2015-12-17"); +insert into diaries values(1618, "2015-12-18"); +insert into diaries values(1619, "2015-12-19"); +insert into diaries values(1620, "2015-12-20"); +insert into diaries values(1621, "2015-12-21"); +insert into diaries values(1622, "2015-12-22"); +insert into diaries values(1623, "2015-12-23"); +insert into diaries values(1624, "2015-12-24"); +insert into diaries values(1625, "2015-12-25"); +insert into diaries values(1626, "2015-12-26"); +insert into diaries values(1627, "2015-12-27"); +insert into diaries values(1628, "2015-12-28"); +insert into diaries values(1629, "2015-12-29"); +insert into diaries values(1630, "2015-12-30"); +insert into diaries values(1631, "2015-12-31"); +insert into diaries values(1632, "2016-01-01"); +insert into diaries values(1633, "2016-01-02"); +insert into diaries values(1634, "2016-01-03"); +insert into diaries values(1635, "2016-01-04"); +insert into diaries values(1636, "2016-01-05"); +insert into diaries values(1637, "2016-01-06"); +insert into diaries values(1638, "2016-01-07"); +insert into diaries values(1639, "2016-01-08"); +insert into diaries values(1640, "2016-01-09"); +insert into diaries values(1641, "2016-01-10"); +insert into diaries values(1642, "2016-01-11"); +insert into diaries values(1643, "2016-01-12"); +insert into diaries values(1644, "2016-01-13"); +insert into diaries values(1645, "2016-01-14"); +insert into diaries values(1646, "2016-01-15"); +insert into diaries values(1647, "2016-01-16"); +insert into diaries values(1648, "2016-01-17"); +insert into diaries values(1649, "2016-01-18"); +insert into diaries values(1650, "2016-01-19"); +insert into diaries values(1651, "2016-01-20"); +insert into diaries values(1652, "2016-01-21"); +insert into diaries values(1653, "2016-01-22"); +insert into diaries values(1654, "2016-01-23"); +insert into diaries values(1655, "2016-01-24"); +insert into diaries values(1656, "2016-01-25"); +insert into diaries values(1657, "2016-01-26"); +insert into diaries values(1658, "2016-01-27"); +insert into diaries values(1659, "2016-01-28"); +insert into diaries values(1660, "2016-01-29"); +insert into diaries values(1661, "2016-01-30"); +insert into diaries values(1662, "2016-01-31"); +insert into diaries values(1663, "2016-02-01"); +insert into diaries values(1664, "2016-02-02"); +insert into diaries values(1665, "2016-02-03"); +insert into diaries values(1666, "2016-02-04"); +insert into diaries values(1667, "2016-02-05"); +insert into diaries values(1668, "2016-02-06"); +insert into diaries values(1669, "2016-02-07"); +insert into diaries values(1670, "2016-02-08"); +insert into diaries values(1671, "2016-02-09"); +insert into diaries values(1672, "2016-02-10"); +insert into diaries values(1673, "2016-02-11"); +insert into diaries values(1674, "2016-02-12"); +insert into diaries values(1675, "2016-02-13"); +insert into diaries values(1676, "2016-02-14"); +insert into diaries values(1677, "2016-02-15"); +insert into diaries values(1678, "2016-02-16"); +insert into diaries values(1679, "2016-02-17"); +insert into diaries values(1680, "2016-02-18"); +insert into diaries values(1681, "2016-02-19"); +insert into diaries values(1682, "2016-02-20"); +insert into diaries values(1683, "2016-02-21"); +insert into diaries values(1684, "2016-02-22"); +insert into diaries values(1685, "2016-02-23"); +insert into diaries values(1686, "2016-02-24"); +insert into diaries values(1687, "2016-02-25"); +insert into diaries values(1688, "2016-02-26"); +insert into diaries values(1689, "2016-02-27"); +insert into diaries values(1690, "2016-02-28"); +insert into diaries values(1691, "2016-02-29"); +insert into diaries values(1692, "2016-03-01"); +insert into diaries values(1693, "2016-03-02"); +insert into diaries values(1694, "2016-03-03"); +insert into diaries values(1695, "2016-03-04"); +insert into diaries values(1696, "2016-03-05"); +insert into diaries values(1697, "2016-03-06"); +insert into diaries values(1698, "2016-03-07"); +insert into diaries values(1699, "2016-03-08"); +insert into diaries values(1700, "2016-03-09"); +insert into diaries values(1701, "2016-03-10"); +insert into diaries values(1702, "2016-03-11"); +insert into diaries values(1703, "2016-03-12"); +insert into diaries values(1704, "2016-03-13"); +insert into diaries values(1705, "2016-03-14"); +insert into diaries values(1706, "2016-03-15"); +insert into diaries values(1707, "2016-03-16"); +insert into diaries values(1708, "2016-03-17"); +insert into diaries values(1709, "2016-03-18"); +insert into diaries values(1710, "2016-03-19"); +insert into diaries values(1711, "2016-03-20"); +insert into diaries values(1712, "2016-03-21"); +insert into diaries values(1713, "2016-03-22"); +insert into diaries values(1714, "2016-03-23"); +insert into diaries values(1715, "2016-03-24"); +insert into diaries values(1716, "2016-03-25"); +insert into diaries values(1717, "2016-03-26"); +insert into diaries values(1718, "2016-03-27"); +insert into diaries values(1719, "2016-03-28"); +insert into diaries values(1720, "2016-03-29"); +insert into diaries values(1721, "2016-03-30"); +insert into diaries values(1722, "2016-03-31"); +insert into diaries values(1723, "2016-04-01"); +insert into diaries values(1724, "2016-04-02"); +insert into diaries values(1725, "2016-04-03"); +insert into diaries values(1726, "2016-04-04"); +insert into diaries values(1727, "2016-04-05"); +insert into diaries values(1728, "2016-04-06"); +insert into diaries values(1729, "2016-04-07"); +insert into diaries values(1730, "2016-04-08"); +insert into diaries values(1731, "2016-04-09"); +insert into diaries values(1732, "2016-04-10"); +insert into diaries values(1733, "2016-04-11"); +insert into diaries values(1734, "2016-04-12"); +insert into diaries values(1735, "2016-04-13"); +insert into diaries values(1736, "2016-04-14"); +insert into diaries values(1737, "2016-04-15"); +insert into diaries values(1738, "2016-04-16"); +insert into diaries values(1739, "2016-04-17"); +insert into diaries values(1740, "2016-04-18"); +insert into diaries values(1741, "2016-04-19"); +insert into diaries values(1742, "2016-04-20"); +insert into diaries values(1743, "2016-04-21"); +insert into diaries values(1744, "2016-04-22"); +insert into diaries values(1745, "2016-04-23"); +insert into diaries values(1746, "2016-04-24"); +insert into diaries values(1747, "2016-04-25"); +insert into diaries values(1748, "2016-04-26"); +insert into diaries values(1749, "2016-04-27"); +insert into diaries values(1750, "2016-04-28"); +insert into diaries values(1751, "2016-04-29"); +insert into diaries values(1752, "2016-04-30"); +insert into diaries values(1753, "2016-05-01"); +insert into diaries values(1754, "2016-05-02"); +insert into diaries values(1755, "2016-05-03"); +insert into diaries values(1756, "2016-05-04"); +insert into diaries values(1757, "2016-05-05"); +insert into diaries values(1758, "2016-05-06"); +insert into diaries values(1759, "2016-05-07"); +insert into diaries values(1760, "2016-05-08"); +insert into diaries values(1761, "2016-05-09"); +insert into diaries values(1762, "2016-05-10"); +insert into diaries values(1763, "2016-05-11"); +insert into diaries values(1764, "2016-05-12"); +insert into diaries values(1765, "2016-05-13"); +insert into diaries values(1766, "2016-05-14"); +insert into diaries values(1767, "2016-05-15"); +insert into diaries values(1768, "2016-05-16"); +insert into diaries values(1769, "2016-05-17"); +insert into diaries values(1770, "2016-05-18"); +insert into diaries values(1771, "2016-05-19"); +insert into diaries values(1772, "2016-05-20"); +insert into diaries values(1773, "2016-05-21"); +insert into diaries values(1774, "2016-05-22"); +insert into diaries values(1775, "2016-05-23"); +insert into diaries values(1776, "2016-05-24"); +insert into diaries values(1777, "2016-05-25"); +insert into diaries values(1778, "2016-05-26"); +insert into diaries values(1779, "2016-05-27"); +insert into diaries values(1780, "2016-05-28"); +insert into diaries values(1781, "2016-05-29"); +insert into diaries values(1782, "2016-05-30"); +insert into diaries values(1783, "2016-05-31"); +insert into diaries values(1784, "2016-06-01"); +insert into diaries values(1785, "2016-06-02"); +insert into diaries values(1786, "2016-06-03"); +insert into diaries values(1787, "2016-06-04"); +insert into diaries values(1788, "2016-06-05"); +insert into diaries values(1789, "2016-06-06"); +insert into diaries values(1790, "2016-06-07"); +insert into diaries values(1791, "2016-06-08"); +insert into diaries values(1792, "2016-06-09"); +insert into diaries values(1793, "2016-06-10"); +insert into diaries values(1794, "2016-06-11"); +insert into diaries values(1795, "2016-06-12"); +insert into diaries values(1796, "2016-06-13"); +insert into diaries values(1797, "2016-06-14"); +insert into diaries values(1798, "2016-06-15"); +insert into diaries values(1799, "2016-06-16"); +insert into diaries values(1800, "2016-06-17"); +insert into diaries values(1801, "2016-06-18"); +insert into diaries values(1802, "2016-06-19"); +insert into diaries values(1803, "2016-06-20"); +insert into diaries values(1804, "2016-06-21"); +insert into diaries values(1805, "2016-06-22"); +insert into diaries values(1806, "2016-06-23"); +insert into diaries values(1807, "2016-06-24"); +insert into diaries values(1808, "2016-06-25"); +insert into diaries values(1809, "2016-06-26"); +insert into diaries values(1810, "2016-06-27"); +insert into diaries values(1811, "2016-06-28"); +insert into diaries values(1812, "2016-06-29"); +insert into diaries values(1813, "2016-06-30"); +insert into diaries values(1814, "2016-07-01"); +insert into diaries values(1815, "2016-07-02"); +insert into diaries values(1816, "2016-07-03"); +insert into diaries values(1817, "2016-07-04"); +insert into diaries values(1818, "2016-07-05"); +insert into diaries values(1819, "2016-07-06"); +insert into diaries values(1820, "2016-07-07"); +insert into diaries values(1821, "2016-07-08"); +insert into diaries values(1822, "2016-07-09"); +insert into diaries values(1823, "2016-07-10"); +insert into diaries values(1824, "2016-07-11"); +insert into diaries values(1825, "2016-07-12"); +insert into diaries values(1826, "2016-07-13"); +insert into diaries values(1827, "2016-07-14"); +insert into diaries values(1828, "2016-07-15"); +insert into diaries values(1829, "2016-07-16"); +insert into diaries values(1830, "2016-07-17"); +insert into diaries values(1831, "2016-07-18"); +insert into diaries values(1832, "2016-07-19"); +insert into diaries values(1833, "2016-07-20"); +insert into diaries values(1834, "2016-07-21"); +insert into diaries values(1835, "2016-07-22"); +insert into diaries values(1836, "2016-07-23"); +insert into diaries values(1837, "2016-07-24"); +insert into diaries values(1838, "2016-07-25"); +insert into diaries values(1839, "2016-07-26"); +insert into diaries values(1840, "2016-07-27"); +insert into diaries values(1841, "2016-07-28"); +insert into diaries values(1842, "2016-07-29"); +insert into diaries values(1843, "2016-07-30"); +insert into diaries values(1844, "2016-07-31"); +insert into diaries values(1845, "2016-08-01"); +insert into diaries values(1846, "2016-08-02"); +insert into diaries values(1847, "2016-08-03"); +insert into diaries values(1848, "2016-08-04"); +insert into diaries values(1849, "2016-08-05"); +insert into diaries values(1850, "2016-08-06"); +insert into diaries values(1851, "2016-08-07"); +insert into diaries values(1852, "2016-08-08"); +insert into diaries values(1853, "2016-08-09"); +insert into diaries values(1854, "2016-08-10"); +insert into diaries values(1855, "2016-08-11"); +insert into diaries values(1856, "2016-08-12"); +insert into diaries values(1857, "2016-08-13"); +insert into diaries values(1858, "2016-08-14"); +insert into diaries values(1859, "2016-08-15"); +insert into diaries values(1860, "2016-08-16"); +insert into diaries values(1861, "2016-08-17"); +insert into diaries values(1862, "2016-08-18"); +insert into diaries values(1863, "2016-08-19"); +insert into diaries values(1864, "2016-08-20"); +insert into diaries values(1865, "2016-08-21"); +insert into diaries values(1866, "2016-08-22"); +insert into diaries values(1867, "2016-08-23"); +insert into diaries values(1868, "2016-08-24"); +insert into diaries values(1869, "2016-08-25"); +insert into diaries values(1870, "2016-08-26"); +insert into diaries values(1871, "2016-08-27"); +insert into diaries values(1872, "2016-08-28"); +insert into diaries values(1873, "2016-08-29"); +insert into diaries values(1874, "2016-08-30"); +insert into diaries values(1875, "2016-08-31"); +insert into diaries values(1876, "2016-09-01"); +insert into diaries values(1877, "2016-09-02"); +insert into diaries values(1878, "2016-09-03"); +insert into diaries values(1879, "2016-09-04"); +insert into diaries values(1880, "2016-09-05"); +insert into diaries values(1881, "2016-09-06"); +insert into diaries values(1882, "2016-09-07"); +insert into diaries values(1883, "2016-09-08"); +insert into diaries values(1884, "2016-09-09"); +insert into diaries values(1885, "2016-09-10"); +insert into diaries values(1886, "2016-09-11"); +insert into diaries values(1887, "2016-09-12"); +insert into diaries values(1888, "2016-09-13"); +insert into diaries values(1889, "2016-09-14"); +insert into diaries values(1890, "2016-09-15"); +insert into diaries values(1891, "2016-09-16"); +insert into diaries values(1892, "2016-09-17"); +insert into diaries values(1893, "2016-09-18"); +insert into diaries values(1894, "2016-09-19"); +insert into diaries values(1895, "2016-09-20"); +insert into diaries values(1896, "2016-09-21"); +insert into diaries values(1897, "2016-09-22"); +insert into diaries values(1898, "2016-09-23"); +insert into diaries values(1899, "2016-09-24"); +insert into diaries values(1900, "2016-09-25"); +insert into diaries values(1901, "2016-09-26"); +insert into diaries values(1902, "2016-09-27"); +insert into diaries values(1903, "2016-09-28"); +insert into diaries values(1904, "2016-09-29"); +insert into diaries values(1905, "2016-09-30"); +insert into diaries values(1906, "2016-10-01"); +insert into diaries values(1907, "2016-10-02"); +insert into diaries values(1908, "2016-10-03"); +insert into diaries values(1909, "2016-10-04"); +insert into diaries values(1910, "2016-10-05"); +insert into diaries values(1911, "2016-10-06"); +insert into diaries values(1912, "2016-10-07"); +insert into diaries values(1913, "2016-10-08"); +insert into diaries values(1914, "2016-10-09"); +insert into diaries values(1915, "2016-10-10"); +insert into diaries values(1916, "2016-10-11"); +insert into diaries values(1917, "2016-10-12"); +insert into diaries values(1918, "2016-10-13"); +insert into diaries values(1919, "2016-10-14"); +insert into diaries values(1920, "2016-10-15"); +insert into diaries values(1921, "2016-10-16"); +insert into diaries values(1922, "2016-10-17"); +insert into diaries values(1923, "2016-10-18"); +insert into diaries values(1924, "2016-10-19"); +insert into diaries values(1925, "2016-10-20"); +insert into diaries values(1926, "2016-10-21"); +insert into diaries values(1927, "2016-10-22"); +insert into diaries values(1928, "2016-10-23"); +insert into diaries values(1929, "2016-10-24"); +insert into diaries values(1930, "2016-10-25"); +insert into diaries values(1931, "2016-10-26"); +insert into diaries values(1932, "2016-10-27"); +insert into diaries values(1933, "2016-10-28"); +insert into diaries values(1934, "2016-10-29"); +insert into diaries values(1935, "2016-10-30"); +insert into diaries values(1936, "2016-10-31"); +insert into diaries values(1937, "2016-11-01"); +insert into diaries values(1938, "2016-11-02"); +insert into diaries values(1939, "2016-11-03"); +insert into diaries values(1940, "2016-11-04"); +insert into diaries values(1941, "2016-11-05"); +insert into diaries values(1942, "2016-11-06"); +insert into diaries values(1943, "2016-11-07"); +insert into diaries values(1944, "2016-11-08"); +insert into diaries values(1945, "2016-11-09"); +insert into diaries values(1946, "2016-11-10"); +insert into diaries values(1947, "2016-11-11"); +insert into diaries values(1948, "2016-11-12"); +insert into diaries values(1949, "2016-11-13"); +insert into diaries values(1950, "2016-11-14"); +insert into diaries values(1951, "2016-11-15"); +insert into diaries values(1952, "2016-11-16"); +insert into diaries values(1953, "2016-11-17"); +insert into diaries values(1954, "2016-11-18"); +insert into diaries values(1955, "2016-11-19"); +insert into diaries values(1956, "2016-11-20"); +insert into diaries values(1957, "2016-11-21"); +insert into diaries values(1958, "2016-11-22"); +insert into diaries values(1959, "2016-11-23"); +insert into diaries values(1960, "2016-11-24"); +insert into diaries values(1961, "2016-11-25"); +insert into diaries values(1962, "2016-11-26"); +insert into diaries values(1963, "2016-11-27"); +insert into diaries values(1964, "2016-11-28"); +insert into diaries values(1965, "2016-11-29"); +insert into diaries values(1966, "2016-11-30"); +insert into diaries values(1967, "2016-12-01"); +insert into diaries values(1968, "2016-12-02"); +insert into diaries values(1969, "2016-12-03"); +insert into diaries values(1970, "2016-12-04"); +insert into diaries values(1971, "2016-12-05"); +insert into diaries values(1972, "2016-12-06"); +insert into diaries values(1973, "2016-12-07"); +insert into diaries values(1974, "2016-12-08"); +insert into diaries values(1975, "2016-12-09"); +insert into diaries values(1976, "2016-12-10"); +insert into diaries values(1977, "2016-12-11"); +insert into diaries values(1978, "2016-12-12"); +insert into diaries values(1979, "2016-12-13"); +insert into diaries values(1980, "2016-12-14"); +insert into diaries values(1981, "2016-12-15"); +insert into diaries values(1982, "2016-12-16"); +insert into diaries values(1983, "2016-12-17"); +insert into diaries values(1984, "2016-12-18"); +insert into diaries values(1985, "2016-12-19"); +insert into diaries values(1986, "2016-12-20"); +insert into diaries values(1987, "2016-12-21"); +insert into diaries values(1988, "2016-12-22"); +insert into diaries values(1989, "2016-12-23"); +insert into diaries values(1990, "2016-12-24"); +insert into diaries values(1991, "2016-12-25"); +insert into diaries values(1992, "2016-12-26"); +insert into diaries values(1993, "2016-12-27"); +insert into diaries values(1994, "2016-12-28"); +insert into diaries values(1995, "2016-12-29"); +insert into diaries values(1996, "2016-12-30"); +insert into diaries values(1997, "2016-12-31"); +insert into diaries values(1998, "2017-01-01"); +insert into diaries values(1999, "2017-01-02"); +insert into diaries values(2000, "2017-01-03"); +insert into diaries values(2001, "2017-01-04"); +insert into diaries values(2002, "2017-01-05"); +insert into diaries values(2003, "2017-01-06"); +insert into diaries values(2004, "2017-01-07"); +insert into diaries values(2005, "2017-01-08"); +insert into diaries values(2006, "2017-01-09"); +insert into diaries values(2007, "2017-01-10"); +insert into diaries values(2008, "2017-01-11"); +insert into diaries values(2009, "2017-01-12"); +insert into diaries values(2010, "2017-01-13"); +insert into diaries values(2011, "2017-01-14"); +insert into diaries values(2012, "2017-01-15"); +insert into diaries values(2013, "2017-01-16"); +insert into diaries values(2014, "2017-01-17"); +insert into diaries values(2015, "2017-01-18"); +insert into diaries values(2016, "2017-01-19"); +insert into diaries values(2017, "2017-01-20"); +insert into diaries values(2018, "2017-01-21"); +insert into diaries values(2019, "2017-01-22"); +insert into diaries values(2020, "2017-01-23"); +insert into diaries values(2021, "2017-01-24"); +insert into diaries values(2022, "2017-01-25"); +insert into diaries values(2023, "2017-01-26"); +insert into diaries values(2024, "2017-01-27"); +insert into diaries values(2025, "2017-01-28"); +insert into diaries values(2026, "2017-01-29"); +insert into diaries values(2027, "2017-01-30"); +insert into diaries values(2028, "2017-01-31"); +insert into diaries values(2029, "2017-02-01"); +insert into diaries values(2030, "2017-02-02"); +insert into diaries values(2031, "2017-02-03"); +insert into diaries values(2032, "2017-02-04"); +insert into diaries values(2033, "2017-02-05"); +insert into diaries values(2034, "2017-02-06"); +insert into diaries values(2035, "2017-02-07"); +insert into diaries values(2036, "2017-02-08"); +insert into diaries values(2037, "2017-02-09"); +insert into diaries values(2038, "2017-02-10"); +insert into diaries values(2039, "2017-02-11"); +insert into diaries values(2040, "2017-02-12"); +insert into diaries values(2041, "2017-02-13"); +insert into diaries values(2042, "2017-02-14"); +insert into diaries values(2043, "2017-02-15"); +insert into diaries values(2044, "2017-02-16"); +insert into diaries values(2045, "2017-02-17"); +insert into diaries values(2046, "2017-02-18"); +insert into diaries values(2047, "2017-02-19"); +insert into diaries values(2048, "2017-02-20"); +insert into diaries values(2049, "2017-02-21"); +insert into diaries values(2050, "2017-02-22"); +insert into diaries values(2051, "2017-02-23"); +insert into diaries values(2052, "2017-02-24"); +insert into diaries values(2053, "2017-02-25"); +insert into diaries values(2054, "2017-02-26"); +insert into diaries values(2055, "2017-02-27"); +insert into diaries values(2056, "2017-02-28"); +insert into diaries values(2057, "2017-03-01"); +insert into diaries values(2058, "2017-03-02"); +insert into diaries values(2059, "2017-03-03"); +insert into diaries values(2060, "2017-03-04"); +insert into diaries values(2061, "2017-03-05"); +insert into diaries values(2062, "2017-03-06"); +insert into diaries values(2063, "2017-03-07"); +insert into diaries values(2064, "2017-03-08"); +insert into diaries values(2065, "2017-03-09"); +insert into diaries values(2066, "2017-03-10"); +insert into diaries values(2067, "2017-03-11"); +insert into diaries values(2068, "2017-03-12"); +insert into diaries values(2069, "2017-03-13"); +insert into diaries values(2070, "2017-03-14"); +insert into diaries values(2071, "2017-03-15"); +insert into diaries values(2072, "2017-03-16"); +insert into diaries values(2073, "2017-03-17"); +insert into diaries values(2074, "2017-03-18"); +insert into diaries values(2075, "2017-03-19"); +insert into diaries values(2076, "2017-03-20"); +insert into diaries values(2077, "2017-03-21"); +insert into diaries values(2078, "2017-03-22"); +insert into diaries values(2079, "2017-03-23"); +insert into diaries values(2080, "2017-03-24"); +insert into diaries values(2081, "2017-03-25"); +insert into diaries values(2082, "2017-03-26"); +insert into diaries values(2083, "2017-03-27"); +insert into diaries values(2084, "2017-03-28"); +insert into diaries values(2085, "2017-03-29"); +insert into diaries values(2086, "2017-03-30"); +insert into diaries values(2087, "2017-03-31"); +insert into diaries values(2088, "2017-04-01"); +insert into diaries values(2089, "2017-04-02"); +insert into diaries values(2090, "2017-04-03"); +insert into diaries values(2091, "2017-04-04"); +insert into diaries values(2092, "2017-04-05"); +insert into diaries values(2093, "2017-04-06"); +insert into diaries values(2094, "2017-04-07"); +insert into diaries values(2095, "2017-04-08"); +insert into diaries values(2096, "2017-04-09"); +insert into diaries values(2097, "2017-04-10"); +insert into diaries values(2098, "2017-04-11"); +insert into diaries values(2099, "2017-04-12"); +insert into diaries values(2100, "2017-04-13"); +insert into diaries values(2101, "2017-04-14"); +insert into diaries values(2102, "2017-04-15"); +insert into diaries values(2103, "2017-04-16"); +insert into diaries values(2104, "2017-04-17"); +insert into diaries values(2105, "2017-04-18"); +insert into diaries values(2106, "2017-04-19"); +insert into diaries values(2107, "2017-04-20"); +insert into diaries values(2108, "2017-04-21"); +insert into diaries values(2109, "2017-04-22"); +insert into diaries values(2110, "2017-04-23"); +insert into diaries values(2111, "2017-04-24"); +insert into diaries values(2112, "2017-04-25"); +insert into diaries values(2113, "2017-04-26"); +insert into diaries values(2114, "2017-04-27"); +insert into diaries values(2115, "2017-04-28"); +insert into diaries values(2116, "2017-04-29"); +insert into diaries values(2117, "2017-04-30"); +insert into diaries values(2118, "2017-05-01"); +insert into diaries values(2119, "2017-05-02"); +insert into diaries values(2120, "2017-05-03"); +insert into diaries values(2121, "2017-05-04"); +insert into diaries values(2122, "2017-05-05"); +insert into diaries values(2123, "2017-05-06"); +insert into diaries values(2124, "2017-05-07"); +insert into diaries values(2125, "2017-05-08"); +insert into diaries values(2126, "2017-05-09"); +insert into diaries values(2127, "2017-05-10"); +insert into diaries values(2128, "2017-05-11"); +insert into diaries values(2129, "2017-05-12"); +insert into diaries values(2130, "2017-05-13"); +insert into diaries values(2131, "2017-05-14"); +insert into diaries values(2132, "2017-05-15"); +insert into diaries values(2133, "2017-05-16"); +insert into diaries values(2134, "2017-05-17"); +insert into diaries values(2135, "2017-05-18"); +insert into diaries values(2136, "2017-05-19"); +insert into diaries values(2137, "2017-05-20"); +insert into diaries values(2138, "2017-05-21"); +insert into diaries values(2139, "2017-05-22"); +insert into diaries values(2140, "2017-05-23"); +insert into diaries values(2141, "2017-05-24"); +insert into diaries values(2142, "2017-05-25"); +insert into diaries values(2143, "2017-05-26"); +insert into diaries values(2144, "2017-05-27"); +insert into diaries values(2145, "2017-05-28"); +insert into diaries values(2146, "2017-05-29"); +insert into diaries values(2147, "2017-05-30"); +insert into diaries values(2148, "2017-05-31"); +insert into diaries values(2149, "2017-06-01"); +insert into diaries values(2150, "2017-06-02"); +insert into diaries values(2151, "2017-06-03"); +insert into diaries values(2152, "2017-06-04"); +insert into diaries values(2153, "2017-06-05"); +insert into diaries values(2154, "2017-06-06"); +insert into diaries values(2155, "2017-06-07"); +insert into diaries values(2156, "2017-06-08"); +insert into diaries values(2157, "2017-06-09"); +insert into diaries values(2158, "2017-06-10"); +insert into diaries values(2159, "2017-06-11"); +insert into diaries values(2160, "2017-06-12"); +insert into diaries values(2161, "2017-06-13"); +insert into diaries values(2162, "2017-06-14"); +insert into diaries values(2163, "2017-06-15"); +insert into diaries values(2164, "2017-06-16"); +insert into diaries values(2165, "2017-06-17"); +insert into diaries values(2166, "2017-06-18"); +insert into diaries values(2167, "2017-06-19"); +insert into diaries values(2168, "2017-06-20"); +insert into diaries values(2169, "2017-06-21"); +insert into diaries values(2170, "2017-06-22"); +insert into diaries values(2171, "2017-06-23"); +insert into diaries values(2172, "2017-06-24"); +insert into diaries values(2173, "2017-06-25"); +insert into diaries values(2174, "2017-06-26"); +insert into diaries values(2175, "2017-06-27"); +insert into diaries values(2176, "2017-06-28"); +insert into diaries values(2177, "2017-06-29"); +insert into diaries values(2178, "2017-06-30"); +insert into diaries values(2179, "2017-07-01"); +insert into diaries values(2180, "2017-07-02"); +insert into diaries values(2181, "2017-07-03"); +insert into diaries values(2182, "2017-07-04"); +insert into diaries values(2183, "2017-07-05"); +insert into diaries values(2184, "2017-07-06"); +insert into diaries values(2185, "2017-07-07"); +insert into diaries values(2186, "2017-07-08"); +insert into diaries values(2187, "2017-07-09"); +insert into diaries values(2188, "2017-07-10"); +insert into diaries values(2189, "2017-07-11"); +insert into diaries values(2190, "2017-07-12"); +insert into diaries values(2191, "2017-07-13"); +insert into diaries values(2192, "2017-07-14"); +insert into diaries values(2193, "2017-07-15"); +insert into diaries values(2194, "2017-07-16"); +insert into diaries values(2195, "2017-07-17"); +insert into diaries values(2196, "2017-07-18"); +insert into diaries values(2197, "2017-07-19"); +insert into diaries values(2198, "2017-07-20"); +insert into diaries values(2199, "2017-07-21"); +insert into diaries values(2200, "2017-07-22"); +insert into diaries values(2201, "2017-07-23"); +insert into diaries values(2202, "2017-07-24"); +insert into diaries values(2203, "2017-07-25"); +insert into diaries values(2204, "2017-07-26"); +insert into diaries values(2205, "2017-07-27"); +insert into diaries values(2206, "2017-07-28"); +insert into diaries values(2207, "2017-07-29"); +insert into diaries values(2208, "2017-07-30"); +insert into diaries values(2209, "2017-07-31"); +insert into diaries values(2210, "2017-08-01"); +insert into diaries values(2211, "2017-08-02"); +insert into diaries values(2212, "2017-08-03"); +insert into diaries values(2213, "2017-08-04"); +insert into diaries values(2214, "2017-08-05"); +insert into diaries values(2215, "2017-08-06"); +insert into diaries values(2216, "2017-08-07"); +insert into diaries values(2217, "2017-08-08"); +insert into diaries values(2218, "2017-08-09"); +insert into diaries values(2219, "2017-08-10"); +insert into diaries values(2220, "2017-08-11"); +insert into diaries values(2221, "2017-08-12"); +insert into diaries values(2222, "2017-08-13"); +insert into diaries values(2223, "2017-08-14"); +insert into diaries values(2224, "2017-08-15"); +insert into diaries values(2225, "2017-08-16"); +insert into diaries values(2226, "2017-08-17"); +insert into diaries values(2227, "2017-08-18"); +insert into diaries values(2228, "2017-08-19"); +insert into diaries values(2229, "2017-08-20"); +insert into diaries values(2230, "2017-08-21"); +insert into diaries values(2231, "2017-08-22"); +insert into diaries values(2232, "2017-08-23"); +insert into diaries values(2233, "2017-08-24"); +insert into diaries values(2234, "2017-08-25"); +insert into diaries values(2235, "2017-08-26"); +insert into diaries values(2236, "2017-08-27"); +insert into diaries values(2237, "2017-08-28"); +insert into diaries values(2238, "2017-08-29"); +insert into diaries values(2239, "2017-08-30"); +insert into diaries values(2240, "2017-08-31"); +insert into diaries values(2241, "2017-09-01"); +insert into diaries values(2242, "2017-09-02"); +insert into diaries values(2243, "2017-09-03"); +insert into diaries values(2244, "2017-09-04"); +insert into diaries values(2245, "2017-09-05"); +insert into diaries values(2246, "2017-09-06"); +insert into diaries values(2247, "2017-09-07"); +insert into diaries values(2248, "2017-09-08"); +insert into diaries values(2249, "2017-09-09"); +insert into diaries values(2250, "2017-09-10"); +insert into diaries values(2251, "2017-09-11"); +insert into diaries values(2252, "2017-09-12"); +insert into diaries values(2253, "2017-09-13"); +insert into diaries values(2254, "2017-09-14"); +insert into diaries values(2255, "2017-09-15"); +insert into diaries values(2256, "2017-09-16"); +insert into diaries values(2257, "2017-09-17"); +insert into diaries values(2258, "2017-09-18"); +insert into diaries values(2259, "2017-09-19"); +insert into diaries values(2260, "2017-09-20"); +insert into diaries values(2261, "2017-09-21"); +insert into diaries values(2262, "2017-09-22"); +insert into diaries values(2263, "2017-09-23"); +insert into diaries values(2264, "2017-09-24"); +insert into diaries values(2265, "2017-09-25"); +insert into diaries values(2266, "2017-09-26"); +insert into diaries values(2267, "2017-09-27"); +insert into diaries values(2268, "2017-09-28"); +insert into diaries values(2269, "2017-09-29"); +insert into diaries values(2270, "2017-09-30"); +insert into diaries values(2271, "2017-10-01"); +insert into diaries values(2272, "2017-10-02"); +insert into diaries values(2273, "2017-10-03"); +insert into diaries values(2274, "2017-10-04"); +insert into diaries values(2275, "2017-10-05"); +insert into diaries values(2276, "2017-10-06"); +insert into diaries values(2277, "2017-10-07"); +insert into diaries values(2278, "2017-10-08"); +insert into diaries values(2279, "2017-10-09"); +insert into diaries values(2280, "2017-10-10"); +insert into diaries values(2281, "2017-10-11"); +insert into diaries values(2282, "2017-10-12"); +insert into diaries values(2283, "2017-10-13"); +insert into diaries values(2284, "2017-10-14"); +insert into diaries values(2285, "2017-10-15"); +insert into diaries values(2286, "2017-10-16"); +insert into diaries values(2287, "2017-10-17"); +insert into diaries values(2288, "2017-10-18"); +insert into diaries values(2289, "2017-10-19"); +insert into diaries values(2290, "2017-10-20"); +insert into diaries values(2291, "2017-10-21"); +insert into diaries values(2292, "2017-10-22"); +insert into diaries values(2293, "2017-10-23"); +insert into diaries values(2294, "2017-10-24"); +insert into diaries values(2295, "2017-10-25"); +insert into diaries values(2296, "2017-10-26"); +insert into diaries values(2297, "2017-10-27"); +insert into diaries values(2298, "2017-10-28"); +insert into diaries values(2299, "2017-10-29"); +insert into diaries values(2300, "2017-10-30"); +insert into diaries values(2301, "2017-10-31"); +insert into diaries values(2302, "2017-11-01"); +insert into diaries values(2303, "2017-11-02"); +insert into diaries values(2304, "2017-11-03"); +insert into diaries values(2305, "2017-11-04"); +insert into diaries values(2306, "2017-11-05"); +insert into diaries values(2307, "2017-11-06"); +insert into diaries values(2308, "2017-11-07"); +insert into diaries values(2309, "2017-11-08"); +insert into diaries values(2310, "2017-11-09"); +insert into diaries values(2311, "2017-11-10"); +insert into diaries values(2312, "2017-11-11"); +insert into diaries values(2313, "2017-11-12"); +insert into diaries values(2314, "2017-11-13"); +insert into diaries values(2315, "2017-11-14"); +insert into diaries values(2316, "2017-11-15"); +insert into diaries values(2317, "2017-11-16"); +insert into diaries values(2318, "2017-11-17"); +insert into diaries values(2319, "2017-11-18"); +insert into diaries values(2320, "2017-11-19"); +insert into diaries values(2321, "2017-11-20"); +insert into diaries values(2322, "2017-11-21"); +insert into diaries values(2323, "2017-11-22"); +insert into diaries values(2324, "2017-11-23"); +insert into diaries values(2325, "2017-11-24"); +insert into diaries values(2326, "2017-11-25"); +insert into diaries values(2327, "2017-11-26"); +insert into diaries values(2328, "2017-11-27"); +insert into diaries values(2329, "2017-11-28"); +insert into diaries values(2330, "2017-11-29"); +insert into diaries values(2331, "2017-11-30"); +insert into diaries values(2332, "2017-12-01"); +insert into diaries values(2333, "2017-12-02"); +insert into diaries values(2334, "2017-12-03"); +insert into diaries values(2335, "2017-12-04"); +insert into diaries values(2336, "2017-12-05"); +insert into diaries values(2337, "2017-12-06"); +insert into diaries values(2338, "2017-12-07"); +insert into diaries values(2339, "2017-12-08"); +insert into diaries values(2340, "2017-12-09"); +insert into diaries values(2341, "2017-12-10"); +insert into diaries values(2342, "2017-12-11"); +insert into diaries values(2343, "2017-12-12"); +insert into diaries values(2344, "2017-12-13"); +insert into diaries values(2345, "2017-12-14"); +insert into diaries values(2346, "2017-12-15"); +insert into diaries values(2347, "2017-12-16"); +insert into diaries values(2348, "2017-12-17"); +insert into diaries values(2349, "2017-12-18"); +insert into diaries values(2350, "2017-12-19"); +insert into diaries values(2351, "2017-12-20"); +insert into diaries values(2352, "2017-12-21"); +insert into diaries values(2353, "2017-12-22"); +insert into diaries values(2354, "2017-12-23"); +insert into diaries values(2355, "2017-12-24"); +insert into diaries values(2356, "2017-12-25"); +insert into diaries values(2357, "2017-12-26"); +insert into diaries values(2358, "2017-12-27"); +insert into diaries values(2359, "2017-12-28"); +insert into diaries values(2360, "2017-12-29"); +insert into diaries values(2361, "2017-12-30"); +insert into diaries values(2362, "2017-12-31"); +insert into diaries values(2363, "2018-01-01"); +insert into diaries values(2364, "2018-01-02"); +insert into diaries values(2365, "2018-01-03"); +insert into diaries values(2366, "2018-01-04"); +insert into diaries values(2367, "2018-01-05"); +insert into diaries values(2368, "2018-01-06"); +insert into diaries values(2369, "2018-01-07"); +insert into diaries values(2370, "2018-01-08"); +insert into diaries values(2371, "2018-01-09"); +insert into diaries values(2372, "2018-01-10"); +insert into diaries values(2373, "2018-01-11"); +insert into diaries values(2374, "2018-01-12"); +insert into diaries values(2375, "2018-01-13"); +insert into diaries values(2376, "2018-01-14"); +insert into diaries values(2377, "2018-01-15"); +insert into diaries values(2378, "2018-01-16"); +insert into diaries values(2379, "2018-01-17"); +insert into diaries values(2380, "2018-01-18"); +insert into diaries values(2381, "2018-01-19"); +insert into diaries values(2382, "2018-01-20"); +insert into diaries values(2383, "2018-01-21"); +insert into diaries values(2384, "2018-01-22"); +insert into diaries values(2385, "2018-01-23"); +insert into diaries values(2386, "2018-01-24"); +insert into diaries values(2387, "2018-01-25"); +insert into diaries values(2388, "2018-01-26"); +insert into diaries values(2389, "2018-01-27"); +insert into diaries values(2390, "2018-01-28"); +insert into diaries values(2391, "2018-01-29"); +insert into diaries values(2392, "2018-01-30"); +insert into diaries values(2393, "2018-01-31"); +insert into diaries values(2394, "2018-02-01"); +insert into diaries values(2395, "2018-02-02"); +insert into diaries values(2396, "2018-02-03"); +insert into diaries values(2397, "2018-02-04"); +insert into diaries values(2398, "2018-02-05"); +insert into diaries values(2399, "2018-02-06"); +insert into diaries values(2400, "2018-02-07"); +insert into diaries values(2401, "2018-02-08"); +insert into diaries values(2402, "2018-02-09"); +insert into diaries values(2403, "2018-02-10"); +insert into diaries values(2404, "2018-02-11"); +insert into diaries values(2405, "2018-02-12"); +insert into diaries values(2406, "2018-02-13"); +insert into diaries values(2407, "2018-02-14"); +insert into diaries values(2408, "2018-02-15"); +insert into diaries values(2409, "2018-02-16"); +insert into diaries values(2410, "2018-02-17"); +insert into diaries values(2411, "2018-02-18"); +insert into diaries values(2412, "2018-02-19"); +insert into diaries values(2413, "2018-02-20"); +insert into diaries values(2414, "2018-02-21"); +insert into diaries values(2415, "2018-02-22"); +insert into diaries values(2416, "2018-02-23"); +insert into diaries values(2417, "2018-02-24"); +insert into diaries values(2418, "2018-02-25"); +insert into diaries values(2419, "2018-02-26"); +insert into diaries values(2420, "2018-02-27"); +insert into diaries values(2421, "2018-02-28"); +insert into diaries values(2422, "2018-03-01"); +insert into diaries values(2423, "2018-03-02"); +insert into diaries values(2424, "2018-03-03"); +insert into diaries values(2425, "2018-03-04"); +insert into diaries values(2426, "2018-03-05"); +insert into diaries values(2427, "2018-03-06"); +insert into diaries values(2428, "2018-03-07"); +insert into diaries values(2429, "2018-03-08"); +insert into diaries values(2430, "2018-03-09"); +insert into diaries values(2431, "2018-03-10"); +insert into diaries values(2432, "2018-03-11"); +insert into diaries values(2433, "2018-03-12"); +insert into diaries values(2434, "2018-03-13"); +insert into diaries values(2435, "2018-03-14"); +insert into diaries values(2436, "2018-03-15"); +insert into diaries values(2437, "2018-03-16"); +insert into diaries values(2438, "2018-03-17"); +insert into diaries values(2439, "2018-03-18"); +insert into diaries values(2440, "2018-03-19"); +insert into diaries values(2441, "2018-03-20"); +insert into diaries values(2442, "2018-03-21"); +insert into diaries values(2443, "2018-03-22"); +insert into diaries values(2444, "2018-03-23"); +insert into diaries values(2445, "2018-03-24"); +insert into diaries values(2446, "2018-03-25"); +insert into diaries values(2447, "2018-03-26"); +insert into diaries values(2448, "2018-03-27"); +insert into diaries values(2449, "2018-03-28"); +insert into diaries values(2450, "2018-03-29"); +insert into diaries values(2451, "2018-03-30"); +insert into diaries values(2452, "2018-03-31"); +insert into diaries values(2453, "2018-04-01"); +insert into diaries values(2454, "2018-04-02"); +insert into diaries values(2455, "2018-04-03"); +insert into diaries values(2456, "2018-04-04"); +insert into diaries values(2457, "2018-04-05"); +insert into diaries values(2458, "2018-04-06"); +insert into diaries values(2459, "2018-04-07"); +insert into diaries values(2460, "2018-04-08"); +insert into diaries values(2461, "2018-04-09"); +insert into diaries values(2462, "2018-04-10"); +insert into diaries values(2463, "2018-04-11"); +insert into diaries values(2464, "2018-04-12"); +insert into diaries values(2465, "2018-04-13"); +insert into diaries values(2466, "2018-04-14"); +insert into diaries values(2467, "2018-04-15"); +insert into diaries values(2468, "2018-04-16"); +insert into diaries values(2469, "2018-04-17"); +insert into diaries values(2470, "2018-04-18"); +insert into diaries values(2471, "2018-04-19"); +insert into diaries values(2472, "2018-04-20"); +insert into diaries values(2473, "2018-04-21"); +insert into diaries values(2474, "2018-04-22"); +insert into diaries values(2475, "2018-04-23"); +insert into diaries values(2476, "2018-04-24"); +insert into diaries values(2477, "2018-04-25"); +insert into diaries values(2478, "2018-04-26"); +insert into diaries values(2479, "2018-04-27"); +insert into diaries values(2480, "2018-04-28"); +insert into diaries values(2481, "2018-04-29"); +insert into diaries values(2482, "2018-04-30"); +insert into diaries values(2483, "2018-05-01"); +insert into diaries values(2484, "2018-05-02"); +insert into diaries values(2485, "2018-05-03"); +insert into diaries values(2486, "2018-05-04"); +insert into diaries values(2487, "2018-05-05"); +insert into diaries values(2488, "2018-05-06"); +insert into diaries values(2489, "2018-05-07"); +insert into diaries values(2490, "2018-05-08"); +insert into diaries values(2491, "2018-05-09"); +insert into diaries values(2492, "2018-05-10"); +insert into diaries values(2493, "2018-05-11"); +insert into diaries values(2494, "2018-05-12"); +insert into diaries values(2495, "2018-05-13"); +insert into diaries values(2496, "2018-05-14"); +insert into diaries values(2497, "2018-05-15"); +insert into diaries values(2498, "2018-05-16"); +insert into diaries values(2499, "2018-05-17"); +insert into diaries values(2500, "2018-05-18"); +insert into diaries values(2501, "2018-05-19"); +insert into diaries values(2502, "2018-05-20"); +insert into diaries values(2503, "2018-05-21"); +insert into diaries values(2504, "2018-05-22"); +insert into diaries values(2505, "2018-05-23"); +insert into diaries values(2506, "2018-05-24"); +insert into diaries values(2507, "2018-05-25"); +insert into diaries values(2508, "2018-05-26"); +insert into diaries values(2509, "2018-05-27"); +insert into diaries values(2510, "2018-05-28"); +insert into diaries values(2511, "2018-05-29"); +insert into diaries values(2512, "2018-05-30"); +insert into diaries values(2513, "2018-05-31"); +insert into diaries values(2514, "2018-06-01"); +insert into diaries values(2515, "2018-06-02"); +insert into diaries values(2516, "2018-06-03"); +insert into diaries values(2517, "2018-06-04"); +insert into diaries values(2518, "2018-06-05"); +insert into diaries values(2519, "2018-06-06"); +insert into diaries values(2520, "2018-06-07"); +insert into diaries values(2521, "2018-06-08"); +insert into diaries values(2522, "2018-06-09"); +insert into diaries values(2523, "2018-06-10"); +insert into diaries values(2524, "2018-06-11"); +insert into diaries values(2525, "2018-06-12"); +insert into diaries values(2526, "2018-06-13"); +insert into diaries values(2527, "2018-06-14"); +insert into diaries values(2528, "2018-06-15"); +insert into diaries values(2529, "2018-06-16"); +insert into diaries values(2530, "2018-06-17"); +insert into diaries values(2531, "2018-06-18"); +insert into diaries values(2532, "2018-06-19"); +insert into diaries values(2533, "2018-06-20"); +insert into diaries values(2534, "2018-06-21"); +insert into diaries values(2535, "2018-06-22"); +insert into diaries values(2536, "2018-06-23"); +insert into diaries values(2537, "2018-06-24"); +insert into diaries values(2538, "2018-06-25"); +insert into diaries values(2539, "2018-06-26"); +insert into diaries values(2540, "2018-06-27"); +insert into diaries values(2541, "2018-06-28"); +insert into diaries values(2542, "2018-06-29"); +insert into diaries values(2543, "2018-06-30"); +insert into diaries values(2544, "2018-07-01"); +insert into diaries values(2545, "2018-07-02"); +insert into diaries values(2546, "2018-07-03"); +insert into diaries values(2547, "2018-07-04"); +insert into diaries values(2548, "2018-07-05"); +insert into diaries values(2549, "2018-07-06"); +insert into diaries values(2550, "2018-07-07"); +insert into diaries values(2551, "2018-07-08"); +insert into diaries values(2552, "2018-07-09"); +insert into diaries values(2553, "2018-07-10"); +insert into diaries values(2554, "2018-07-11"); +insert into diaries values(2555, "2018-07-12"); +insert into diaries values(2556, "2018-07-13"); +insert into diaries values(2557, "2018-07-14"); +insert into diaries values(2558, "2018-07-15"); +insert into diaries values(2559, "2018-07-16"); +insert into diaries values(2560, "2018-07-17"); +insert into diaries values(2561, "2018-07-18"); +insert into diaries values(2562, "2018-07-19"); +insert into diaries values(2563, "2018-07-20"); +insert into diaries values(2564, "2018-07-21"); +insert into diaries values(2565, "2018-07-22"); +insert into diaries values(2566, "2018-07-23"); +insert into diaries values(2567, "2018-07-24"); +insert into diaries values(2568, "2018-07-25"); +insert into diaries values(2569, "2018-07-26"); +insert into diaries values(2570, "2018-07-27"); +insert into diaries values(2571, "2018-07-28"); +insert into diaries values(2572, "2018-07-29"); +insert into diaries values(2573, "2018-07-30"); +insert into diaries values(2574, "2018-07-31"); +insert into diaries values(2575, "2018-08-01"); +insert into diaries values(2576, "2018-08-02"); +insert into diaries values(2577, "2018-08-03"); +insert into diaries values(2578, "2018-08-04"); +insert into diaries values(2579, "2018-08-05"); +insert into diaries values(2580, "2018-08-06"); +insert into diaries values(2581, "2018-08-07"); +insert into diaries values(2582, "2018-08-08"); +insert into diaries values(2583, "2018-08-09"); +insert into diaries values(2584, "2018-08-10"); +insert into diaries values(2585, "2018-08-11"); +insert into diaries values(2586, "2018-08-12"); +insert into diaries values(2587, "2018-08-13"); +insert into diaries values(2588, "2018-08-14"); +insert into diaries values(2589, "2018-08-15"); +insert into diaries values(2590, "2018-08-16"); +insert into diaries values(2591, "2018-08-17"); +insert into diaries values(2592, "2018-08-18"); +insert into diaries values(2593, "2018-08-19"); +insert into diaries values(2594, "2018-08-20"); +insert into diaries values(2595, "2018-08-21"); +insert into diaries values(2596, "2018-08-22"); +insert into diaries values(2597, "2018-08-23"); +insert into diaries values(2598, "2018-08-24"); +insert into diaries values(2599, "2018-08-25"); +insert into diaries values(2600, "2018-08-26"); +insert into diaries values(2601, "2018-08-27"); +insert into diaries values(2602, "2018-08-28"); +insert into diaries values(2603, "2018-08-29"); +insert into diaries values(2604, "2018-08-30"); +insert into diaries values(2605, "2018-08-31"); +insert into diaries values(2606, "2018-09-01"); +insert into diaries values(2607, "2018-09-02"); +insert into diaries values(2608, "2018-09-03"); +insert into diaries values(2609, "2018-09-04"); +insert into diaries values(2610, "2018-09-05"); +insert into diaries values(2611, "2018-09-06"); +insert into diaries values(2612, "2018-09-07"); +insert into diaries values(2613, "2018-09-08"); +insert into diaries values(2614, "2018-09-09"); +insert into diaries values(2615, "2018-09-10"); +insert into diaries values(2616, "2018-09-11"); +insert into diaries values(2617, "2018-09-12"); +insert into diaries values(2618, "2018-09-13"); +insert into diaries values(2619, "2018-09-14"); +insert into diaries values(2620, "2018-09-15"); +insert into diaries values(2621, "2018-09-16"); +insert into diaries values(2622, "2018-09-17"); +insert into diaries values(2623, "2018-09-18"); +insert into diaries values(2624, "2018-09-19"); +insert into diaries values(2625, "2018-09-20"); +insert into diaries values(2626, "2018-09-21"); +insert into diaries values(2627, "2018-09-22"); +insert into diaries values(2628, "2018-09-23"); +insert into diaries values(2629, "2018-09-24"); +insert into diaries values(2630, "2018-09-25"); +insert into diaries values(2631, "2018-09-26"); +insert into diaries values(2632, "2018-09-27"); +insert into diaries values(2633, "2018-09-28"); +insert into diaries values(2634, "2018-09-29"); +insert into diaries values(2635, "2018-09-30"); +insert into diaries values(2636, "2018-10-01"); +insert into diaries values(2637, "2018-10-02"); +insert into diaries values(2638, "2018-10-03"); +insert into diaries values(2639, "2018-10-04"); +insert into diaries values(2640, "2018-10-05"); +insert into diaries values(2641, "2018-10-06"); +insert into diaries values(2642, "2018-10-07"); +insert into diaries values(2643, "2018-10-08"); +insert into diaries values(2644, "2018-10-09"); +insert into diaries values(2645, "2018-10-10"); +insert into diaries values(2646, "2018-10-11"); +insert into diaries values(2647, "2018-10-12"); +insert into diaries values(2648, "2018-10-13"); +insert into diaries values(2649, "2018-10-14"); +insert into diaries values(2650, "2018-10-15"); +insert into diaries values(2651, "2018-10-16"); +insert into diaries values(2652, "2018-10-17"); +insert into diaries values(2653, "2018-10-18"); +insert into diaries values(2654, "2018-10-19"); +insert into diaries values(2655, "2018-10-20"); +insert into diaries values(2656, "2018-10-21"); +insert into diaries values(2657, "2018-10-22"); +insert into diaries values(2658, "2018-10-23"); +insert into diaries values(2659, "2018-10-24"); +insert into diaries values(2660, "2018-10-25"); +insert into diaries values(2661, "2018-10-26"); +insert into diaries values(2662, "2018-10-27"); +insert into diaries values(2663, "2018-10-28"); +insert into diaries values(2664, "2018-10-29"); +insert into diaries values(2665, "2018-10-30"); +insert into diaries values(2666, "2018-10-31"); +insert into diaries values(2667, "2018-11-01"); +insert into diaries values(2668, "2018-11-02"); +insert into diaries values(2669, "2018-11-03"); +insert into diaries values(2670, "2018-11-04"); +insert into diaries values(2671, "2018-11-05"); +insert into diaries values(2672, "2018-11-06"); +insert into diaries values(2673, "2018-11-07"); +insert into diaries values(2674, "2018-11-08"); +insert into diaries values(2675, "2018-11-09"); +insert into diaries values(2676, "2018-11-10"); +insert into diaries values(2677, "2018-11-11"); +insert into diaries values(2678, "2018-11-12"); +insert into diaries values(2679, "2018-11-13"); +insert into diaries values(2680, "2018-11-14"); +insert into diaries values(2681, "2018-11-15"); +insert into diaries values(2682, "2018-11-16"); +insert into diaries values(2683, "2018-11-17"); +insert into diaries values(2684, "2018-11-18"); +insert into diaries values(2685, "2018-11-19"); +insert into diaries values(2686, "2018-11-20"); +insert into diaries values(2687, "2018-11-21"); +insert into diaries values(2688, "2018-11-22"); +insert into diaries values(2689, "2018-11-23"); +insert into diaries values(2690, "2018-11-24"); +insert into diaries values(2691, "2018-11-25"); +insert into diaries values(2692, "2018-11-26"); +insert into diaries values(2693, "2018-11-27"); +insert into diaries values(2694, "2018-11-28"); +insert into diaries values(2695, "2018-11-29"); +insert into diaries values(2696, "2018-11-30"); +insert into diaries values(2697, "2018-12-01"); +insert into diaries values(2698, "2018-12-02"); +insert into diaries values(2699, "2018-12-03"); +insert into diaries values(2700, "2018-12-04"); +insert into diaries values(2701, "2018-12-05"); +insert into diaries values(2702, "2018-12-06"); +insert into diaries values(2703, "2018-12-07"); +insert into diaries values(2704, "2018-12-08"); +insert into diaries values(2705, "2018-12-09"); +insert into diaries values(2706, "2018-12-10"); +insert into diaries values(2707, "2018-12-11"); +insert into diaries values(2708, "2018-12-12"); +insert into diaries values(2709, "2018-12-13"); +insert into diaries values(2710, "2018-12-14"); +insert into diaries values(2711, "2018-12-15"); +insert into diaries values(2712, "2018-12-16"); +insert into diaries values(2713, "2018-12-17"); +insert into diaries values(2714, "2018-12-18"); +insert into diaries values(2715, "2018-12-19"); +insert into diaries values(2716, "2018-12-20"); +insert into diaries values(2717, "2018-12-21"); +insert into diaries values(2718, "2018-12-22"); +insert into diaries values(2719, "2018-12-23"); +insert into diaries values(2720, "2018-12-24"); +insert into diaries values(2721, "2018-12-25"); +insert into diaries values(2722, "2018-12-26"); +insert into diaries values(2723, "2018-12-27"); +insert into diaries values(2724, "2018-12-28"); +insert into diaries values(2725, "2018-12-29"); +insert into diaries values(2726, "2018-12-30"); +insert into diaries values(2727, "2018-12-31"); +insert into diaries values(2728, "2019-01-01"); +insert into diaries values(2729, "2019-01-02"); +insert into diaries values(2730, "2019-01-03"); +insert into diaries values(2731, "2019-01-04"); +insert into diaries values(2732, "2019-01-05"); +insert into diaries values(2733, "2019-01-06"); +insert into diaries values(2734, "2019-01-07"); +insert into diaries values(2735, "2019-01-08"); +insert into diaries values(2736, "2019-01-09"); +insert into diaries values(2737, "2019-01-10"); +insert into diaries values(2738, "2019-01-11"); +insert into diaries values(2739, "2019-01-12"); +insert into diaries values(2740, "2019-01-13"); +insert into diaries values(2741, "2019-01-14"); +insert into diaries values(2742, "2019-01-15"); +insert into diaries values(2743, "2019-01-16"); +insert into diaries values(2744, "2019-01-17"); +insert into diaries values(2745, "2019-01-18"); +insert into diaries values(2746, "2019-01-19"); +insert into diaries values(2747, "2019-01-20"); +insert into diaries values(2748, "2019-01-21"); +insert into diaries values(2749, "2019-01-22"); +insert into diaries values(2750, "2019-01-23"); +insert into diaries values(2751, "2019-01-24"); +insert into diaries values(2752, "2019-01-25"); +insert into diaries values(2753, "2019-01-26"); +insert into diaries values(2754, "2019-01-27"); +insert into diaries values(2755, "2019-01-28"); +insert into diaries values(2756, "2019-01-29"); +insert into diaries values(2757, "2019-01-30"); +insert into diaries values(2758, "2019-01-31"); +insert into diaries values(2759, "2019-02-01"); +insert into diaries values(2760, "2019-02-02"); +insert into diaries values(2761, "2019-02-03"); +insert into diaries values(2762, "2019-02-04"); +insert into diaries values(2763, "2019-02-05"); +insert into diaries values(2764, "2019-02-06"); +insert into diaries values(2765, "2019-02-07"); +insert into diaries values(2766, "2019-02-08"); +insert into diaries values(2767, "2019-02-09"); +insert into diaries values(2768, "2019-02-10"); +insert into diaries values(2769, "2019-02-11"); +insert into diaries values(2770, "2019-02-12"); +insert into diaries values(2771, "2019-02-13"); +insert into diaries values(2772, "2019-02-14"); +insert into diaries values(2773, "2019-02-15"); +insert into diaries values(2774, "2019-02-16"); +insert into diaries values(2775, "2019-02-17"); +insert into diaries values(2776, "2019-02-18"); +insert into diaries values(2777, "2019-02-19"); +insert into diaries values(2778, "2019-02-20"); +insert into diaries values(2779, "2019-02-21"); +insert into diaries values(2780, "2019-02-22"); +insert into diaries values(2781, "2019-02-23"); +insert into diaries values(2782, "2019-02-24"); +insert into diaries values(2783, "2019-02-25"); +insert into diaries values(2784, "2019-02-26"); +insert into diaries values(2785, "2019-02-27"); +insert into diaries values(2786, "2019-02-28"); +insert into diaries values(2787, "2019-03-01"); +insert into diaries values(2788, "2019-03-02"); +insert into diaries values(2789, "2019-03-03"); +insert into diaries values(2790, "2019-03-04"); +insert into diaries values(2791, "2019-03-05"); +insert into diaries values(2792, "2019-03-06"); +insert into diaries values(2793, "2019-03-07"); +insert into diaries values(2794, "2019-03-08"); +insert into diaries values(2795, "2019-03-09"); +insert into diaries values(2796, "2019-03-10"); +insert into diaries values(2797, "2019-03-11"); +insert into diaries values(2798, "2019-03-12"); +insert into diaries values(2799, "2019-03-13"); +insert into diaries values(2800, "2019-03-14"); +insert into diaries values(2801, "2019-03-15"); +insert into diaries values(2802, "2019-03-16"); +insert into diaries values(2803, "2019-03-17"); +insert into diaries values(2804, "2019-03-18"); +insert into diaries values(2805, "2019-03-19"); +insert into diaries values(2806, "2019-03-20"); +insert into diaries values(2807, "2019-03-21"); +insert into diaries values(2808, "2019-03-22"); +insert into diaries values(2809, "2019-03-23"); +insert into diaries values(2810, "2019-03-24"); +insert into diaries values(2811, "2019-03-25"); +insert into diaries values(2812, "2019-03-26"); +insert into diaries values(2813, "2019-03-27"); +insert into diaries values(2814, "2019-03-28"); +insert into diaries values(2815, "2019-03-29"); +insert into diaries values(2816, "2019-03-30"); +insert into diaries values(2817, "2019-03-31"); +insert into diaries values(2818, "2019-04-01"); +insert into diaries values(2819, "2019-04-02"); +insert into diaries values(2820, "2019-04-03"); +insert into diaries values(2821, "2019-04-04"); +insert into diaries values(2822, "2019-04-05"); +insert into diaries values(2823, "2019-04-06"); +insert into diaries values(2824, "2019-04-07"); +insert into diaries values(2825, "2019-04-08"); +insert into diaries values(2826, "2019-04-09"); +insert into diaries values(2827, "2019-04-10"); +insert into diaries values(2828, "2019-04-11"); +insert into diaries values(2829, "2019-04-12"); +insert into diaries values(2830, "2019-04-13"); +insert into diaries values(2831, "2019-04-14"); +insert into diaries values(2832, "2019-04-15"); +insert into diaries values(2833, "2019-04-16"); +insert into diaries values(2834, "2019-04-17"); +insert into diaries values(2835, "2019-04-18"); +insert into diaries values(2836, "2019-04-19"); +insert into diaries values(2837, "2019-04-20"); +insert into diaries values(2838, "2019-04-21"); +insert into diaries values(2839, "2019-04-22"); +insert into diaries values(2840, "2019-04-23"); +insert into diaries values(2841, "2019-04-24"); +insert into diaries values(2842, "2019-04-25"); +insert into diaries values(2843, "2019-04-26"); +insert into diaries values(2844, "2019-04-27"); +insert into diaries values(2845, "2019-04-28"); +insert into diaries values(2846, "2019-04-29"); +insert into diaries values(2847, "2019-04-30"); +insert into diaries values(2848, "2019-05-01"); +insert into diaries values(2849, "2019-05-02"); +insert into diaries values(2850, "2019-05-03"); +insert into diaries values(2851, "2019-05-04"); +insert into diaries values(2852, "2019-05-05"); +insert into diaries values(2853, "2019-05-06"); +insert into diaries values(2854, "2019-05-07"); +insert into diaries values(2855, "2019-05-08"); +insert into diaries values(2856, "2019-05-09"); +insert into diaries values(2857, "2019-05-10"); +insert into diaries values(2858, "2019-05-11"); +insert into diaries values(2859, "2019-05-12"); +insert into diaries values(2860, "2019-05-13"); +insert into diaries values(2861, "2019-05-14"); +insert into diaries values(2862, "2019-05-15"); +insert into diaries values(2863, "2019-05-16"); +insert into diaries values(2864, "2019-05-17"); +insert into diaries values(2865, "2019-05-18"); +insert into diaries values(2866, "2019-05-19"); +insert into diaries values(2867, "2019-05-20"); +insert into diaries values(2868, "2019-05-21"); +insert into diaries values(2869, "2019-05-22"); +insert into diaries values(2870, "2019-05-23"); +insert into diaries values(2871, "2019-05-24"); +insert into diaries values(2872, "2019-05-25"); +insert into diaries values(2873, "2019-05-26"); +insert into diaries values(2874, "2019-05-27"); +insert into diaries values(2875, "2019-05-28"); +insert into diaries values(2876, "2019-05-29"); +insert into diaries values(2877, "2019-05-30"); +insert into diaries values(2878, "2019-05-31"); +insert into diaries values(2879, "2019-06-01"); +insert into diaries values(2880, "2019-06-02"); +insert into diaries values(2881, "2019-06-03"); +insert into diaries values(2882, "2019-06-04"); +insert into diaries values(2883, "2019-06-05"); +insert into diaries values(2884, "2019-06-06"); +insert into diaries values(2885, "2019-06-07"); +insert into diaries values(2886, "2019-06-08"); +insert into diaries values(2887, "2019-06-09"); +insert into diaries values(2888, "2019-06-10"); +insert into diaries values(2889, "2019-06-11"); +insert into diaries values(2890, "2019-06-12"); +insert into diaries values(2891, "2019-06-13"); +insert into diaries values(2892, "2019-06-14"); +insert into diaries values(2893, "2019-06-15"); +insert into diaries values(2894, "2019-06-16"); +insert into diaries values(2895, "2019-06-17"); +insert into diaries values(2896, "2019-06-18"); +insert into diaries values(2897, "2019-06-19"); +insert into diaries values(2898, "2019-06-20"); +insert into diaries values(2899, "2019-06-21"); +insert into diaries values(2900, "2019-06-22"); +insert into diaries values(2901, "2019-06-23"); +insert into diaries values(2902, "2019-06-24"); +insert into diaries values(2903, "2019-06-25"); +insert into diaries values(2904, "2019-06-26"); +insert into diaries values(2905, "2019-06-27"); +insert into diaries values(2906, "2019-06-28"); +insert into diaries values(2907, "2019-06-29"); +insert into diaries values(2908, "2019-06-30"); +insert into diaries values(2909, "2019-07-01"); +insert into diaries values(2910, "2019-07-02"); +insert into diaries values(2911, "2019-07-03"); +insert into diaries values(2912, "2019-07-04"); +insert into diaries values(2913, "2019-07-05"); +insert into diaries values(2914, "2019-07-06"); +insert into diaries values(2915, "2019-07-07"); +insert into diaries values(2916, "2019-07-08"); +insert into diaries values(2917, "2019-07-09"); +insert into diaries values(2918, "2019-07-10"); +insert into diaries values(2919, "2019-07-11"); +insert into diaries values(2920, "2019-07-12"); +insert into diaries values(2921, "2019-07-13"); +insert into diaries values(2922, "2019-07-14"); +insert into diaries values(2923, "2019-07-15"); +insert into diaries values(2924, "2019-07-16"); +insert into diaries values(2925, "2019-07-17"); +insert into diaries values(2926, "2019-07-18"); +insert into diaries values(2927, "2019-07-19"); +insert into diaries values(2928, "2019-07-20"); +insert into diaries values(2929, "2019-07-21"); +insert into diaries values(2930, "2019-07-22"); +insert into diaries values(2931, "2019-07-23"); +insert into diaries values(2932, "2019-07-24"); +insert into diaries values(2933, "2019-07-25"); +insert into diaries values(2934, "2019-07-26"); +insert into diaries values(2935, "2019-07-27"); +insert into diaries values(2936, "2019-07-28"); +insert into diaries values(2937, "2019-07-29"); +insert into diaries values(2938, "2019-07-30"); +insert into diaries values(2939, "2019-07-31"); +insert into diaries values(2940, "2019-08-01"); +insert into diaries values(2941, "2019-08-02"); +insert into diaries values(2942, "2019-08-03"); +insert into diaries values(2943, "2019-08-04"); +insert into diaries values(2944, "2019-08-05"); +insert into diaries values(2945, "2019-08-06"); +insert into diaries values(2946, "2019-08-07"); +insert into diaries values(2947, "2019-08-08"); +insert into diaries values(2948, "2019-08-09"); +insert into diaries values(2949, "2019-08-10"); +insert into diaries values(2950, "2019-08-11"); +insert into diaries values(2951, "2019-08-12"); +insert into diaries values(2952, "2019-08-13"); +insert into diaries values(2953, "2019-08-14"); +insert into diaries values(2954, "2019-08-15"); +insert into diaries values(2955, "2019-08-16"); +insert into diaries values(2956, "2019-08-17"); +insert into diaries values(2957, "2019-08-18"); +insert into diaries values(2958, "2019-08-19"); +insert into diaries values(2959, "2019-08-20"); +insert into diaries values(2960, "2019-08-21"); +insert into diaries values(2961, "2019-08-22"); +insert into diaries values(2962, "2019-08-23"); +insert into diaries values(2963, "2019-08-24"); +insert into diaries values(2964, "2019-08-25"); +insert into diaries values(2965, "2019-08-26"); +insert into diaries values(2966, "2019-08-27"); +insert into diaries values(2967, "2019-08-28"); +insert into diaries values(2968, "2019-08-29"); +insert into diaries values(2969, "2019-08-30"); +insert into diaries values(2970, "2019-08-31"); +insert into diaries values(2971, "2019-09-01"); +insert into diaries values(2972, "2019-09-02"); +insert into diaries values(2973, "2019-09-03"); +insert into diaries values(2974, "2019-09-04"); +insert into diaries values(2975, "2019-09-05"); +insert into diaries values(2976, "2019-09-06"); +insert into diaries values(2977, "2019-09-07"); +insert into diaries values(2978, "2019-09-08"); +insert into diaries values(2979, "2019-09-09"); +insert into diaries values(2980, "2019-09-10"); +insert into diaries values(2981, "2019-09-11"); +insert into diaries values(2982, "2019-09-12"); +insert into diaries values(2983, "2019-09-13"); +insert into diaries values(2984, "2019-09-14"); +insert into diaries values(2985, "2019-09-15"); +insert into diaries values(2986, "2019-09-16"); +insert into diaries values(2987, "2019-09-17"); +insert into diaries values(2988, "2019-09-18"); +insert into diaries values(2989, "2019-09-19"); +insert into diaries values(2990, "2019-09-20"); +insert into diaries values(2991, "2019-09-21"); +insert into diaries values(2992, "2019-09-22"); +insert into diaries values(2993, "2019-09-23"); +insert into diaries values(2994, "2019-09-24"); +insert into diaries values(2995, "2019-09-25"); +insert into diaries values(2996, "2019-09-26"); +insert into diaries values(2997, "2019-09-27"); +insert into diaries values(2998, "2019-09-28"); +insert into diaries values(2999, "2019-09-29"); +insert into diaries values(3000, "2019-09-30"); +insert into diaries values(3001, "2019-10-01"); +insert into diaries values(3002, "2019-10-02"); +insert into diaries values(3003, "2019-10-03"); +insert into diaries values(3004, "2019-10-04"); +insert into diaries values(3005, "2019-10-05"); +insert into diaries values(3006, "2019-10-06"); +insert into diaries values(3007, "2019-10-07"); +insert into diaries values(3008, "2019-10-08"); +insert into diaries values(3009, "2019-10-09"); +insert into diaries values(3010, "2019-10-10"); +insert into diaries values(3011, "2019-10-11"); +insert into diaries values(3012, "2019-10-12"); +insert into diaries values(3013, "2019-10-13"); +insert into diaries values(3014, "2019-10-14"); +insert into diaries values(3015, "2019-10-15"); +insert into diaries values(3016, "2019-10-16"); +insert into diaries values(3017, "2019-10-17"); +insert into diaries values(3018, "2019-10-18"); +insert into diaries values(3019, "2019-10-19"); +insert into diaries values(3020, "2019-10-20"); +insert into diaries values(3021, "2019-10-21"); +insert into diaries values(3022, "2019-10-22"); +insert into diaries values(3023, "2019-10-23"); +insert into diaries values(3024, "2019-10-24"); +insert into diaries values(3025, "2019-10-25"); +insert into diaries values(3026, "2019-10-26"); +insert into diaries values(3027, "2019-10-27"); +insert into diaries values(3028, "2019-10-28"); +insert into diaries values(3029, "2019-10-29"); +insert into diaries values(3030, "2019-10-30"); +insert into diaries values(3031, "2019-10-31"); +insert into diaries values(3032, "2019-11-01"); +insert into diaries values(3033, "2019-11-02"); +insert into diaries values(3034, "2019-11-03"); +insert into diaries values(3035, "2019-11-04"); +insert into diaries values(3036, "2019-11-05"); +insert into diaries values(3037, "2019-11-06"); +insert into diaries values(3038, "2019-11-07"); +insert into diaries values(3039, "2019-11-08"); +insert into diaries values(3040, "2019-11-09"); +insert into diaries values(3041, "2019-11-10"); +insert into diaries values(3042, "2019-11-11"); +insert into diaries values(3043, "2019-11-12"); +insert into diaries values(3044, "2019-11-13"); +insert into diaries values(3045, "2019-11-14"); +insert into diaries values(3046, "2019-11-15"); +insert into diaries values(3047, "2019-11-16"); +insert into diaries values(3048, "2019-11-17"); +insert into diaries values(3049, "2019-11-18"); +insert into diaries values(3050, "2019-11-19"); +insert into diaries values(3051, "2019-11-20"); +insert into diaries values(3052, "2019-11-21"); +insert into diaries values(3053, "2019-11-22"); +insert into diaries values(3054, "2019-11-23"); +insert into diaries values(3055, "2019-11-24"); +insert into diaries values(3056, "2019-11-25"); +insert into diaries values(3057, "2019-11-26"); +insert into diaries values(3058, "2019-11-27"); +insert into diaries values(3059, "2019-11-28"); +insert into diaries values(3060, "2019-11-29"); +insert into diaries values(3061, "2019-11-30"); +insert into diaries values(3062, "2019-12-01"); +insert into diaries values(3063, "2019-12-02"); +insert into diaries values(3064, "2019-12-03"); +insert into diaries values(3065, "2019-12-04"); +insert into diaries values(3066, "2019-12-05"); +insert into diaries values(3067, "2019-12-06"); +insert into diaries values(3068, "2019-12-07"); +insert into diaries values(3069, "2019-12-08"); +insert into diaries values(3070, "2019-12-09"); +insert into diaries values(3071, "2019-12-10"); +insert into diaries values(3072, "2019-12-11"); +insert into diaries values(3073, "2019-12-12"); +insert into diaries values(3074, "2019-12-13"); +insert into diaries values(3075, "2019-12-14"); +insert into diaries values(3076, "2019-12-15"); +insert into diaries values(3077, "2019-12-16"); +insert into diaries values(3078, "2019-12-17"); +insert into diaries values(3079, "2019-12-18"); +insert into diaries values(3080, "2019-12-19"); +insert into diaries values(3081, "2019-12-20"); +insert into diaries values(3082, "2019-12-21"); +insert into diaries values(3083, "2019-12-22"); +insert into diaries values(3084, "2019-12-23"); +insert into diaries values(3085, "2019-12-24"); +insert into diaries values(3086, "2019-12-25"); +insert into diaries values(3087, "2019-12-26"); +insert into diaries values(3088, "2019-12-27"); +insert into diaries values(3089, "2019-12-28"); +insert into diaries values(3090, "2019-12-29"); +insert into diaries values(3091, "2019-12-30"); +insert into diaries values(3092, "2019-12-31"); +insert into diaries values(3093, "2020-01-01"); +insert into diaries values(3094, "2020-01-02"); +insert into diaries values(3095, "2020-01-03"); +insert into diaries values(3096, "2020-01-04"); +insert into diaries values(3097, "2020-01-05"); +insert into diaries values(3098, "2020-01-06"); +insert into diaries values(3099, "2020-01-07"); +insert into diaries values(3100, "2020-01-08"); +insert into diaries values(3101, "2020-01-09"); +insert into diaries values(3102, "2020-01-10"); +insert into diaries values(3103, "2020-01-11"); +insert into diaries values(3104, "2020-01-12"); +insert into diaries values(3105, "2020-01-13"); +insert into diaries values(3106, "2020-01-14"); +insert into diaries values(3107, "2020-01-15"); +insert into diaries values(3108, "2020-01-16"); +insert into diaries values(3109, "2020-01-17"); +insert into diaries values(3110, "2020-01-18"); +insert into diaries values(3111, "2020-01-19"); +insert into diaries values(3112, "2020-01-20"); +insert into diaries values(3113, "2020-01-21"); +insert into diaries values(3114, "2020-01-22"); +insert into diaries values(3115, "2020-01-23"); +insert into diaries values(3116, "2020-01-24"); +insert into diaries values(3117, "2020-01-25"); +insert into diaries values(3118, "2020-01-26"); +insert into diaries values(3119, "2020-01-27"); +insert into diaries values(3120, "2020-01-28"); +insert into diaries values(3121, "2020-01-29"); +insert into diaries values(3122, "2020-01-30"); +insert into diaries values(3123, "2020-01-31"); +insert into diaries values(3124, "2020-02-01"); +insert into diaries values(3125, "2020-02-02"); +insert into diaries values(3126, "2020-02-03"); +insert into diaries values(3127, "2020-02-04"); +insert into diaries values(3128, "2020-02-05"); +insert into diaries values(3129, "2020-02-06"); +insert into diaries values(3130, "2020-02-07"); +insert into diaries values(3131, "2020-02-08"); +insert into diaries values(3132, "2020-02-09"); +insert into diaries values(3133, "2020-02-10"); +insert into diaries values(3134, "2020-02-11"); +insert into diaries values(3135, "2020-02-12"); +insert into diaries values(3136, "2020-02-13"); +insert into diaries values(3137, "2020-02-14"); +insert into diaries values(3138, "2020-02-15"); +insert into diaries values(3139, "2020-02-16"); +insert into diaries values(3140, "2020-02-17"); +insert into diaries values(3141, "2020-02-18"); +insert into diaries values(3142, "2020-02-19"); +insert into diaries values(3143, "2020-02-20"); +insert into diaries values(3144, "2020-02-21"); +insert into diaries values(3145, "2020-02-22"); +insert into diaries values(3146, "2020-02-23"); +insert into diaries values(3147, "2020-02-24"); +insert into diaries values(3148, "2020-02-25"); +insert into diaries values(3149, "2020-02-26"); +insert into diaries values(3150, "2020-02-27"); +insert into diaries values(3151, "2020-02-28"); +insert into diaries values(3152, "2020-02-29"); +insert into diaries values(3153, "2020-03-01"); +insert into diaries values(3154, "2020-03-02"); +insert into diaries values(3155, "2020-03-03"); +insert into diaries values(3156, "2020-03-04"); +insert into diaries values(3157, "2020-03-05"); +insert into diaries values(3158, "2020-03-06"); +insert into diaries values(3159, "2020-03-07"); +insert into diaries values(3160, "2020-03-08"); +insert into diaries values(3161, "2020-03-09"); +insert into diaries values(3162, "2020-03-10"); +insert into diaries values(3163, "2020-03-11"); +insert into diaries values(3164, "2020-03-12"); +insert into diaries values(3165, "2020-03-13"); +insert into diaries values(3166, "2020-03-14"); +insert into diaries values(3167, "2020-03-15"); +insert into diaries values(3168, "2020-03-16"); +insert into diaries values(3169, "2020-03-17"); +insert into diaries values(3170, "2020-03-18"); +insert into diaries values(3171, "2020-03-19"); +insert into diaries values(3172, "2020-03-20"); +insert into diaries values(3173, "2020-03-21"); +insert into diaries values(3174, "2020-03-22"); +insert into diaries values(3175, "2020-03-23"); +insert into diaries values(3176, "2020-03-24"); +insert into diaries values(3177, "2020-03-25"); +insert into diaries values(3178, "2020-03-26"); +insert into diaries values(3179, "2020-03-27"); +insert into diaries values(3180, "2020-03-28"); +insert into diaries values(3181, "2020-03-29"); +insert into diaries values(3182, "2020-03-30"); +insert into diaries values(3183, "2020-03-31"); +insert into diaries values(3184, "2020-04-01"); +insert into diaries values(3185, "2020-04-02"); +insert into diaries values(3186, "2020-04-03"); +insert into diaries values(3187, "2020-04-04"); +insert into diaries values(3188, "2020-04-05"); +insert into diaries values(3189, "2020-04-06"); +insert into diaries values(3190, "2020-04-07"); +insert into diaries values(3191, "2020-04-08"); +insert into diaries values(3192, "2020-04-09"); +insert into diaries values(3193, "2020-04-10"); +insert into diaries values(3194, "2020-04-11"); +insert into diaries values(3195, "2020-04-12"); +insert into diaries values(3196, "2020-04-13"); +insert into diaries values(3197, "2020-04-14"); +insert into diaries values(3198, "2020-04-15"); +insert into diaries values(3199, "2020-04-16"); +insert into diaries values(3200, "2020-04-17"); +insert into diaries values(3201, "2020-04-18"); +insert into diaries values(3202, "2020-04-19"); +insert into diaries values(3203, "2020-04-20"); +insert into diaries values(3204, "2020-04-21"); +insert into diaries values(3205, "2020-04-22"); +insert into diaries values(3206, "2020-04-23"); +insert into diaries values(3207, "2020-04-24"); +insert into diaries values(3208, "2020-04-25"); +insert into diaries values(3209, "2020-04-26"); +insert into diaries values(3210, "2020-04-27"); +insert into diaries values(3211, "2020-04-28"); +insert into diaries values(3212, "2020-04-29"); +insert into diaries values(3213, "2020-04-30"); +insert into diaries values(3214, "2020-05-01"); +insert into diaries values(3215, "2020-05-02"); +insert into diaries values(3216, "2020-05-03"); +insert into diaries values(3217, "2020-05-04"); +insert into diaries values(3218, "2020-05-05"); +insert into diaries values(3219, "2020-05-06"); +insert into diaries values(3220, "2020-05-07"); +insert into diaries values(3221, "2020-05-08"); +insert into diaries values(3222, "2020-05-09"); +insert into diaries values(3223, "2020-05-10"); +insert into diaries values(3224, "2020-05-11"); +insert into diaries values(3225, "2020-05-12"); +insert into diaries values(3226, "2020-05-13"); +insert into diaries values(3227, "2020-05-14"); +insert into diaries values(3228, "2020-05-15"); +insert into diaries values(3229, "2020-05-16"); +insert into diaries values(3230, "2020-05-17"); +insert into diaries values(3231, "2020-05-18"); +insert into diaries values(3232, "2020-05-19"); +insert into diaries values(3233, "2020-05-20"); +insert into diaries values(3234, "2020-05-21"); +insert into diaries values(3235, "2020-05-22"); +insert into diaries values(3236, "2020-05-23"); +insert into diaries values(3237, "2020-05-24"); +insert into diaries values(3238, "2020-05-25"); +insert into diaries values(3239, "2020-05-26"); +insert into diaries values(3240, "2020-05-27"); +insert into diaries values(3241, "2020-05-28"); +insert into diaries values(3242, "2020-05-29"); +insert into diaries values(3243, "2020-05-30"); +insert into diaries values(3244, "2020-05-31"); +insert into diaries values(3245, "2020-06-01"); +insert into diaries values(3246, "2020-06-02"); +insert into diaries values(3247, "2020-06-03"); +insert into diaries values(3248, "2020-06-04"); +insert into diaries values(3249, "2020-06-05"); +insert into diaries values(3250, "2020-06-06"); +insert into diaries values(3251, "2020-06-07"); +insert into diaries values(3252, "2020-06-08"); +insert into diaries values(3253, "2020-06-09"); +insert into diaries values(3254, "2020-06-10"); +insert into diaries values(3255, "2020-06-11"); +insert into diaries values(3256, "2020-06-12"); +insert into diaries values(3257, "2020-06-13"); +insert into diaries values(3258, "2020-06-14"); +insert into diaries values(3259, "2020-06-15"); +insert into diaries values(3260, "2020-06-16"); +insert into diaries values(3261, "2020-06-17"); +insert into diaries values(3262, "2020-06-18"); +insert into diaries values(3263, "2020-06-19"); +insert into diaries values(3264, "2020-06-20"); +insert into diaries values(3265, "2020-06-21"); +insert into diaries values(3266, "2020-06-22"); +insert into diaries values(3267, "2020-06-23"); +insert into diaries values(3268, "2020-06-24"); +insert into diaries values(3269, "2020-06-25"); +insert into diaries values(3270, "2020-06-26"); +insert into diaries values(3271, "2020-06-27"); +insert into diaries values(3272, "2020-06-28"); +insert into diaries values(3273, "2020-06-29"); +insert into diaries values(3274, "2020-06-30"); +insert into diaries values(3275, "2020-07-01"); +insert into diaries values(3276, "2020-07-02"); +insert into diaries values(3277, "2020-07-03"); +insert into diaries values(3278, "2020-07-04"); +insert into diaries values(3279, "2020-07-05"); +insert into diaries values(3280, "2020-07-06"); +insert into diaries values(3281, "2020-07-07"); +insert into diaries values(3282, "2020-07-08"); +insert into diaries values(3283, "2020-07-09"); +insert into diaries values(3284, "2020-07-10"); +insert into diaries values(3285, "2020-07-11"); +insert into diaries values(3286, "2020-07-12"); +insert into diaries values(3287, "2020-07-13"); +insert into diaries values(3288, "2020-07-14"); +insert into diaries values(3289, "2020-07-15"); +insert into diaries values(3290, "2020-07-16"); +insert into diaries values(3291, "2020-07-17"); +insert into diaries values(3292, "2020-07-18"); +insert into diaries values(3293, "2020-07-19"); +insert into diaries values(3294, "2020-07-20"); +insert into diaries values(3295, "2020-07-21"); +insert into diaries values(3296, "2020-07-22"); +insert into diaries values(3297, "2020-07-23"); +insert into diaries values(3298, "2020-07-24"); +insert into diaries values(3299, "2020-07-25"); +insert into diaries values(3300, "2020-07-26"); +insert into diaries values(3301, "2020-07-27"); +insert into diaries values(3302, "2020-07-28"); +insert into diaries values(3303, "2020-07-29"); +insert into diaries values(3304, "2020-07-30"); +insert into diaries values(3305, "2020-07-31"); +insert into diaries values(3306, "2020-08-01"); +insert into diaries values(3307, "2020-08-02"); +insert into diaries values(3308, "2020-08-03"); +insert into diaries values(3309, "2020-08-04"); +insert into diaries values(3310, "2020-08-05"); +insert into diaries values(3311, "2020-08-06"); +insert into diaries values(3312, "2020-08-07"); +insert into diaries values(3313, "2020-08-08"); +insert into diaries values(3314, "2020-08-09"); +insert into diaries values(3315, "2020-08-10"); +insert into diaries values(3316, "2020-08-11"); +insert into diaries values(3317, "2020-08-12"); +insert into diaries values(3318, "2020-08-13"); +insert into diaries values(3319, "2020-08-14"); +insert into diaries values(3320, "2020-08-15"); +insert into diaries values(3321, "2020-08-16"); +insert into diaries values(3322, "2020-08-17"); +insert into diaries values(3323, "2020-08-18"); +insert into diaries values(3324, "2020-08-19"); +insert into diaries values(3325, "2020-08-20"); +insert into diaries values(3326, "2020-08-21"); +insert into diaries values(3327, "2020-08-22"); +insert into diaries values(3328, "2020-08-23"); +insert into diaries values(3329, "2020-08-24"); +insert into diaries values(3330, "2020-08-25"); +insert into diaries values(3331, "2020-08-26"); +insert into diaries values(3332, "2020-08-27"); +insert into diaries values(3333, "2020-08-28"); +insert into diaries values(3334, "2020-08-29"); +insert into diaries values(3335, "2020-08-30"); +insert into diaries values(3336, "2020-08-31"); +insert into diaries values(3337, "2020-09-01"); +insert into diaries values(3338, "2020-09-02"); +insert into diaries values(3339, "2020-09-03"); +insert into diaries values(3340, "2020-09-04"); +insert into diaries values(3341, "2020-09-05"); +insert into diaries values(3342, "2020-09-06"); +insert into diaries values(3343, "2020-09-07"); +insert into diaries values(3344, "2020-09-08"); +insert into diaries values(3345, "2020-09-09"); +insert into diaries values(3346, "2020-09-10"); +insert into diaries values(3347, "2020-09-11"); +insert into diaries values(3348, "2020-09-12"); +insert into diaries values(3349, "2020-09-13"); +insert into diaries values(3350, "2020-09-14"); +insert into diaries values(3351, "2020-09-15"); +insert into diaries values(3352, "2020-09-16"); +insert into diaries values(3353, "2020-09-17"); +insert into diaries values(3354, "2020-09-18"); +insert into diaries values(3355, "2020-09-19"); +insert into diaries values(3356, "2020-09-20"); +insert into diaries values(3357, "2020-09-21"); +insert into diaries values(3358, "2020-09-22"); +insert into diaries values(3359, "2020-09-23"); +insert into diaries values(3360, "2020-09-24"); +insert into diaries values(3361, "2020-09-25"); +insert into diaries values(3362, "2020-09-26"); +insert into diaries values(3363, "2020-09-27"); +insert into diaries values(3364, "2020-09-28"); +insert into diaries values(3365, "2020-09-29"); +insert into diaries values(3366, "2020-09-30"); +insert into diaries values(3367, "2020-10-01"); +insert into diaries values(3368, "2020-10-02"); +insert into diaries values(3369, "2020-10-03"); +insert into diaries values(3370, "2020-10-04"); +insert into diaries values(3371, "2020-10-05"); +insert into diaries values(3372, "2020-10-06"); +insert into diaries values(3373, "2020-10-07"); +insert into diaries values(3374, "2020-10-08"); +insert into diaries values(3375, "2020-10-09"); +insert into diaries values(3376, "2020-10-10"); +insert into diaries values(3377, "2020-10-11"); +insert into diaries values(3378, "2020-10-12"); +insert into diaries values(3379, "2020-10-13"); +insert into diaries values(3380, "2020-10-14"); +insert into diaries values(3381, "2020-10-15"); +insert into diaries values(3382, "2020-10-16"); +insert into diaries values(3383, "2020-10-17"); +insert into diaries values(3384, "2020-10-18"); +insert into diaries values(3385, "2020-10-19"); +insert into diaries values(3386, "2020-10-20"); +insert into diaries values(3387, "2020-10-21"); +insert into diaries values(3388, "2020-10-22"); +insert into diaries values(3389, "2020-10-23"); +insert into diaries values(3390, "2020-10-24"); +insert into diaries values(3391, "2020-10-25"); +insert into diaries values(3392, "2020-10-26"); +insert into diaries values(3393, "2020-10-27"); +insert into diaries values(3394, "2020-10-28"); +insert into diaries values(3395, "2020-10-29"); +insert into diaries values(3396, "2020-10-30"); +insert into diaries values(3397, "2020-10-31"); +insert into diaries values(3398, "2020-11-01"); +insert into diaries values(3399, "2020-11-02"); +insert into diaries values(3400, "2020-11-03"); +insert into diaries values(3401, "2020-11-04"); +insert into diaries values(3402, "2020-11-05"); +insert into diaries values(3403, "2020-11-06"); +insert into diaries values(3404, "2020-11-07"); +insert into diaries values(3405, "2020-11-08"); +insert into diaries values(3406, "2020-11-09"); +insert into diaries values(3407, "2020-11-10"); +insert into diaries values(3408, "2020-11-11"); +insert into diaries values(3409, "2020-11-12"); +insert into diaries values(3410, "2020-11-13"); +insert into diaries values(3411, "2020-11-14"); +insert into diaries values(3412, "2020-11-15"); +insert into diaries values(3413, "2020-11-16"); +insert into diaries values(3414, "2020-11-17"); +insert into diaries values(3415, "2020-11-18"); +insert into diaries values(3416, "2020-11-19"); +insert into diaries values(3417, "2020-11-20"); +insert into diaries values(3418, "2020-11-21"); +insert into diaries values(3419, "2020-11-22"); +insert into diaries values(3420, "2020-11-23"); +insert into diaries values(3421, "2020-11-24"); +insert into diaries values(3422, "2020-11-25"); +insert into diaries values(3423, "2020-11-26"); +insert into diaries values(3424, "2020-11-27"); +insert into diaries values(3425, "2020-11-28"); +insert into diaries values(3426, "2020-11-29"); +insert into diaries values(3427, "2020-11-30"); +insert into diaries values(3428, "2020-12-01"); +insert into diaries values(3429, "2020-12-02"); +insert into diaries values(3430, "2020-12-03"); +insert into diaries values(3431, "2020-12-04"); +insert into diaries values(3432, "2020-12-05"); +insert into diaries values(3433, "2020-12-06"); +insert into diaries values(3434, "2020-12-07"); +insert into diaries values(3435, "2020-12-08"); +insert into diaries values(3436, "2020-12-09"); +insert into diaries values(3437, "2020-12-10"); +insert into diaries values(3438, "2020-12-11"); +insert into diaries values(3439, "2020-12-12"); +insert into diaries values(3440, "2020-12-13"); +insert into diaries values(3441, "2020-12-14"); +insert into diaries values(3442, "2020-12-15"); +insert into diaries values(3443, "2020-12-16"); +insert into diaries values(3444, "2020-12-17"); +insert into diaries values(3445, "2020-12-18"); +insert into diaries values(3446, "2020-12-19"); +insert into diaries values(3447, "2020-12-20"); +insert into diaries values(3448, "2020-12-21"); +insert into diaries values(3449, "2020-12-22"); +insert into diaries values(3450, "2020-12-23"); +insert into diaries values(3451, "2020-12-24"); +insert into diaries values(3452, "2020-12-25"); +insert into diaries values(3453, "2020-12-26"); +insert into diaries values(3454, "2020-12-27"); +insert into diaries values(3455, "2020-12-28"); +insert into diaries values(3456, "2020-12-29"); +insert into diaries values(3457, "2020-12-30"); +insert into diaries values(3458, "2020-12-31"); +insert into diaries values(3459, "2021-01-01"); +insert into diaries values(3460, "2021-01-02"); +insert into diaries values(3461, "2021-01-03"); +insert into diaries values(3462, "2021-01-04"); +insert into diaries values(3463, "2021-01-05"); +insert into diaries values(3464, "2021-01-06"); +insert into diaries values(3465, "2021-01-07"); +insert into diaries values(3466, "2021-01-08"); +insert into diaries values(3467, "2021-01-09"); +insert into diaries values(3468, "2021-01-10"); +insert into diaries values(3469, "2021-01-11"); +insert into diaries values(3470, "2021-01-12"); +insert into diaries values(3471, "2021-01-13"); +insert into diaries values(3472, "2021-01-14"); +insert into diaries values(3473, "2021-01-15"); +insert into diaries values(3474, "2021-01-16"); +insert into diaries values(3475, "2021-01-17"); +insert into diaries values(3476, "2021-01-18"); +insert into diaries values(3477, "2021-01-19"); +insert into diaries values(3478, "2021-01-20"); +insert into diaries values(3479, "2021-01-21"); +insert into diaries values(3480, "2021-01-22"); +insert into diaries values(3481, "2021-01-23"); +insert into diaries values(3482, "2021-01-24"); +insert into diaries values(3483, "2021-01-25"); +insert into diaries values(3484, "2021-01-26"); +insert into diaries values(3485, "2021-01-27"); +insert into diaries values(3486, "2021-01-28"); +insert into diaries values(3487, "2021-01-29"); +insert into diaries values(3488, "2021-01-30"); +insert into diaries values(3489, "2021-01-31"); +insert into diaries values(3490, "2021-02-01"); +insert into diaries values(3491, "2021-02-02"); +insert into diaries values(3492, "2021-02-03"); +insert into diaries values(3493, "2021-02-04"); +insert into diaries values(3494, "2021-02-05"); +insert into diaries values(3495, "2021-02-06"); +insert into diaries values(3496, "2021-02-07"); +insert into diaries values(3497, "2021-02-08"); +insert into diaries values(3498, "2021-02-09"); +insert into diaries values(3499, "2021-02-10"); +insert into diaries values(3500, "2021-02-11"); +insert into diaries values(3501, "2021-02-12"); +insert into diaries values(3502, "2021-02-13"); +insert into diaries values(3503, "2021-02-14"); +insert into diaries values(3504, "2021-02-15"); +insert into diaries values(3505, "2021-02-16"); +insert into diaries values(3506, "2021-02-17"); +insert into diaries values(3507, "2021-02-18"); +insert into diaries values(3508, "2021-02-19"); +insert into diaries values(3509, "2021-02-20"); +insert into diaries values(3510, "2021-02-21"); +insert into diaries values(3511, "2021-02-22"); +insert into diaries values(3512, "2021-02-23"); +insert into diaries values(3513, "2021-02-24"); +insert into diaries values(3514, "2021-02-25"); +insert into diaries values(3515, "2021-02-26"); +insert into diaries values(3516, "2021-02-27"); +insert into diaries values(3517, "2021-02-28"); +insert into diaries values(3518, "2021-03-01"); +insert into diaries values(3519, "2021-03-02"); +insert into diaries values(3520, "2021-03-03"); +insert into diaries values(3521, "2021-03-04"); +insert into diaries values(3522, "2021-03-05"); +insert into diaries values(3523, "2021-03-06"); +insert into diaries values(3524, "2021-03-07"); +insert into diaries values(3525, "2021-03-08"); +insert into diaries values(3526, "2021-03-09"); +insert into diaries values(3527, "2021-03-10"); +insert into diaries values(3528, "2021-03-11"); +insert into diaries values(3529, "2021-03-12"); +insert into diaries values(3530, "2021-03-13"); +insert into diaries values(3531, "2021-03-14"); +insert into diaries values(3532, "2021-03-15"); +insert into diaries values(3533, "2021-03-16"); +insert into diaries values(3534, "2021-03-17"); +insert into diaries values(3535, "2021-03-18"); +insert into diaries values(3536, "2021-03-19"); +insert into diaries values(3537, "2021-03-20"); +insert into diaries values(3538, "2021-03-21"); +insert into diaries values(3539, "2021-03-22"); +insert into diaries values(3540, "2021-03-23"); +insert into diaries values(3541, "2021-03-24"); +insert into diaries values(3542, "2021-03-25"); +insert into diaries values(3543, "2021-03-26"); +insert into diaries values(3544, "2021-03-27"); +insert into diaries values(3545, "2021-03-28"); +insert into diaries values(3546, "2021-03-29"); +insert into diaries values(3547, "2021-03-30"); +insert into diaries values(3548, "2021-03-31"); +insert into diaries values(3549, "2021-04-01"); +insert into diaries values(3550, "2021-04-02"); +insert into diaries values(3551, "2021-04-03"); +insert into diaries values(3552, "2021-04-04"); +insert into diaries values(3553, "2021-04-05"); +insert into diaries values(3554, "2021-04-06"); +insert into diaries values(3555, "2021-04-07"); +insert into diaries values(3556, "2021-04-08"); +insert into diaries values(3557, "2021-04-09"); +insert into diaries values(3558, "2021-04-10"); +insert into diaries values(3559, "2021-04-11"); +insert into diaries values(3560, "2021-04-12"); +insert into diaries values(3561, "2021-04-13"); +insert into diaries values(3562, "2021-04-14"); +insert into diaries values(3563, "2021-04-15"); +insert into diaries values(3564, "2021-04-16"); +insert into diaries values(3565, "2021-04-17"); +insert into diaries values(3566, "2021-04-18"); +insert into diaries values(3567, "2021-04-19"); +insert into diaries values(3568, "2021-04-20"); +insert into diaries values(3569, "2021-04-21"); +insert into diaries values(3570, "2021-04-22"); +insert into diaries values(3571, "2021-04-23"); +insert into diaries values(3572, "2021-04-24"); +insert into diaries values(3573, "2021-04-25"); +insert into diaries values(3574, "2021-04-26"); +insert into diaries values(3575, "2021-04-27"); +insert into diaries values(3576, "2021-04-28"); +insert into diaries values(3577, "2021-04-29"); +insert into diaries values(3578, "2021-04-30"); +insert into diaries values(3579, "2021-05-01"); +insert into diaries values(3580, "2021-05-02"); +insert into diaries values(3581, "2021-05-03"); +insert into diaries values(3582, "2021-05-04"); +insert into diaries values(3583, "2021-05-05"); +insert into diaries values(3584, "2021-05-06"); +insert into diaries values(3585, "2021-05-07"); +insert into diaries values(3586, "2021-05-08"); +insert into diaries values(3587, "2021-05-09"); +insert into diaries values(3588, "2021-05-10"); +insert into diaries values(3589, "2021-05-11"); +insert into diaries values(3590, "2021-05-12"); +insert into diaries values(3591, "2021-05-13"); +insert into diaries values(3592, "2021-05-14"); +insert into diaries values(3593, "2021-05-15"); +insert into diaries values(3594, "2021-05-16"); +insert into diaries values(3595, "2021-05-17"); +insert into diaries values(3596, "2021-05-18"); +insert into diaries values(3597, "2021-05-19"); +insert into diaries values(3598, "2021-05-20"); +insert into diaries values(3599, "2021-05-21"); +insert into diaries values(3600, "2021-05-22"); +insert into diaries values(3601, "2021-05-23"); +insert into diaries values(3602, "2021-05-24"); +insert into diaries values(3603, "2021-05-25"); +insert into diaries values(3604, "2021-05-26"); +insert into diaries values(3605, "2021-05-27"); +insert into diaries values(3606, "2021-05-28"); +insert into diaries values(3607, "2021-05-29"); +insert into diaries values(3608, "2021-05-30"); +insert into diaries values(3609, "2021-05-31"); +insert into diaries values(3610, "2021-06-01"); +insert into diaries values(3611, "2021-06-02"); +insert into diaries values(3612, "2021-06-03"); +insert into diaries values(3613, "2021-06-04"); +insert into diaries values(3614, "2021-06-05"); +insert into diaries values(3615, "2021-06-06"); +insert into diaries values(3616, "2021-06-07"); +insert into diaries values(3617, "2021-06-08"); +insert into diaries values(3618, "2021-06-09"); +insert into diaries values(3619, "2021-06-10"); +insert into diaries values(3620, "2021-06-11"); +insert into diaries values(3621, "2021-06-12"); +insert into diaries values(3622, "2021-06-13"); +insert into diaries values(3623, "2021-06-14"); +insert into diaries values(3624, "2021-06-15"); +insert into diaries values(3625, "2021-06-16"); +insert into diaries values(3626, "2021-06-17"); +insert into diaries values(3627, "2021-06-18"); +insert into diaries values(3628, "2021-06-19"); +insert into diaries values(3629, "2021-06-20"); +insert into diaries values(3630, "2021-06-21"); +insert into diaries values(3631, "2021-06-22"); +insert into diaries values(3632, "2021-06-23"); +insert into diaries values(3633, "2021-06-24"); +insert into diaries values(3634, "2021-06-25"); +insert into diaries values(3635, "2021-06-26"); +insert into diaries values(3636, "2021-06-27"); +insert into diaries values(3637, "2021-06-28"); +insert into diaries values(3638, "2021-06-29"); +insert into diaries values(3639, "2021-06-30"); +insert into diaries values(3640, "2021-07-01"); +insert into diaries values(3641, "2021-07-02"); +insert into diaries values(3642, "2021-07-03"); +insert into diaries values(3643, "2021-07-04"); +insert into diaries values(3644, "2021-07-05"); +insert into diaries values(3645, "2021-07-06"); +insert into diaries values(3646, "2021-07-07"); +insert into diaries values(3647, "2021-07-08"); +insert into diaries values(3648, "2021-07-09"); +insert into diaries values(3649, "2021-07-10"); +insert into diaries values(3650, "2021-07-11"); +insert into diaries values(3651, "2021-07-12"); +insert into diaries values(3652, "2021-07-13"); +insert into diaries values(3653, "2021-07-14"); +insert into diaries values(3654, "2021-07-15"); +insert into diaries values(3655, "2021-07-16"); +insert into diaries values(3656, "2021-07-17"); +insert into diaries values(3657, "2021-07-18"); +insert into diaries values(3658, "2021-07-19"); +insert into diaries values(3659, "2021-07-20"); +insert into diaries values(3660, "2021-07-21"); +insert into diaries values(3661, "2021-07-22"); +insert into diaries values(3662, "2021-07-23"); +insert into diaries values(3663, "2021-07-24"); +insert into diaries values(3664, "2021-07-25"); +insert into diaries values(3665, "2021-07-26"); +insert into diaries values(3666, "2021-07-27"); +insert into diaries values(3667, "2021-07-28"); +insert into diaries values(3668, "2021-07-29"); +insert into diaries values(3669, "2021-07-30"); +insert into diaries values(3670, "2021-07-31"); +insert into diaries values(3671, "2021-08-01"); +insert into diaries values(3672, "2021-08-02"); +insert into diaries values(3673, "2021-08-03"); +insert into diaries values(3674, "2021-08-04"); +insert into diaries values(3675, "2021-08-05"); +insert into diaries values(3676, "2021-08-06"); +insert into diaries values(3677, "2021-08-07"); +insert into diaries values(3678, "2021-08-08"); +insert into diaries values(3679, "2021-08-09"); +insert into diaries values(3680, "2021-08-10"); +insert into diaries values(3681, "2021-08-11"); +insert into diaries values(3682, "2021-08-12"); +insert into diaries values(3683, "2021-08-13"); +insert into diaries values(3684, "2021-08-14"); +insert into diaries values(3685, "2021-08-15"); +insert into diaries values(3686, "2021-08-16"); +insert into diaries values(3687, "2021-08-17"); +insert into diaries values(3688, "2021-08-18"); +insert into diaries values(3689, "2021-08-19"); +insert into diaries values(3690, "2021-08-20"); +insert into diaries values(3691, "2021-08-21"); +insert into diaries values(3692, "2021-08-22"); +insert into diaries values(3693, "2021-08-23"); +insert into diaries values(3694, "2021-08-24"); +insert into diaries values(3695, "2021-08-25"); +insert into diaries values(3696, "2021-08-26"); +insert into diaries values(3697, "2021-08-27"); +insert into diaries values(3698, "2021-08-28"); +insert into diaries values(3699, "2021-08-29"); +insert into diaries values(3700, "2021-08-30"); +insert into diaries values(3701, "2021-08-31"); +insert into diaries values(3702, "2021-09-01"); +insert into diaries values(3703, "2021-09-02"); +insert into diaries values(3704, "2021-09-03"); +insert into diaries values(3705, "2021-09-04"); +insert into diaries values(3706, "2021-09-05"); +insert into diaries values(3707, "2021-09-06"); +insert into diaries values(3708, "2021-09-07"); +insert into diaries values(3709, "2021-09-08"); +insert into diaries values(3710, "2021-09-09"); +insert into diaries values(3711, "2021-09-10"); +insert into diaries values(3712, "2021-09-11"); +insert into diaries values(3713, "2021-09-12"); +insert into diaries values(3714, "2021-09-13"); +insert into diaries values(3715, "2021-09-14"); +insert into diaries values(3716, "2021-09-15"); +insert into diaries values(3717, "2021-09-16"); +insert into diaries values(3718, "2021-09-17"); +insert into diaries values(3719, "2021-09-18"); +insert into diaries values(3720, "2021-09-19"); +insert into diaries values(3721, "2021-09-20"); +insert into diaries values(3722, "2021-09-21"); +insert into diaries values(3723, "2021-09-22"); +insert into diaries values(3724, "2021-09-23"); +insert into diaries values(3725, "2021-09-24"); +insert into diaries values(3726, "2021-09-25"); +insert into diaries values(3727, "2021-09-26"); +insert into diaries values(3728, "2021-09-27"); +insert into diaries values(3729, "2021-09-28"); +insert into diaries values(3730, "2021-09-29"); +insert into diaries values(3731, "2021-09-30"); +insert into diaries values(3732, "2021-10-01"); +insert into diaries values(3733, "2021-10-02"); +insert into diaries values(3734, "2021-10-03"); +insert into diaries values(3735, "2021-10-04"); +insert into diaries values(3736, "2021-10-05"); +insert into diaries values(3737, "2021-10-06"); +insert into diaries values(3738, "2021-10-07"); +insert into diaries values(3739, "2021-10-08"); +insert into diaries values(3740, "2021-10-09"); +insert into diaries values(3741, "2021-10-10"); +insert into diaries values(3742, "2021-10-11"); +insert into diaries values(3743, "2021-10-12"); +insert into diaries values(3744, "2021-10-13"); +insert into diaries values(3745, "2021-10-14"); +insert into diaries values(3746, "2021-10-15"); +insert into diaries values(3747, "2021-10-16"); +insert into diaries values(3748, "2021-10-17"); +insert into diaries values(3749, "2021-10-18"); +insert into diaries values(3750, "2021-10-19"); +insert into diaries values(3751, "2021-10-20"); +insert into diaries values(3752, "2021-10-21"); +insert into diaries values(3753, "2021-10-22"); +insert into diaries values(3754, "2021-10-23"); +insert into diaries values(3755, "2021-10-24"); +insert into diaries values(3756, "2021-10-25"); +insert into diaries values(3757, "2021-10-26"); +insert into diaries values(3758, "2021-10-27"); +insert into diaries values(3759, "2021-10-28"); +insert into diaries values(3760, "2021-10-29"); +insert into diaries values(3761, "2021-10-30"); +insert into diaries values(3762, "2021-10-31"); +insert into diaries values(3763, "2021-11-01"); +insert into diaries values(3764, "2021-11-02"); +insert into diaries values(3765, "2021-11-03"); +insert into diaries values(3766, "2021-11-04"); +insert into diaries values(3767, "2021-11-05"); +insert into diaries values(3768, "2021-11-06"); +insert into diaries values(3769, "2021-11-07"); +insert into diaries values(3770, "2021-11-08"); +insert into diaries values(3771, "2021-11-09"); +insert into diaries values(3772, "2021-11-10"); +insert into diaries values(3773, "2021-11-11"); +insert into diaries values(3774, "2021-11-12"); +insert into diaries values(3775, "2021-11-13"); +insert into diaries values(3776, "2021-11-14"); +insert into diaries values(3777, "2021-11-15"); +insert into diaries values(3778, "2021-11-16"); +insert into diaries values(3779, "2021-11-17"); +insert into diaries values(3780, "2021-11-18"); +insert into diaries values(3781, "2021-11-19"); +insert into diaries values(3782, "2021-11-20"); +insert into diaries values(3783, "2021-11-21"); +insert into diaries values(3784, "2021-11-22"); +insert into diaries values(3785, "2021-11-23"); +insert into diaries values(3786, "2021-11-24"); +insert into diaries values(3787, "2021-11-25"); +insert into diaries values(3788, "2021-11-26"); +insert into diaries values(3789, "2021-11-27"); +insert into diaries values(3790, "2021-11-28"); +insert into diaries values(3791, "2021-11-29"); +insert into diaries values(3792, "2021-11-30"); +insert into diaries values(3793, "2021-12-01"); +insert into diaries values(3794, "2021-12-02"); +insert into diaries values(3795, "2021-12-03"); +insert into diaries values(3796, "2021-12-04"); +insert into diaries values(3797, "2021-12-05"); +insert into diaries values(3798, "2021-12-06"); +insert into diaries values(3799, "2021-12-07"); +insert into diaries values(3800, "2021-12-08"); +insert into diaries values(3801, "2021-12-09"); +insert into diaries values(3802, "2021-12-10"); +insert into diaries values(3803, "2021-12-11"); +insert into diaries values(3804, "2021-12-12"); +insert into diaries values(3805, "2021-12-13"); +insert into diaries values(3806, "2021-12-14"); +insert into diaries values(3807, "2021-12-15"); +insert into diaries values(3808, "2021-12-16"); +insert into diaries values(3809, "2021-12-17"); +insert into diaries values(3810, "2021-12-18"); +insert into diaries values(3811, "2021-12-19"); +insert into diaries values(3812, "2021-12-20"); +insert into diaries values(3813, "2021-12-21"); +insert into diaries values(3814, "2021-12-22"); +insert into diaries values(3815, "2021-12-23"); +insert into diaries values(3816, "2021-12-24"); +insert into diaries values(3817, "2021-12-25"); +insert into diaries values(3818, "2021-12-26"); +insert into diaries values(3819, "2021-12-27"); +insert into diaries values(3820, "2021-12-28"); +insert into diaries values(3821, "2021-12-29"); +insert into diaries values(3822, "2021-12-30"); +insert into diaries values(3823, "2021-12-31"); +insert into diaries values(3824, "2022-01-01"); +insert into diaries values(3825, "2022-01-02"); +insert into diaries values(3826, "2022-01-03"); +insert into diaries values(3827, "2022-01-04"); +insert into diaries values(3828, "2022-01-05"); +insert into diaries values(3829, "2022-01-06"); +insert into diaries values(3830, "2022-01-07"); +insert into diaries values(3831, "2022-01-08"); +insert into diaries values(3832, "2022-01-09"); +insert into diaries values(3833, "2022-01-10"); +insert into diaries values(3834, "2022-01-11"); +insert into diaries values(3835, "2022-01-12"); +insert into diaries values(3836, "2022-01-13"); +insert into diaries values(3837, "2022-01-14"); +insert into diaries values(3838, "2022-01-15"); +insert into diaries values(3839, "2022-01-16"); +insert into diaries values(3840, "2022-01-17"); +insert into diaries values(3841, "2022-01-18"); +insert into diaries values(3842, "2022-01-19"); +insert into diaries values(3843, "2022-01-20"); +insert into diaries values(3844, "2022-01-21"); +insert into diaries values(3845, "2022-01-22"); +insert into diaries values(3846, "2022-01-23"); +insert into diaries values(3847, "2022-01-24"); +insert into diaries values(3848, "2022-01-25"); +insert into diaries values(3849, "2022-01-26"); +insert into diaries values(3850, "2022-01-27"); +insert into diaries values(3851, "2022-01-28"); +insert into diaries values(3852, "2022-01-29"); +insert into diaries values(3853, "2022-01-30"); +insert into diaries values(3854, "2022-01-31"); +insert into diaries values(3855, "2022-02-01"); +insert into diaries values(3856, "2022-02-02"); +insert into diaries values(3857, "2022-02-03"); +insert into diaries values(3858, "2022-02-04"); +insert into diaries values(3859, "2022-02-05"); +insert into diaries values(3860, "2022-02-06"); +insert into diaries values(3861, "2022-02-07"); +insert into diaries values(3862, "2022-02-08"); +insert into diaries values(3863, "2022-02-09"); +insert into diaries values(3864, "2022-02-10"); +insert into diaries values(3865, "2022-02-11"); +insert into diaries values(3866, "2022-02-12"); +insert into diaries values(3867, "2022-02-13"); +insert into diaries values(3868, "2022-02-14"); +insert into diaries values(3869, "2022-02-15"); +insert into diaries values(3870, "2022-02-16"); +insert into diaries values(3871, "2022-02-17"); +insert into diaries values(3872, "2022-02-18"); +insert into diaries values(3873, "2022-02-19"); +insert into diaries values(3874, "2022-02-20"); +insert into diaries values(3875, "2022-02-21"); +insert into diaries values(3876, "2022-02-22"); +insert into diaries values(3877, "2022-02-23"); +insert into diaries values(3878, "2022-02-24"); +insert into diaries values(3879, "2022-02-25"); +insert into diaries values(3880, "2022-02-26"); +insert into diaries values(3881, "2022-02-27"); +insert into diaries values(3882, "2022-02-28"); +insert into diaries values(3883, "2022-03-01"); +insert into diaries values(3884, "2022-03-02"); +insert into diaries values(3885, "2022-03-03"); +insert into diaries values(3886, "2022-03-04"); +insert into diaries values(3887, "2022-03-05"); +insert into diaries values(3888, "2022-03-06"); +insert into diaries values(3889, "2022-03-07"); +insert into diaries values(3890, "2022-03-08"); +insert into diaries values(3891, "2022-03-09"); +insert into diaries values(3892, "2022-03-10"); +insert into diaries values(3893, "2022-03-11"); +insert into diaries values(3894, "2022-03-12"); +insert into diaries values(3895, "2022-03-13"); +insert into diaries values(3896, "2022-03-14"); +insert into diaries values(3897, "2022-03-15"); +insert into diaries values(3898, "2022-03-16"); +insert into diaries values(3899, "2022-03-17"); +insert into diaries values(3900, "2022-03-18"); +insert into diaries values(3901, "2022-03-19"); +insert into diaries values(3902, "2022-03-20"); +insert into diaries values(3903, "2022-03-21"); +insert into diaries values(3904, "2022-03-22"); +insert into diaries values(3905, "2022-03-23"); +insert into diaries values(3906, "2022-03-24"); +insert into diaries values(3907, "2022-03-25"); +insert into diaries values(3908, "2022-03-26"); +insert into diaries values(3909, "2022-03-27"); +insert into diaries values(3910, "2022-03-28"); +insert into diaries values(3911, "2022-03-29"); +insert into diaries values(3912, "2022-03-30"); +insert into diaries values(3913, "2022-03-31"); +insert into diaries values(3914, "2022-04-01"); +insert into diaries values(3915, "2022-04-02"); +insert into diaries values(3916, "2022-04-03"); +insert into diaries values(3917, "2022-04-04"); +insert into diaries values(3918, "2022-04-05"); +insert into diaries values(3919, "2022-04-06"); +insert into diaries values(3920, "2022-04-07"); +insert into diaries values(3921, "2022-04-08"); +insert into diaries values(3922, "2022-04-09"); +insert into diaries values(3923, "2022-04-10"); +insert into diaries values(3924, "2022-04-11"); +insert into diaries values(3925, "2022-04-12"); +insert into diaries values(3926, "2022-04-13"); +insert into diaries values(3927, "2022-04-14"); +insert into diaries values(3928, "2022-04-15"); +insert into diaries values(3929, "2022-04-16"); +insert into diaries values(3930, "2022-04-17"); +insert into diaries values(3931, "2022-04-18"); +insert into diaries values(3932, "2022-04-19"); +insert into diaries values(3933, "2022-04-20"); +insert into diaries values(3934, "2022-04-21"); +insert into diaries values(3935, "2022-04-22"); +insert into diaries values(3936, "2022-04-23"); +insert into diaries values(3937, "2022-04-24"); +insert into diaries values(3938, "2022-04-25"); +insert into diaries values(3939, "2022-04-26"); +insert into diaries values(3940, "2022-04-27"); +insert into diaries values(3941, "2022-04-28"); +insert into diaries values(3942, "2022-04-29"); +insert into diaries values(3943, "2022-04-30"); +insert into diaries values(3944, "2022-05-01"); +insert into diaries values(3945, "2022-05-02"); +insert into diaries values(3946, "2022-05-03"); +insert into diaries values(3947, "2022-05-04"); +insert into diaries values(3948, "2022-05-05"); +insert into diaries values(3949, "2022-05-06"); +insert into diaries values(3950, "2022-05-07"); +insert into diaries values(3951, "2022-05-08"); +insert into diaries values(3952, "2022-05-09"); +insert into diaries values(3953, "2022-05-10"); +insert into diaries values(3954, "2022-05-11"); +insert into diaries values(3955, "2022-05-12"); +insert into diaries values(3956, "2022-05-13"); +insert into diaries values(3957, "2022-05-14"); +insert into diaries values(3958, "2022-05-15"); +insert into diaries values(3959, "2022-05-16"); +insert into diaries values(3960, "2022-05-17"); +insert into diaries values(3961, "2022-05-18"); +insert into diaries values(3962, "2022-05-19"); +insert into diaries values(3963, "2022-05-20"); +insert into diaries values(3964, "2022-05-21"); +insert into diaries values(3965, "2022-05-22"); +insert into diaries values(3966, "2022-05-23"); +insert into diaries values(3967, "2022-05-24"); +insert into diaries values(3968, "2022-05-25"); +insert into diaries values(3969, "2022-05-26"); +insert into diaries values(3970, "2022-05-27"); +insert into diaries values(3971, "2022-05-28"); +insert into diaries values(3972, "2022-05-29"); +insert into diaries values(3973, "2022-05-30"); +insert into diaries values(3974, "2022-05-31"); +insert into diaries values(3975, "2022-06-01"); +insert into diaries values(3976, "2022-06-02"); +insert into diaries values(3977, "2022-06-03"); +insert into diaries values(3978, "2022-06-04"); +insert into diaries values(3979, "2022-06-05"); +insert into diaries values(3980, "2022-06-06"); +insert into diaries values(3981, "2022-06-07"); +insert into diaries values(3982, "2022-06-08"); +insert into diaries values(3983, "2022-06-09"); +insert into diaries values(3984, "2022-06-10"); +insert into diaries values(3985, "2022-06-11"); +insert into diaries values(3986, "2022-06-12"); +insert into diaries values(3987, "2022-06-13"); +insert into diaries values(3988, "2022-06-14"); +insert into diaries values(3989, "2022-06-15"); +insert into diaries values(3990, "2022-06-16"); +insert into diaries values(3991, "2022-06-17"); +insert into diaries values(3992, "2022-06-18"); +insert into diaries values(3993, "2022-06-19"); +insert into diaries values(3994, "2022-06-20"); +insert into diaries values(3995, "2022-06-21"); +insert into diaries values(3996, "2022-06-22"); +insert into diaries values(3997, "2022-06-23"); +insert into diaries values(3998, "2022-06-24"); +insert into diaries values(3999, "2022-06-25"); +insert into diaries values(4000, "2022-06-26"); +insert into diaries values(4001, "2022-06-27"); +insert into diaries values(4002, "2022-06-28"); +insert into diaries values(4003, "2022-06-29"); +insert into diaries values(4004, "2022-06-30"); +insert into diaries values(4005, "2022-07-01"); +insert into diaries values(4006, "2022-07-02"); +insert into diaries values(4007, "2022-07-03"); +insert into diaries values(4008, "2022-07-04"); +insert into diaries values(4009, "2022-07-05"); +insert into diaries values(4010, "2022-07-06"); +insert into diaries values(4011, "2022-07-07"); +insert into diaries values(4012, "2022-07-08"); +insert into diaries values(4013, "2022-07-09"); +insert into diaries values(4014, "2022-07-10"); +insert into diaries values(4015, "2022-07-11"); +insert into diaries values(4016, "2022-07-12"); +insert into diaries values(4017, "2022-07-13"); +insert into diaries values(4018, "2022-07-14"); +insert into diaries values(4019, "2022-07-15"); +insert into diaries values(4020, "2022-07-16"); +insert into diaries values(4021, "2022-07-17"); +insert into diaries values(4022, "2022-07-18"); +insert into diaries values(4023, "2022-07-19"); +insert into diaries values(4024, "2022-07-20"); +insert into diaries values(4025, "2022-07-21"); +insert into diaries values(4026, "2022-07-22"); +insert into diaries values(4027, "2022-07-23"); +insert into diaries values(4028, "2022-07-24"); +insert into diaries values(4029, "2022-07-25"); +insert into diaries values(4030, "2022-07-26"); +insert into diaries values(4031, "2022-07-27"); +insert into diaries values(4032, "2022-07-28"); +insert into diaries values(4033, "2022-07-29"); +insert into diaries values(4034, "2022-07-30"); +insert into diaries values(4035, "2022-07-31"); +insert into diaries values(4036, "2022-08-01"); +insert into diaries values(4037, "2022-08-02"); +insert into diaries values(4038, "2022-08-03"); +insert into diaries values(4039, "2022-08-04"); +insert into diaries values(4040, "2022-08-05"); +insert into diaries values(4041, "2022-08-06"); +insert into diaries values(4042, "2022-08-07"); +insert into diaries values(4043, "2022-08-08"); +insert into diaries values(4044, "2022-08-09"); +insert into diaries values(4045, "2022-08-10"); +insert into diaries values(4046, "2022-08-11"); +insert into diaries values(4047, "2022-08-12"); +insert into diaries values(4048, "2022-08-13"); +insert into diaries values(4049, "2022-08-14"); +insert into diaries values(4050, "2022-08-15"); +insert into diaries values(4051, "2022-08-16"); +insert into diaries values(4052, "2022-08-17"); +insert into diaries values(4053, "2022-08-18"); +insert into diaries values(4054, "2022-08-19"); +insert into diaries values(4055, "2022-08-20"); +insert into diaries values(4056, "2022-08-21"); +insert into diaries values(4057, "2022-08-22"); +insert into diaries values(4058, "2022-08-23"); +insert into diaries values(4059, "2022-08-24"); +insert into diaries values(4060, "2022-08-25"); +insert into diaries values(4061, "2022-08-26"); +insert into diaries values(4062, "2022-08-27"); +insert into diaries values(4063, "2022-08-28"); +insert into diaries values(4064, "2022-08-29"); +insert into diaries values(4065, "2022-08-30"); +insert into diaries values(4066, "2022-08-31"); +insert into diaries values(4067, "2022-09-01"); +insert into diaries values(4068, "2022-09-02"); +insert into diaries values(4069, "2022-09-03"); +insert into diaries values(4070, "2022-09-04"); +insert into diaries values(4071, "2022-09-05"); +insert into diaries values(4072, "2022-09-06"); +insert into diaries values(4073, "2022-09-07"); +insert into diaries values(4074, "2022-09-08"); +insert into diaries values(4075, "2022-09-09"); +insert into diaries values(4076, "2022-09-10"); +insert into diaries values(4077, "2022-09-11"); +insert into diaries values(4078, "2022-09-12"); +insert into diaries values(4079, "2022-09-13"); +insert into diaries values(4080, "2022-09-14"); +insert into diaries values(4081, "2022-09-15"); +insert into diaries values(4082, "2022-09-16"); +insert into diaries values(4083, "2022-09-17"); +insert into diaries values(4084, "2022-09-18"); +insert into diaries values(4085, "2022-09-19"); +insert into diaries values(4086, "2022-09-20"); +insert into diaries values(4087, "2022-09-21"); +insert into diaries values(4088, "2022-09-22"); +insert into diaries values(4089, "2022-09-23"); +insert into diaries values(4090, "2022-09-24"); +insert into diaries values(4091, "2022-09-25"); +insert into diaries values(4092, "2022-09-26"); +insert into diaries values(4093, "2022-09-27"); +insert into diaries values(4094, "2022-09-28"); +insert into diaries values(4095, "2022-09-29"); +commit; +set autocommit=1; + +select * from diaries where match(title) against("2022-09-0"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test new file mode 100644 index 00000000000..61aa07d8da2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_delete.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +delete from diaries where id = 2; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test new file mode 100644 index 00000000000..8ddfa82e84a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_insert.test @@ -0,0 +1,43 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test new file mode 100644 index 00000000000..1e2413689d6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_recreate.test @@ -0,0 +1,51 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; + +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +select * from diaries where match(title, content) against("富士山"); + +drop index title on diaries; +--error ER_FT_MATCHING_KEY_NOT_FOUND +select * from diaries where match(title, content) against("富士山"); + +create fulltext index new_title_content_index on diaries (title, content); +select * from diaries where match(title, content) against("富士山"); + +select * from diaries; + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test new file mode 100644 index 00000000000..44690e699a0 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_column_index_update.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + title varchar(255), + content text, + fulltext index (title, content), + fulltext index (title), + fulltext index (content) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; +insert into diaries values(1, "Hello", "ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "富士山", "今日もãれã„。"); +update diaries set title = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒž" where id = 3; +update diaries set content = "ãƒãƒ§ãƒ¢ãƒ©ãƒ³ãƒžã¨å¯Œå£«å±±" where id = 1; +select * from diaries where match(title, content) against("富士山"); +select * from diaries where match(title) against("富士山"); +select * from diaries where match(content) against("富士山"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test new file mode 100644 index 00000000000..97a8a1f07a5 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_multiple_index.test @@ -0,0 +1,48 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + title text, + body text, + fulltext index title_index (title), + fulltext index body_index (body) +) comment = 'engine "innodb"' default charset utf8; +show create table diaries; + +insert into diaries (title, body) values ("survey", "will start groonga!"); +insert into diaries (title, body) values ("groonga (1)", "starting groonga..."); +insert into diaries (title, body) values ("groonga (2)", "started groonga."); + +select * from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +select *, match(title) against("survey"), match(body) against("groonga") + from diaries + where match(title) against("survey") and + match(body) against("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test new file mode 100644 index 00000000000..eda8a5f15ef --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_myisam.test @@ -0,0 +1,102 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index ft (c2)) COMMENT = 'engine "myisam"'; +show create table t1; +insert into t1 values (1, "hoge hoge"); +insert into t1 values (2, "fuga fuga"); +insert into t1 values (3, "moge moge"); +select * from t1; +flush tables; +select * from t1; +drop table t1; + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"sa si su se so"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ee oo"); +select * from t1; +select * from t1 where match(c3) against("su"); +select * from t1 where match(c3) against("ii"); +select * from t1 where match(c3) against("+su" in boolean mode); +select * from t1 where match(c3) against("+ii" in boolean mode); +drop table t1; + +set names utf8; +create table t1 (c1 int primary key, c2 varchar(255), c3 text, fulltext index(c2), fulltext index(c3)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values(1, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦","ã‚ã‚ã‚ã‚ã‚ã‚ã‚"); +insert into t1 values(2, "ã„ã„ã„ã„ã„","明日ã®å¯Œå£«å±±ã®å¤©æ°—ã¯åˆ†ã‹ã‚Šã¾ã›ã‚“"); +insert into t1 values(3, "dummy", "dummy"); +select * from t1; +select * from t1 where match(c2) against("富士山"); +select * from t1 where match(c3) against("富士山"); +drop table t1; + +create table t1 (c1 int primary key, c2 varchar(100), fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +create table t2 (c1 int primary key, c2 text, fulltext index(c2)) default charset utf8 COMMENT = 'engine "myisam"'; +insert into t1 values (1, "aa ii uu ee oo"); +insert into t1 values (2, "ka ki ku ke ko"); +insert into t1 values (3, "aa ii ii ii oo"); +insert into t1 values (4, "sa si su se so"); +insert into t1 values (5, "ta ti ii ii to"); +insert into t2 (c1,c2) select c1,c2 from t1; +select * from t1; +select * from t2; +select * from t1 where c1=3; +select * from t2 where c1=3; +select * from t1 where c1>3 order by c1 desc; +select * from t2 where c1>3 order by c1 asc; +select * from t1 where c2>"s" order by c2 desc; +select * from t2 where c2>"s" order by c1 asc; +select *,match(c2) against("ii") from t1 where match(c2) against("ii") order by match(c2) against("ii") desc; +select *,match(c2) against("ii") from t2 where match(c2) against("ii") order by match(c2) against("ii") asc; +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +select c1,c2,match(c2) against("ii") from t1 where match(c2) against("ii"); +drop table t1,t2; + +# for "not match against" +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "myisam"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select *,match(c3) against("uu") from t1 where match(c3) against("uu"); +select * from t1 where not match(c3) against("uu"); +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +select * from t1 where not match(c3) against("dummy"); +select * from t1 where c1 = 4 and not match(c3) against("uu"); +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +select * from t1 where c1 > 4 and not match(c3) against("uu"); +select * from t1 where c2 = 10 and not match(c3) against("uu"); +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +select * from t1 where c2 < 15 and not match(c3) against("uu"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test new file mode 100644 index 00000000000..6ce01598136 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_not_match_against.test @@ -0,0 +1,47 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int, c3 text, fulltext index ft(c3)) COMMENT = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,10,"ka ki ku ke ko"); +insert into t1 values(3,10,"aa ii uu ee oo"); +insert into t1 values(4,10,"ka ki ku ke ko"); +insert into t1 values(5,20,"aa ii uu ee oo"); +insert into t1 values(6,20,"ka ki ku ke ko"); +insert into t1 values(7,20,"aa ii uu ee oo"); +insert into t1 values(8,20,"ka ki ku ke ko"); +select * from t1; +select *,match(c3) against("uu") from t1 where match(c3) against("uu"); +select * from t1 where not match(c3) against("uu"); +select *,match(c3) against("dummy") from t1 where match(c3) against("dummy"); +select * from t1 where not match(c3) against("dummy"); +select * from t1 where c1 = 4 and not match(c3) against("uu"); +select * from t1 where c1 <= 4 and not match(c3) against("uu"); +select * from t1 where c1 > 4 and not match(c3) against("uu"); +select * from t1 where c2 = 10 and not match(c3) against("uu"); +select * from t1 where c2 >= 15 and not match(c3) against("uu"); +select * from t1 where c2 < 15 and not match(c3) against("uu"); +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..5361b151661 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_TODO_SPLIT_ME.test @@ -0,0 +1,51 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE ft( + a INT, + b TEXT, + c TEXT, + PRIMARY KEY(a), + FULLTEXT KEY ftx1(b), + FULLTEXT KEY ftx2(c) +)ENGINE=Mroonga DEFAULT CHARSET=UTF8 COMMENT = 'engine "innodb"'; +SHOW CREATE TABLE ft; + +INSERT INTO ft VALUES(1,'aaaaa','abcde'); +INSERT INTO ft VALUES(2,'bbbbb','bcdef'); +INSERT INTO ft VALUES(3,'ccccc','cdefg'); +INSERT INTO ft VALUES(4,'ddddd','defgh'); +INSERT INTO ft VALUES(5,'eeeee','efghi'); + +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c FROM ft WHERE MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE) ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft WHERE MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE); +SELECT a, b, c, MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE) FROM ft ORDER BY MATCH(c) AGAINST('bbbbb' IN BOOLEAN MODE), MATCH(b) AGAINST('bbbbb' IN BOOLEAN MODE), a; + +DROP TABLE ft; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test new file mode 100644 index 00000000000..91e2f73da1d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_order_transaction.test @@ -0,0 +1,64 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE diaries; + +START TRANSACTION; +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +CONNECT(search_connection, localhost, root); +USE test; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +CONNECTION default; +COMMIT; + +CONNECTION search_connection; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; +DISCONNECT search_connection; + +CONNECTION default; +SELECT * FROM diaries + WHERE MATCH(body) AGAINST("groonga") + ORDER BY id; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test new file mode 100644 index 00000000000..fe80aae0804 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/fulltext_parser_comment.test @@ -0,0 +1,39 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) + comment 'parser "TokenBigramSplitSymbolAlphaDigit"' +) comment = 'engine "innodb"' default charset utf8; +show create table diaries; +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; +select * from diaries where match(body) against("start"); +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test new file mode 100644 index 00000000000..c4961756a26 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_grn_id.test @@ -0,0 +1,52 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +DROP FUNCTION IF EXISTS last_insert_grn_id; +--enable_warnings + +--disable_query_log +if ($VERSION_COMPILE_OS_WIN) +{ + CREATE FUNCTION last_insert_grn_id RETURNS integer SONAME 'ha_mroonga.dll'; +} +if (!$VERSION_COMPILE_OS_WIN) +{ + CREATE FUNCTION last_insert_grn_id RETURNS integer SONAME 'ha_mroonga.so'; +} +--enable_query_log + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +SELECT last_insert_grn_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_grn_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +DROP FUNCTION last_insert_grn_id; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test new file mode 100644 index 00000000000..1b7c3a7f265 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_reference.test @@ -0,0 +1,36 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test new file mode 100644 index 00000000000..6dc87f740f9 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/function_last_insert_id_set.test @@ -0,0 +1,38 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id int AUTO_INCREMENT PRIMARY KEY +) COMMENT='ENGINE "InnoDB"'; + +SELECT last_insert_id(); +SELECT last_insert_id(10); +SELECT last_insert_id(); + +INSERT INTO ids VALUES(); +SELECT last_insert_id(); +SELECT * FROM ids; + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test new file mode 100644 index 00000000000..4676fc61331 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_contains.test @@ -0,0 +1,145 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; +insert into shops (name, location) + values ('nezu-no-taiyaki', + GeomFromText('POINT(139.762573 35.720253)')); +insert into shops (name, location) + values ('taiyaki-kataoka', + GeomFromText('POINT(139.715591 35.712521)')); +insert into shops (name, location) + values ('soba-taiyaki-ku', + GeomFromText('POINT(139.659088 35.683712)')); +insert into shops (name, location) + values ('kuruma', + GeomFromText('POINT(139.706207 35.721516)')); +insert into shops (name, location) + values ('hirose-ya', + GeomFromText('POINT(139.685608 35.714844)')); +insert into shops (name, location) + values ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +insert into shops (name, location) + values ('omede-taiyaki', + GeomFromText('POINT(139.817154 35.700516)')); +insert into shops (name, location) + values ('onaga-ya', + GeomFromText('POINT(139.81105 35.698254)')); +insert into shops (name, location) + values ('shiro-ya', + GeomFromText('POINT(139.638611 35.705517)')); +insert into shops (name, location) + values ('fuji-ya', + GeomFromText('POINT(139.637115 35.703938)')); +insert into shops (name, location) + values ('miyoshi', + GeomFromText('POINT(139.537323 35.644539)')); +insert into shops (name, location) + values ('juju-ya', + GeomFromText('POINT(139.695755 35.628922)')); +insert into shops (name, location) + values ('tatsumi-ya', + GeomFromText('POINT(139.638657 35.665501)')); +insert into shops (name, location) + values ('tetsuji', + GeomFromText('POINT(139.76857 35.680912)')); +insert into shops (name, location) + values ('gazuma-ya', + GeomFromText('POINT(139.647598 35.700817)')); +insert into shops (name, location) + values ('honma-mon', + GeomFromText('POINT(139.652573 35.722736)')); +insert into shops (name, location) + values ('naniwa-ya', + GeomFromText('POINT(139.796234 35.730061)')); +insert into shops (name, location) + values ('kuro-dai', + GeomFromText('POINT(139.704834 35.650345)')); +insert into shops (name, location) + values ('daruma', + GeomFromText('POINT(139.770599 35.681461)')); +insert into shops (name, location) + values ('yanagi-ya', + GeomFromText('POINT(139.783981 35.685341)')); +insert into shops (name, location) + values ('sharaku', + GeomFromText('POINT(139.794846 35.716969)')); +insert into shops (name, location) + values ('takane', + GeomFromText('POINT(139.560913 35.698601)')); +insert into shops (name, location) + values ('chiyoda', + GeomFromText('POINT(139.652817 35.642601)')); +insert into shops (name, location) + values ('da-ka-po', + GeomFromText('POINT(139.727356 35.627346)')); +insert into shops (name, location) + values ('matsushima-ya', + GeomFromText('POINT(139.737381 35.640556)')); +insert into shops (name, location) + values ('kazuya', + GeomFromText('POINT(139.760895 35.673508)')); +insert into shops (name, location) + values ('furuya-kogane-an', + GeomFromText('POINT(139.676071 35.680603)')); +insert into shops (name, location) + values ('hachi-no-ie', + GeomFromText('POINT(139.668106 35.608021)')); +insert into shops (name, location) + values ('azuki-chan', + GeomFromText('POINT(139.673203 35.64151)')); +insert into shops (name, location) + values ('kuriko-an', + GeomFromText('POINT(139.796829 35.712013)')); +insert into shops (name, location) + values ('yume-no-aru-machi-no-taiyaki-ya-san', + GeomFromText('POINT(139.712524 35.616199)')); +insert into shops (name, location) + values ('naze-ya', + GeomFromText('POINT(139.665833 35.609039)')); +insert into shops (name, location) + values ('sanoki-ya', + GeomFromText('POINT(139.770721 35.66592)')); +insert into shops (name, location) + values ('shigeta', + GeomFromText('POINT(139.780273 35.672626)')); +insert into shops (name, location) + values ('nishimi-ya', + GeomFromText('POINT(139.774628 35.671825)')); +insert into shops (name, location) + values ('hiiragi', + GeomFromText('POINT(139.711517 35.647701)')); +select id, name, AsText(location) as location_text from shops; +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location); +drop table shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test new file mode 100644 index 00000000000..25814635b22 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_delete.test @@ -0,0 +1,48 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; + +insert into shops (name, location) + values ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); + +delete from shops + where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); + +select id, name, AsText(location) as location_text from shops; + +drop table shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test new file mode 100644 index 00000000000..c6bb8a1d4e6 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/geometry_update.test @@ -0,0 +1,50 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/have_geometry.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists shops; +--enable_warnings + +create table shops ( + id int primary key auto_increment, + name text, + location geometry NOT NULL, + spatial key location_index (location) +) comment = 'engine "innodb"'; +show create table shops; + +insert into shops (name, location) + values ('sazare', + GeomFromText('POINT(139.685043 35.714653)')); +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location); + +update shops set location = GeomFromText('POINT(139.66116 35.57566)') + where name = 'sazare'; +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.68466 35.71592, 139.68804 35.71411)'), location); +select id, name, AsText(location) as location_text from shops + where MBRContains(GeomFromText('LineString(139.65659 35.57903, 139.66489 35.57262)'), location); + +drop table shops; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test new file mode 100644 index 00000000000..037f8b02fbf --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/index_force_index_not_used.test @@ -0,0 +1,32 @@ +# Copyright(C) 2013 Kentoku SHIBA +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS ids; +--enable_warnings + +CREATE TABLE ids ( + id INT PRIMARY KEY AUTO_INCREMENT +) DEFAULT CHARSET UTF8 COMMENT = 'engine "InnoDB"'; +SELECT COUNT(*) FROM ids FORCE INDEX(PRIMARY); + +DROP TABLE ids; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..e619b0af930 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_TODO_SPLIT_ME.test @@ -0,0 +1,91 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# data types +create table t1 (c1 tinyint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 smallint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 mediumint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 int primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 bigint primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(1); +select * from t1; +drop table t1; + +create table t1 (c1 float primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 double primary key) COMMENT = 'engine "innodb"'; +insert into t1 values(0.5); +select * from t1; +drop table t1; + +create table t1 (c1 date primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26"); +select * from t1; +drop table t1; + +create table t1 (c1 time primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("11:22:33"); +select * from t1; +drop table t1; + +create table t1 (c1 year primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010"); +select * from t1; +drop table t1; + +create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; +insert into t1 values("2010/03/26 11:22:33"); +select * from t1; +drop table t1; + + +# duplicated key error +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +insert into t1 values(1,100); +select * from t1; +--error ER_DUP_ENTRY +insert into t1 values(1,200); +select * from t1; +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test new file mode 100644 index 00000000000..4087abf9bc3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_bulk.test @@ -0,0 +1,44 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +set names utf8; +create table diaries ( + id int primary key, + content text, + fulltext index (content) +) default charset utf8 comment = 'engine "innodb"'; +show create table diaries; + +LOCK TABLE diaries WRITE; +insert into diaries values(1, "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +insert into diaries values(2, "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +insert into diaries values(3, "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); +UNLOCK TABLES; + +select * from diaries; + +select * from diaries where match(content) against("天気"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test new file mode 100644 index 00000000000..cc3bc477409 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + date TIMESTAMP NOT NULL, + title VARCHAR(100) NOT NULL, + content TEXT NOT NULL, + PRIMARY KEY (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); + +SELECT * FROM diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy new shoes.") + ON DUPLICATE KEY UPDATE date = "2012-03-03", + content = "I buy a new hat."; + +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test new file mode 100644 index 00000000000..cdcdcc796f3 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.test @@ -0,0 +1,49 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + date TIMESTAMP NOT NULL, + title VARCHAR(100) NOT NULL, + content TEXT NOT NULL, + UNIQUE INDEX (date, title) +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "cloudy day", "Today is cloudy day..."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy a new shirt."); +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-05", "rainy day", "Today is rainy day..."); + +SELECT * FROM diaries; + +INSERT INTO diaries (date, title, content) + VALUES ("2012-03-04", "shopping", "I buy new shoes.") + ON DUPLICATE KEY UPDATE date = "2012-03-03", + content = "I buy a new hat."; +SELECT * FROM diaries; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test new file mode 100644 index 00000000000..f5b429e523b --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/multi_range_read_disk_sweep.test @@ -0,0 +1,45 @@ +# Copyright(C) 2013 Kenji Maruyama +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_mysql.inc +--source ../../include/mroonga/have_version_56_or_later.inc +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS integers; +--enable_warnings + +SET optimizer_switch='mrr_cost_based=off'; + +CREATE TABLE integers ( + id INT PRIMARY KEY AUTO_INCREMENT, + value INT, + KEY (value) +) COMMENT='engine "InnoDB"'; + +INSERT INTO integers (value) VALUES (0), (1), (2), (3); + +EXPLAIN SELECT * FROM integers + WHERE value IN (0, 2); + +SELECT * FROM integers + WHERE value IN (0, 2); + +DROP TABLE integers; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test new file mode 100644 index 00000000000..39772e5d78d --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_TODO_SPLIT_ME.test @@ -0,0 +1,68 @@ +# Copyright(C) 2010 Kentoku SHIBA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 ( + c1 int primary key, + c2 int, + c3 text, + key idx1(c2), + fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); + +select *, match(c3) against("ii") from t1 + where match(c3) against("ii") order by c1 desc limit 1; +show status like 'mroonga_fast_order_limit'; + +select *, match(c3) against("ii") from t1 + where match(c3) against("ii") order by c1 limit 1; +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") desc; +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") desc limit 1, 1; +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii"); +show status like 'mroonga_fast_order_limit'; + +select c3, match(c3) against("ii") from t1 + where match(c3) against("ii") order by match(c3) against("ii") limit 1; +show status like 'mroonga_fast_order_limit'; + +select count(*) from t1 where match(c3) against("ii") limit 1; +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test new file mode 100644 index 00000000000..da37f5d6372 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/optimization_order_limit_no_where_clause.test @@ -0,0 +1,46 @@ +# Copyright(C) 2013 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +flush status; +create table t1 ( + c1 int primary key, + c2 int, + c3 text, + key idx1(c2), + fulltext index ft(c3) +) comment = 'engine "innodb"'; +insert into t1 values(1,10,"aa ii uu ee oo"); +insert into t1 values(2,20,"ka ki ku ke ko"); +insert into t1 values(3,30,"ii si ii se ii"); +insert into t1 values(4,40,"ta ti tu te to"); +insert into t1 values(5,50,"aa ii uu ii oo"); + +show status like 'mroonga_fast_order_limit'; + +select *, match(c3) against("ii") from t1 order by c1 desc limit 1; + +show status like 'mroonga_fast_order_limit'; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test new file mode 100644 index 00000000000..b333991d27e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_files.test @@ -0,0 +1,69 @@ +# Copyright(C) 2013 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +--disable_warnings +DROP DATABASE IF EXISTS repair_test; +CREATE DATABASE repair_test; +USE repair_test; + +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX body_index (body) +) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +--remove_file $MYSQLD_DATADIR/repair_test.mrn +--remove_file $MYSQLD_DATADIR/repair_test.mrn.001 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000000 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000103 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000104 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000105 +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000105.c + +FLUSH TABLES; + +# Error ER_CANT_OPEN_FILE mroonga: failed to open table: +--error ER_CANT_OPEN_FILE +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +REPAIR TABLE diaries; + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +DROP TABLE diaries; + +DROP DATABASE repair_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test new file mode 100644 index 00000000000..ce6e1d23280 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/repair_table_no_index_file.test @@ -0,0 +1,63 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc +--source ../../include/mroonga/have_mroonga_helper.inc + +--disable_warnings +DROP DATABASE IF EXISTS repair_test; +CREATE DATABASE repair_test; +USE repair_test; + +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX body_index (body) +) COMMENT = 'engine "innodb"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +--remove_file $MYSQLD_DATADIR/repair_test.mrn.0000104 + +FLUSH TABLES; + +# Error ER_CANT_OPEN_FILE syscall error 'repair_test.mrn.0000104' (No such file or directory) +--error ER_CANT_OPEN_FILE +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +REPAIR TABLE diaries; + +SELECT * FROM diaries; + +SELECT * FROM diaries WHERE MATCH(body) AGAINST("starting"); + +DROP TABLE diaries; + +DROP DATABASE repair_test; +USE test; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test new file mode 100644 index 00000000000..0eb5ef514a2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/temporary_table.test @@ -0,0 +1,40 @@ +# Copyright(C) 2012 Kouhei Sutou +# Copyright(C) 2014 Toshihisa Tashiro +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TEMPORARY TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT +) DEFAULT CHARSET=UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title) VALUES ("clear day"); +INSERT INTO diaries (title) VALUES ("rainy day"); +INSERT INTO diaries (title) VALUES ("cloudy day"); + +SELECT * FROM diaries; + +DROP TEMPORARY TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test new file mode 100644 index 00000000000..b2522db7919 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_query_cache.test @@ -0,0 +1,53 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +SET @tmp_query_cache_size = @@query_cache_size; +SET GLOBAL query_cache_size = 1048576; + +--disable_warnings +DROP TABLE IF EXISTS simple_table; +--enable_warnings + +CREATE TABLE simple_table ( + id INT PRIMARY KEY +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET=UTF8; +SHOW CREATE TABLE simple_table; + +INSERT INTO simple_table (id) VALUES (1),(2); + +CONNECT(second_connection, localhost, root); +USE test; +START TRANSACTION; +INSERT INTO simple_table (id) VALUES (3); + +CONNECTION default; +SELECT * FROM simple_table; + +CONNECTION second_connection; +COMMIT; + +CONNECTION default; +SELECT * FROM simple_table; + +DROP TABLE simple_table; +DISCONNECT second_connection; + +SET GLOBAL query_cache_size = @tmp_query_cache_size; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test new file mode 100644 index 00000000000..f0da6934f8e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_delete.test @@ -0,0 +1,59 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +DELETE FROM diaries WHERE id = 1; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey") AND + MATCH(body) AGAINST("groonga"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test new file mode 100644 index 00000000000..425a16c204e --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/transaction_rollback_delete_update.test @@ -0,0 +1,56 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + body TEXT, + FULLTEXT INDEX title_index (title), + FULLTEXT INDEX body_index (body) +) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!"); +INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga..."); +INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga."); + +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +START TRANSACTION; +DELETE FROM diaries WHERE id = 1; +ROLLBACK; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +UPDATE diaries SET title = "survey day!" WHERE id = 1; + +SELECT * FROM diaries; +SELECT * FROM diaries + WHERE MATCH(title) AGAINST("survey"); + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test new file mode 100644 index 00000000000..987fd284f74 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/truncate.test @@ -0,0 +1,57 @@ +# Copyright(C) 2011-2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SET NAMES UTF8; +CREATE TABLE diaries ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + year INT UNSIGNED, + month INT UNSIGNED, + day INT UNSIGNED, + title VARCHAR(255), + content TEXT, + FULLTEXT INDEX(content), + KEY(day) +) DEFAULT CHARSET UTF8 COMMENT = 'engine "innodb"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries VALUES(1, 2011, 11, 9, "Hello", "今日ã‹ã‚‰ã¯ã˜ã‚ã¾ã—ãŸã€‚"); +INSERT INTO diaries VALUES(2, 2011, 11, 10, "天気", "明日ã®å¯Œå£«å±±ã®å¤©æ°—ã«ã¤ã„ã¦"); +INSERT INTO diaries VALUES(3, 2011, 11, 11, "富士山", "今日も天気ãŒã‚ˆãã¦ãれã„ã«è¦‹ãˆã‚‹ã€‚"); + +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); +TRUNCATE TABLE diaries; +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("今日 天気" IN BOOLEAN MODE); + +INSERT INTO diaries VALUES(1, 2011, 11, 11, "帰りé“", "ã¤ã‹ã‚ŒãŸãƒ¼"); +INSERT INTO diaries VALUES(2, 2011, 12, 1, "ä¹…ã—ã¶ã‚Š", "å¤©æ°—ãŒæ‚ªã„ã‹ã‚‰ãšã£ã¨ç•™å®ˆç•ªã€‚"); +INSERT INTO diaries VALUES(3, 2011, 12, 2, "åˆé›ª", "今年ã¯ã˜ã‚ã¦ã®é›ªï¼"); + +SELECT * FROM diaries; +SELECT * FROM diaries WHERE MATCH(content) AGAINST("悪ã„" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test new file mode 100644 index 00000000000..50c14184c98 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_fulltext.test @@ -0,0 +1,43 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 text, fulltext index (c2)) COMMENT = 'engine "innodb"'; +insert into t1 values(10, "aa ii uu ee"); +insert into t1 values(20, "ka ki ku ke"); +insert into t1 values(30, "sa si su se"); + +select * from t1; +update t1 set c2="ta ti tu te" where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +update t1 set c1=40 where c1=20; +select * from t1; +select * from t1 where match(c2) against("ti"); +select * from t1 where match(c2) against("ki"); + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test new file mode 100644 index 00000000000..5c794aacf65 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/update_int.test @@ -0,0 +1,41 @@ +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +create table t1 (c1 int primary key, c2 int) COMMENT = 'engine "innodb"'; +show create table t1; +insert into t1 values (1, 100); +insert into t1 values (2, 101); +insert into t1 values (3, 102); +select * from t1; + +update t1 set c2=c2+100 where c1=1; +select * from t1; +update t1 set c2=c2+100 where c1=2; +select * from t1; +update t1 set c2=c2+100 where c1=3; +select * from t1; + +drop table t1; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test new file mode 100644 index 00000000000..165c8df858a --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_delete.test @@ -0,0 +1,55 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); +insert into diaries (body) values ("starting groonga..."); +insert into diaries (body) values ("started groonga."); +select * from diaries; + +set mroonga_dry_write=true; +delete from diaries where id = 2; +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +set mroonga_dry_write=false; +delete from diaries where id = 3; +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +insert into diaries (id, body) values (2, "sleeping..."); +select * from diaries; +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test new file mode 100644 index 00000000000..b1222118833 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_insert.test @@ -0,0 +1,47 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +set mroonga_dry_write=true; +insert into diaries (body) values ("starting groonga..."); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +set mroonga_dry_write=false; +insert into diaries (body) values ("started groonga."); +select * from diaries; +select * from diaries where match (body) against ("groonga"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test new file mode 100644 index 00000000000..6b47d18b872 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_dry_write_update.test @@ -0,0 +1,48 @@ +# Copyright(C) 2011 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +drop table if exists diaries; +--enable_warnings + +create table diaries ( + id int primary key auto_increment, + body text, + fulltext index body_index (body) +) default charset utf8 COMMENT = 'engine "innodb"'; +show create table diaries; + +insert into diaries (body) values ("will start groonga!"); + +set mroonga_dry_write=true; +update diaries set body = "starting groonga..." where id = 1; +select * from diaries; +select * from diaries where match (body) against ("will"); +select * from diaries where match (body) against ("starting"); + +set mroonga_dry_write=false; +update diaries set body = "started groonga." where id = 1; +select * from diaries; +select * from diaries where match (body) against ("will"); +select * from diaries where match (body) against ("starting"); +select * from diaries where match (body) against ("started"); + +drop table diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test new file mode 100644 index 00000000000..b272649c732 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_global.test @@ -0,0 +1,56 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +# MySQL <= 5.5 reports wrong a warning. :< +# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. +--disable_warnings +SET GLOBAL mroonga_match_escalation_threshold = -1; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); + + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET GLOBAL mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test new file mode 100644 index 00000000000..bf22001bb10 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/variable_match_escalation_threshold_session.test @@ -0,0 +1,54 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_innodb.inc +--source ../../include/mroonga/have_fulltext_index_comment.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + title TEXT, + tags TEXT, + FULLTEXT INDEX tags_index (tags) COMMENT 'parser "TokenDelimit"' +) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (title, tags) VALUES ("Hello groonga!", "groonga install"); +INSERT INTO diaries (title, tags) VALUES ("Hello mroonga!", "mroonga install"); + + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("install" IN BOOLEAN MODE); + +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +# MySQL <= 5.5 reports wrong a warning. :< +# It has been fixed in MySQL >= 5.6 and MariaDB >= 5.3. +--disable_warnings +SET mroonga_match_escalation_threshold = -1; +--enable_warnings +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + +SET mroonga_match_escalation_threshold = 0; +SELECT * FROM diaries WHERE MATCH (tags) AGAINST ("gr" IN BOOLEAN MODE); + + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test new file mode 100644 index 00000000000..809b6fa29b1 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/version_55_performance_schema.test @@ -0,0 +1,41 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_55.inc +--source include/have_innodb.inc +--source include/not_embedded.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SHOW VARIABLES LIKE 'performance_schema'; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + content VARCHAR(255), + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!"); + +SHOW TABLES FROM performance_schema; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/version_56_or_later_performance_schema.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/version_56_or_later_performance_schema.test new file mode 100644 index 00000000000..20cb2107ec2 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/version_56_or_later_performance_schema.test @@ -0,0 +1,42 @@ +# Copyright(C) 2012 Kouhei Sutou +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source ../../include/mroonga/have_version_56_or_later.inc +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source ../../include/mroonga/have_mroonga.inc + +--disable_warnings +DROP TABLE IF EXISTS diaries; +--enable_warnings + +SHOW VARIABLES LIKE 'performance_schema'; + +CREATE TABLE diaries ( + id INT PRIMARY KEY AUTO_INCREMENT, + content VARCHAR(255), + FULLTEXT INDEX (content) +) DEFAULT CHARSET UTF8 COMMENT = 'ENGINE "InnoDB"'; +SHOW CREATE TABLE diaries; + +INSERT INTO diaries (content) VALUES ("Tommorow will be shiny day!"); + +SHOW TABLES FROM performance_schema; + +DROP TABLE diaries; + +--source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/plug.in b/storage/mroonga/plug.in new file mode 100644 index 00000000000..2c9c15f6c86 --- /dev/null +++ b/storage/mroonga/plug.in @@ -0,0 +1,6 @@ +MYSQL_STORAGE_ENGINE(mroonga,,[mroonga], +[[CJK-ready fulltext search, column store]], +[max,max-no-ndb]) +MYSQL_PLUGIN_DIRECTORY(mroonga, [storage/mroonga]) +MYSQL_PLUGIN_STATIC(mroonga, [libmroonga.a]) +MYSQL_PLUGIN_DYNAMIC(mroonga, [ha_mroonga.la]) diff --git a/storage/mroonga/plugin_version b/storage/mroonga/plugin_version new file mode 100644 index 00000000000..be9fc83102e --- /dev/null +++ b/storage/mroonga/plugin_version @@ -0,0 +1 @@ +4.6 \ No newline at end of file diff --git a/storage/mroonga/required_groonga_normalizer_mysql_version b/storage/mroonga/required_groonga_normalizer_mysql_version new file mode 100644 index 00000000000..af0b7ddbffd --- /dev/null +++ b/storage/mroonga/required_groonga_normalizer_mysql_version @@ -0,0 +1 @@ +1.0.6 diff --git a/storage/mroonga/required_groonga_version b/storage/mroonga/required_groonga_version new file mode 100644 index 00000000000..fcdb2e109f6 --- /dev/null +++ b/storage/mroonga/required_groonga_version @@ -0,0 +1 @@ +4.0.0 diff --git a/storage/mroonga/sources.am b/storage/mroonga/sources.am new file mode 100644 index 00000000000..0cf4a64b504 --- /dev/null +++ b/storage/mroonga/sources.am @@ -0,0 +1,11 @@ +sources = \ + mrn_macro.hpp \ + mrn_constants.hpp \ + ha_mroonga.cpp \ + ha_mroonga.hpp \ + mrn_table.cpp \ + mrn_table.hpp \ + mrn_err.h \ + mrn_mysql.h \ + mrn_mysql_compat.h \ + ha_mroonga.def diff --git a/storage/mroonga/test/Makefile.am b/storage/mroonga/test/Makefile.am new file mode 100644 index 00000000000..ce75011bee8 --- /dev/null +++ b/storage/mroonga/test/Makefile.am @@ -0,0 +1,14 @@ +SUBDIRS = unit + +TESTS = run-sql-test.sh +TESTS_ENVIRONMENT = \ + NO_MAKE="yes" + +if WITH_CUTTER +TESTS += run-unit-test.sh +TESTS_ENVIRONMENT += CUTTER="$(CUTTER)" +endif + +EXTRA_DIST = \ + run-unit-test.sh \ + run-sql-test.sh diff --git a/storage/mroonga/test/run-sql-test.sh b/storage/mroonga/test/run-sql-test.sh new file mode 100755 index 00000000000..690f75c413b --- /dev/null +++ b/storage/mroonga/test/run-sql-test.sh @@ -0,0 +1,232 @@ +#!/bin/sh +# +# Copyright(C) 2010 Tetsuro IKEDA +# Copyright(C) 2010-2013 Kouhei Sutou +# Copyright(C) 2011 Kazuhiko +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +export BASE_DIR="$(cd $(dirname $0); pwd)" +top_dir="$BASE_DIR/.." +mroonga_test_dir="${top_dir}/mysql-test/mroonga" + +n_processors=1 +case `uname` in + Linux) + n_processors="$(grep '^processor' /proc/cpuinfo | wc -l)" + ;; + Darwin) + n_processors="$(/usr/sbin/sysctl -n hw.ncpu)" + ;; + *) + : + ;; +esac + +if [ "$NO_MAKE" != "yes" ]; then + MAKE_ARGS= + if [ -n "$n_processors" ]; then + MAKE_ARGS="-j${n_processors}" + fi + make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 +fi + +. "${top_dir}/config.sh" + +bundled_groonga_normalizer_mysql_dir="${top_dir}/vendor/groonga/vendor/plugins/groonga-normalizer-mysql" +if [ -d "${bundled_groonga_normalizer_mysql_dir}" ]; then + GRN_PLUGINS_DIR="${bundled_groonga_normalizer_mysql_dir}" + export GRN_PLUGINS_DIR +fi + +source_mysql_test_dir="${MYSQL_SOURCE_DIR}/mysql-test" +build_mysql_test_dir="${MYSQL_BUILD_DIR}/mysql-test" +source_test_suites_dir="${source_mysql_test_dir}/suite" +source_test_include_dir="${source_mysql_test_dir}/include" +build_test_suites_dir="${build_mysql_test_dir}/suite" +build_test_include_dir="${build_mysql_test_dir}/include" +case "${MYSQL_VERSION}" in + 5.1.*) + plugins_dir="${MYSQL_BUILD_DIR}/lib/mysql/plugin" + if [ ! -d "${build_test_suites_dir}" ]; then + mkdir -p "${build_test_suites_dir}" + fi + ;; + *) + if [ ! -d "${build_test_suites_dir}" ]; then + ln -s "${source_test_suites_dir}" "${build_test_suites_dir}" + fi + maria_storage_dir="${MYSQL_SOURCE_DIR}/storage/maria" + if [ -d "${maria_storage_dir}" ]; then + mariadb="yes" + else + mariadb="no" + fi + if [ "${mariadb}" = "yes" ]; then + if [ "${MRN_BUNDLED}" != "TRUE" ]; then + mariadb_mroonga_plugin_dir="${MYSQL_BUILD_DIR}/plugin/mroonga" + if [ ! -e "${mariadb_mroonga_plugin_dir}" ]; then + ln -s "${top_dir}" "${mariadb_mroonga_plugin_dir}" + fi + fi + plugins_dir= + else + plugins_dir="${MYSQL_SOURCE_DIR}/lib/plugin" + fi + ;; +esac + +same_link_p() +{ + src=$1 + dest=$2 + if [ -L "$dest" -a "$(readlink "$dest")" = "$src" ]; then + return 0 + else + return 1 + fi +} + +mroonga_mysql_test_suite_dir="${build_test_suites_dir}/mroonga" +if ! same_link_p "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}"; then + rm -rf "${mroonga_mysql_test_suite_dir}" + ln -s "${mroonga_test_dir}" "${mroonga_mysql_test_suite_dir}" +fi + +innodb_test_suite_dir="${build_test_suites_dir}/innodb" +mroonga_wrapper_innodb_test_suite_name="mroonga_wrapper_innodb" +mroonga_wrapper_innodb_test_suite_dir="${build_test_suites_dir}/${mroonga_wrapper_innodb_test_suite_name}" +mroonga_wrapper_innodb_include_dir="${mroonga_wrapper_innodb_test_suite_dir}/include/" +if [ "$0" -nt "$(dirname "${mroonga_wrapper_innodb_test_suite_dir}")" ]; then + rm -rf "${mroonga_wrapper_innodb_test_suite_dir}" +fi +if [ ! -d "${mroonga_wrapper_innodb_test_suite_dir}" ]; then + cp -rp "${innodb_test_suite_dir}" "${mroonga_wrapper_innodb_test_suite_dir}" + mkdir -p "${mroonga_wrapper_innodb_include_dir}" + cp -rp "${source_test_include_dir}"/innodb[-_]*.inc \ + "${mroonga_wrapper_innodb_include_dir}" + ruby -i'' \ + -pe "\$_.gsub!(/\\bengine\\s*=\\s*innodb\\b([^;\\n]*)/i, + \"ENGINE=mroonga\\\1 COMMENT='ENGINE \\\"InnoDB\\\"'\") + \$_.gsub!(/\\b(storage_engine\\s*=\\s*)innodb\\b([^;\\n]*)/i, + \"\\\1mroonga\") + \$_.gsub!(/^(--\\s*source\\s+)(include\\/innodb)/i, + \"\\\1suite/mroonga_wrapper_innodb/\\\2\") + " \ + ${mroonga_wrapper_innodb_test_suite_dir}/r/*.result \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test \ + ${mroonga_wrapper_innodb_test_suite_dir}/include/*.inc + sed -i'' \ + -e '1 i --source ../mroonga/include/mroonga/have_mroonga.inc' \ + ${mroonga_wrapper_innodb_test_suite_dir}/t/*.test +fi + +all_test_suite_names="" +suite_dir="${mroonga_test_dir}/.." +cd "${suite_dir}" +suite_dir="$(pwd)" +for test_suite_name in \ + $(find mroonga -type d -name 'include' '!' -prune -o \ + -type d '!' -name 'mroonga' \ + '!' -name 'include' \ + '!' -name '[tr]'); do + if [ -n "${all_test_suite_names}" ]; then + all_test_suite_names="${all_test_suite_names}," + fi + all_test_suite_names="${all_test_suite_names}${test_suite_name}" +done +cd - + +if [ -n "${plugins_dir}" ]; then + if [ -d "${top_dir}/.libs" ]; then + make -C ${top_dir} \ + install-pluginLTLIBRARIES \ + plugindir=${plugins_dir} > /dev/null || \ + exit 1 + else + mkdir -p "${plugins_dir}" + cp "${top_dir}/ha_mroonga.so" "${plugins_dir}" || exit 1 + fi +fi + +test_suite_names="" +test_names="" +while [ $# -gt 0 ]; do + case "$1" in + --manual-gdb|--debug) + n_processors=1 + break + ;; + --*) + break + ;; + *) + case "$1" in + */t/*.test) + test_suite_name=$(echo "$1" | sed -e 's,/t/.*\.test,,g') + test_suite_name=$(cd "$test_suite_name" && pwd) + test_name=$(echo "$1" | sed -e 's,.*/t/\(.*\)\.test,\1,g') + ;; + *) + if [ -d "$1" ]; then + test_suite_name=$(cd "$1" && pwd) + else + test_suite_name="$1" + fi + test_name="" + ;; + esac + shift + + if [ -n "${test_name}" ]; then + if [ -n "${test_names}" ]; then + test_names="${test_names}|" + fi + test_names="${test_names}.*${test_name}" + fi + + test_suite_name=$(echo "$test_suite_name" | sed -e "s,^${suite_dir}/,,") + if echo "${test_suite_names}" | grep --quiet "${test_suite_name}"; then + continue + fi + if [ -n "${test_suite_names}" ]; then + test_suite_names="${test_suite_names}," + fi + test_suite_names="${test_suite_names}${test_suite_name}" + ;; + esac +done + +if [ -z "$test_suite_names" ]; then + test_suite_names="${all_test_suite_names}" +fi + +mysql_test_run_args="" +mysql_test_run_args="${mysql_test_run_args} --mem" +mysql_test_run_args="${mysql_test_run_args} --no-check-testcases" +mysql_test_run_args="${mysql_test_run_args} --parallel=${n_processors}" +mysql_test_run_args="${mysql_test_run_args} --retry=1" +mysql_test_run_args="${mysql_test_run_args} --suite=${test_suite_names}" +mysql_test_run_args="${mysql_test_run_args} --force" +mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-load-add=ha_mroonga.so" +mysql_test_run_args="${mysql_test_run_args} --mysqld=--loose-plugin-mroonga=ON" +if [ -n "$test_names" ]; then + mysql_test_run_args="${mysql_test_run_args} --do-test=${test_names}" +fi + +(cd "$build_mysql_test_dir" && \ + ./mysql-test-run.pl \ + ${mysql_test_run_args} \ + "$@") diff --git a/storage/mroonga/test/run-unit-test.sh b/storage/mroonga/test/run-unit-test.sh new file mode 100755 index 00000000000..6d99513123d --- /dev/null +++ b/storage/mroonga/test/run-unit-test.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +export BASE_DIR="`dirname $0`" +top_dir="$BASE_DIR/.." + +if test -z "$NO_MAKE"; then + MAKE_ARGS= + case `uname` in + Linux) + MAKE_ARGS="-j$(grep '^processor' /proc/cpuinfo | wc -l)" + ;; + Darwin) + MAKE_ARGS="-j$(/usr/sbin/sysctl -n hw.ncpu)" + ;; + *) + : + ;; + esac + make $MAKE_ARGS -C $top_dir > /dev/null || exit 1 +fi + +if test -z "$CUTTER"; then + CUTTER="`make -s -C $top_dir echo-cutter`" +fi +export CUTTER + +CUTTER_ARGS= +CUTTER_WRAPPER= +if test x"$STOP" = x"yes"; then + CUTTER_ARGS="-v v --fatal-failures" +else + CUTTER_ARGS="-v v" +fi + +if test x"$CUTTER_DEBUG" = x"yes"; then + if test x"$TUI_DEBUG" = x"yes"; then + CUTTER_WRAPPER="$top_dir/libtool --mode=execute gdb --tui --args" + else + CUTTER_WRAPPER="$top_dir/libtool --mode=execute gdb --args" + fi + CUTTER_ARGS="--keep-opening-modules" +elif test x"$CUTTER_CHECK_LEAK" = x"yes"; then + CUTTER_WRAPPER="$top_dir/libtool --mode=execute valgrind " + CUTTER_WRAPPER="$CUTTER_WRAPPER --leak-check=full --show-reachable=yes -v" + CUTTER_ARGS="--keep-opening-modules" +fi + +CUTTER_ARGS="$CUTTER_ARGS -s $BASE_DIR" +$CUTTER_WRAPPER $CUTTER $CUTTER_ARGS "$@" $BASE_DIR diff --git a/storage/mroonga/test/unit/Makefile.am b/storage/mroonga/test/unit/Makefile.am new file mode 100644 index 00000000000..3950ce0dc7f --- /dev/null +++ b/storage/mroonga/test/unit/Makefile.am @@ -0,0 +1,27 @@ +if WITH_CUTTER +noinst_LTLIBRARIES = \ + test_mrn_path_mapper.la +endif + +AM_CPPFLAGS = \ + $(GROONGA_CFLAGS) \ + $(CPPCUTTER_CFLAGS) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/lib + +AM_LDFLAGS = \ + -module \ + -rpath $(libdir) \ + -avoid-version \ + -no-undefined + +LIBS = \ + $(CPPCUTTER_LIBS) \ + $(GROONGA_LIBS) \ + $(MECAB_LIBS) + +test_mrn_path_mapper_la_SOURCES = \ + test_mrn_path_mapper.cpp + +test_mrn_path_mapper_la_LIBADD = \ + $(top_builddir)/lib/libmrn_no_mysql.la diff --git a/storage/mroonga/test/unit/test_mrn_path_mapper.cpp b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp new file mode 100644 index 00000000000..70009c5b32e --- /dev/null +++ b/storage/mroonga/test/unit/test_mrn_path_mapper.cpp @@ -0,0 +1,116 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2012 Kouhei Sutou + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include + +#include + +namespace test_mrn_path_mapper { + namespace db_path { + namespace without_prefix { + void test_normal_db() { + mrn::PathMapper mapper("./db/", NULL); + cppcut_assert_equal("db.mrn", mapper.db_path()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("db.mrn", mapper.db_path()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0.mrn", + mapper.db_path()); + } + } + + namespace with_prefix { + void test_normal_db() { + mrn::PathMapper mapper("./db/", "mroonga.data/"); + cppcut_assert_equal("mroonga.data/db.mrn", mapper.db_path()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", "mroonga.data/"); + cppcut_assert_equal("mroonga.data/db.mrn", mapper.db_path()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", "mroonga.data/"); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0.mrn", + mapper.db_path()); + } + } + } + + namespace db_name { + void test_normal_db() { + mrn::PathMapper mapper("./db/", NULL); + cppcut_assert_equal("db", mapper.db_name()); + } + + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("db", mapper.db_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("/tmp/mysqld.1/#sql27c5_1_0", + mapper.db_name()); + } + } + + namespace table_name { + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("table", mapper.table_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("#sql27c5_1_0", mapper.table_name()); + } + + void test_underscore_start_table() { + mrn::PathMapper mapper("./db/_table", NULL); + cppcut_assert_equal("@005ftable", mapper.table_name()); + } + } + + namespace mysql_table_name { + void test_normal_table() { + mrn::PathMapper mapper("./db/table", NULL); + cppcut_assert_equal("table", mapper.mysql_table_name()); + } + + void test_temporary_table() { + mrn::PathMapper mapper("/tmp/mysqld.1/#sql27c5_1_0", NULL); + cppcut_assert_equal("#sql27c5_1_0", mapper.mysql_table_name()); + } + + void test_underscore_start_table() { + mrn::PathMapper mapper("./db/_table", NULL); + cppcut_assert_equal("_table", mapper.mysql_table_name()); + } + } +} + diff --git a/storage/mroonga/tools/Makefile.am b/storage/mroonga/tools/Makefile.am new file mode 100644 index 00000000000..b65b930029b --- /dev/null +++ b/storage/mroonga/tools/Makefile.am @@ -0,0 +1,6 @@ +noinstall_ruby_scripts = \ + prepare-sphinx-html.rb \ + upload-to-github.rb + +EXTRA_DIST = \ + $(noinstall_ruby_scripts) diff --git a/storage/mroonga/tools/prepare-sphinx-html.rb b/storage/mroonga/tools/prepare-sphinx-html.rb new file mode 100755 index 00000000000..76eed24a042 --- /dev/null +++ b/storage/mroonga/tools/prepare-sphinx-html.rb @@ -0,0 +1,183 @@ +#!/usr/bin/env ruby +# -*- coding: utf-8 -*- + +if ARGV.size != 2 + puts "Usage: #{$0} SOURCE_DIR DEST_DIR" + exit(false) +end + +require 'pathname' +require "fileutils" + +def fix_link(text, extension, language) + send("fix_#{extension}_link", text, language) +end + +def fix_link_path(text) + text.gsub(/\b_(sources|static|images)\b/, '\1') +end + +def fix_language_link(url, language) + url.gsub(/\A((?:\.\.\/){2,})([a-z]{2})\/html\//) do + relative_base_path = $1 + link_language = $2 + close_quote = $3 + if language == "en" + relative_base_path = relative_base_path.gsub(/\A\.\.\//, '') + end + if link_language != "en" + relative_base_path += "#{link_language}/" + end + "#{relative_base_path}docs/" + end +end + +def fix_html_link(html, language) + html = html.gsub(/(href|src)="(.+?)"/) do + attribute = $1 + link = $2 + link = fix_link_path(link) + link = fix_language_link(link, language) + "#{attribute}=\"#{link}\"" + end + html.gsub(/(id="top-link" href=)"(.+?)"/) do + prefix = $1 + top_path = $2.gsub(/\/index\.html\z/, '/') + top_path = "./" if ["index.html", "#"].include?(top_path) + "#{prefix}\"#{top_path}../\"" + end +end + +def add_language_annotation_to_source_label(html) + html.gsub(/>(ソースコードを表示)#{label}(英語)<" + end +end + +def fix_js_link(js, language) + fix_link_path(js) +end + +LANGUAGE_TO_LOCALE = { + "ja" => "ja_JP", + "en" => "en_US", +} + +def insert_facebook_html_header(html) + html.gsub(/<\/head>/) do + <<-HTML + + + + + + + + + HTML + end +end + +def insert_facebook_html_fb_root(html) + html.gsub(//) do + <<-HTML + +
+ HTML + end +end + +def insert_facebook_html_buttons(html) + html.gsub(/(